Skip to content
Browse chapters
Imports

Raw HAM-CYCLE certificate checker

namespace CLRS.Chapter34abbrev encodeHamiltonianCycleCertificate := encodeCliqueCertificateabbrev decodeHamiltonianCycleCertificate := decodeCliqueCertificate

Total Boolean checker for an ordered Hamiltonian-cycle certificate.

def hamiltonianCycleVerifier (certificate input : List HamiltonianCycleSym) : Bool := match decodeHamiltonianCycleInstance input, decodeHamiltonianCycleCertificate certificate with | some I, some vertices => decide (I.WellFormed ∧ I.targetSize = I.vertexCount ∧ I.ListRepresentsHamiltonianCycle vertices) | _, _ => false
end CLRS.Chapter34