Skip to content
Browse chapters
Imports

HAM-CYCLE to TSP machine: normalized-pair weights

This stage deliberately reuses the complete-pair source and batched graph lookup already verified for the VERTEX-COVER complement machine. It computes one canonical 1/2 TSP field for every normalized pair of source vertices.

noncomputable sectionnamespace CLRS.Chapter34.Turing.TSPReductionopen _root_.Turing

Semantic textbook weights in the shared normalized-pair order.

def normalizedPairWeights (I : CliqueInstance) : List Nat := (VertexCover.ComplementMachine.NonedgeFilter.candidatePairs I).map fun edge => if edge ∈ I.edges then 1 else 2

Canonical compact fields for all normalized-pair weights.

def normalizedWeightFields (I : CliqueInstance) : List TSPSym := encodeTSPFields (normalizedPairWeights I)

A fixed polynomial-time TM2 maps a canonical graph encoding to all normalized textbook weight fields.

noncomputable def normalizedWeightFieldsComputableInPolyTime : TM2ComputableInPolyTime encodeCliqueInstance id normalizedWeightFields := by let composed := TM2Comp.TM2ComputableInPolyTime.comp_scratch VertexCover.ComplementMachine.NonedgeFilter.membershipBitsComputableInPolyTime WeightFields.computableInPolyTime let machine := Classical.choice composed exact { tm := machine.tm inputAlphabet := machine.inputAlphabet outputAlphabet := machine.outputAlphabet time := machine.time outputsFun := fun I => by have output := machine.outputsFun I simpa [Function.comp_def, weightFields_membershipBits] using output }
end CLRS.Chapter34.Turing.TSPReduction