# Evidome language — design preview. # Website excerpt; complete helper/outcome mappings follow in the appendix. program CatalogueVerification let catalogueBounds = { requestLimit = 4, candidateLimit = 2, searchLimit = 1 } let claimScope = { purpose = CatalogueRecordAttributeAgreement, requiredAttributes = [ Maker, Model ], variantFacets = Undetermined, excludes = [ Authenticity, Condition, UniqueSku, IndividualObjectIdentity ] } # Shared effectful search; @typeof selects the validated prepared specialization. searchCatalogue clues selectedKnowledge = flow issued <- catalogue.search @typeof(clues) clues with context = selectedKnowledge, requestLimit = catalogueBounds.requestLimit, candidateLimit = catalogueBounds.candidateLimit, searchLimit = catalogueBounds.searchLimit classifySearch issued role Capturer (subject, mediaSource, verifier, preparedKnowledge) = flow capture <- captureEvidence subject mediaSource match capture with | CaptureReady observed clues -> search <- searchCatalogue clues preparedKnowledge match search with | SearchCandidates candidates -> # Pure construction: this does not store, seal, send, or authorize. let bundle = makeEvidenceBundle subject observed clues candidates preparedKnowledge.reference # Explicit dispatch seals and sends the complete media-backed bundle. result <- verification.request verifier bundle with verifierEntry = Verifier, dispatchLimit = 1 finishCapture result | SearchInsufficient reason -> conclude InsufficientEvidence reason | SearchAmbiguous details -> conclude Ambiguous details | SearchTechnical terminal -> stop terminal | CaptureStopped terminal -> stop terminal role Verifier (bundleReference, preparedKnowledge) = flow opened <- evidence.open bundleReference with ingestLimit = 1 match opened with | Admitted captured -> resolved <- knowledge.resolve captured.selectedKnowledge with expected = preparedKnowledge.reference match resolved with | Resolved selectedKnowledge -> # Independent search over retained evidence; no spatial recapture. search <- searchCatalogue captured.identifyingEvidence selectedKnowledge match search with | SearchCandidates candidates -> report <- media.inspect @typeof({ media = captured.media, candidates = candidates }) captured.media candidates with context = selectedKnowledge, inspectionLimit = 7, verificationLimit = 1 match report with | Issued issuedReport -> # Pure assessment checks provenance and required readings; # this role then declares the typed disposition. let decision = assessInspection issuedReport candidates captured.media.reference selectedKnowledge.catalogueAgreementPolicy match decision with | InspectionSupported agreement -> conclude Match { record = agreement.record, scope = claimScope } | InspectionInsufficient details -> conclude InsufficientEvidence details | InspectionAmbiguous details -> conclude Ambiguous details | InspectionTechnical terminal -> stop terminal | SearchInsufficient reason -> conclude InsufficientEvidence reason | SearchAmbiguous details -> conclude Ambiguous details | SearchTechnical terminal -> stop terminal | KnowledgeNotReady terminal -> stop terminal | KnowledgeTechnical terminal -> stop terminal | IngestTechnical terminal -> stop terminal # Reference appendix — expanded helper bodies and closed outcome mappings # Normal edition: partial observation is refused before acquisition/search. captureEvidence subject mediaSource = flow observation <- media.observe @typeof(subject) mediaSource with objectives = [ FrontMiddle, LeftMiddle, RightMiddle, HeadstockFront, HeadstockBack, LabelArea ], attemptLimit = 1 match observation with | Completed observed -> acquisition <- media.acquireIdentifyingEvidence @typeof(observed) observed with objective = IdentifyingEvidence, advisoryRole = DiscriminatingAttributes, attemptLimit = 1 match acquisition with | Completed clues -> CaptureReady observed clues | NeedsMore details -> CaptureStopped (AcquisitionIncomplete details) | Unable reason -> CaptureStopped (AcquisitionUnable reason) | Refused reason -> CaptureStopped (AcquisitionRefused reason) | Exhausted reason -> CaptureStopped (AcquisitionExhausted reason) | Interrupted reason -> CaptureStopped (AcquisitionInterrupted reason) | Failed reason -> CaptureStopped (AcquisitionFailed reason) | Unavailable reason -> CaptureStopped (AcquisitionUnavailable reason) | Partial issuedAssessment -> CaptureStopped (PartialObservationNotAdmitted issuedAssessment) | Unable reason -> CaptureStopped (ObservationUnable reason) | Refused reason -> CaptureStopped (ObservationRefused reason) | Exhausted reason -> CaptureStopped (ObservationExhausted reason) | ContinuityLost reason -> CaptureStopped (ObservationContinuityLost reason) | Interrupted reason -> CaptureStopped (ObservationInterrupted reason) | Failed reason -> CaptureStopped (ObservationFailed reason) | Unavailable reason -> CaptureStopped (ObservationUnavailable reason) # Pure search classification. Technical categories retain their identity and # payload. Interrupted and cancelled share the authored interruption terminal, # while the origin remains explicit. classifySearch issued = match issued with | Found candidates -> SearchCandidates candidates | NoMatches -> SearchInsufficient NoCatalogueRecord | NoAvailableRecords reason -> SearchInsufficient reason | OverCandidateLimit count -> SearchAmbiguous count | Refused reason -> SearchTechnical (SearchRefused reason) | Unavailable reason -> SearchTechnical (SearchUnavailable reason) | Interrupted reason -> SearchTechnical (SearchInterrupted { origin = Interrupted, reason = reason }) | Cancelled reason -> SearchTechnical (SearchInterrupted { origin = Cancelled, reason = reason }) | Exhausted reason -> SearchTechnical (SearchExhausted reason) | Failed reason -> SearchTechnical (SearchFailed reason) # Pure construction preserves the actual retained media and selected knowledge. makeEvidenceBundle subject observed clues candidates knowledgeReference = evidenceBundle { subject = subject, media = observed.media, observation = observed, identifyingEvidence = clues, catalogueCandidates = candidates, selectedKnowledge = knowledgeReference, claimScope = claimScope } # Pure authored predicate for one required reading. A Supported tag is only an # input: the reading must belong to this evidence and selected record, then the # validated prepared policy must compare it with that record's authored value. assessReading report record attribute expectedEvidence policy = match report.readings.lookup attribute with | Missing -> ReadingMissing attribute | Found reading -> let association = { attribute = reading.attribute == attribute, record = reading.record == record.reference, evidence = reading.evidence == expectedEvidence } match association with | { attribute = true, record = true, evidence = true } -> match reading.status with | Supported issuedValue provenance -> let referenceValue = record.attributes.lookup attribute match policy.compareReading attribute issuedValue referenceValue with | Agrees proof -> ReadingAgrees { issuedValue, referenceValue, provenance, proof } | Contradicts proof -> ReadingContradicted proof | Unknown details -> ReadingUnknown details | OutsideAdmittedMethod details -> ReadingOutsideBounds details | Contradicted details -> ReadingContradicted details | Unknown details -> ReadingUnknown details | OutsideAuthoredBounds details -> ReadingOutsideBounds details | { attribute = false, record = _, evidence = _ } -> ReadingOutsideBounds WrongReadingAttribute | { attribute = true, record = false, evidence = _ } -> ReadingOutsideBounds ReadingRecordAssociationMismatch | { attribute = true, record = true, evidence = false } -> ReadingOutsideBounds ReadingEvidenceAssociationMismatch # Pure and exhaustive combination of the two required readings. assessRequiredReadings report record expectedEvidence policy = let maker = assessReading report record Maker expectedEvidence policy let model = assessReading report record Model expectedEvidence policy match maker with | ReadingContradicted details -> InspectionInsufficient details | ReadingOutsideBounds details -> InspectionAmbiguous details | ReadingUnknown details -> InspectionInsufficient details | ReadingMissing details -> InspectionInsufficient details | ReadingAgrees makerReading -> match model with | ReadingContradicted details -> InspectionInsufficient details | ReadingOutsideBounds details -> InspectionAmbiguous details | ReadingUnknown details -> InspectionInsufficient details | ReadingMissing details -> InspectionInsufficient details | ReadingAgrees modelReading -> InspectionSupported { record = record, maker = makerReading, model = modelReading } # Pure report assessment. The issued bounded-candidate disposition must first # prove that exactly one candidate remains under the validated authored policy. # A supporting report for one member of an unresolved two-candidate set cannot # become Match. assessInspection report candidates expectedEvidence policy = match report.candidateDisposition with | ResolvedOne selectedCandidate eliminatedAlternatives -> let disposition = { selectedInBound = candidates.contains selectedCandidate, selectedByReport = report.candidate == selectedCandidate, recordAssociated = report.record == selectedCandidate.record, evidenceAssociated = report.inspectedEvidence == expectedEvidence, policyBound = report.dispositionPolicy == policy.reference, alternativesCovered = eliminatedAlternatives.candidates == candidates.without selectedCandidate, alternativesResolved = eliminatedAlternatives.allResolved } match disposition with | { selectedInBound = true, selectedByReport = true, recordAssociated = true, evidenceAssociated = true, policyBound = true, alternativesCovered = true, alternativesResolved = true } -> match report.requiredAttributes with | Exactly [ Maker, Model ] -> assessRequiredReadings report report.record expectedEvidence policy | Missing attributes -> InspectionInsufficient { missingRequiredAttributes = attributes } | Additional attributes -> InspectionAmbiguous { outsideAuthoredAttributes = attributes } | Different attributes -> InspectionInsufficient { wrongRequiredAttributes = attributes } | Empty -> InspectionInsufficient { missingRequiredAttributes = [ Maker, Model ] } | other -> InspectionAmbiguous { invalidResolvedDisposition = other } | UnresolvedAlternatives alternatives -> InspectionAmbiguous { unresolvedCandidates = alternatives } | OutsideAuthoredBounds details -> InspectionAmbiguous details | NoCandidate -> InspectionInsufficient NoCatalogueRecord # Typed verification-request endings. Cancellation and interruption deliberately # share VerificationInterrupted, matching the current authored stop mapping. finishCapture result = match result with | SupportedScoped { purpose = CatalogueRecordAttributeAgreement, requiredAttributes = [ Maker, Model ], variantFacets = Undetermined } -> conclude MakerModelLineAgreement claimScope | SupportedScoped otherScope -> stop (UnsupportedVerificationScope otherScope) | Insufficient details -> stop (VerificationInsufficient details) | Rejected details -> stop (VerificationRejected details) | Refused reason -> stop (RequestRefused reason) | Unavailable reason -> stop (TechnicalUnavailable reason) | Interrupted reason -> stop (VerificationInterrupted reason) | Cancelled reason -> stop (VerificationInterrupted reason) | Exhausted reason -> stop (VerificationRequestExhausted reason) | Failed reason -> stop (TechnicalFailure reason) # DEV partial-completion delta only. Replace the normal Partial branch above. # The full issued assessment is retained; acquisition finishes before search. # The mutually exclusive partial path then follows the same search, pure bundle # construction, and one-dispatch sequence shown in Capturer. # # | Partial issuedAssessment -> # acquisition <- media.acquireIdentifyingEvidence # @typeof(issuedAssessment) issuedAssessment with # objective = IdentifyingEvidence, # advisoryRole = DiscriminatingAttributes, # attemptLimit = 1 # match acquisition with # | Completed clues -> CaptureReady issuedAssessment clues # | NeedsMore details -> CaptureStopped (AcquisitionIncomplete details) # | Unable reason -> CaptureStopped (AcquisitionUnable reason) # | Refused reason -> CaptureStopped (AcquisitionRefused reason) # | Exhausted reason -> CaptureStopped (AcquisitionExhausted reason) # | Interrupted reason -> CaptureStopped (AcquisitionInterrupted reason) # | Failed reason -> CaptureStopped (AcquisitionFailed reason) # | Unavailable reason -> CaptureStopped (AcquisitionUnavailable reason)