aien-sovereign-core-mv
AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.
Brought by drakestapleton
aien-sovereign-core-mv / crates / crumbs / src / provenance.rs
| 1 | // SPDX-License-Identifier: Apache-2.0 |
| 2 | // Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | |
| 16 | //! Provenance, contamination classes and the clean-room boundary (sealed side). |
| 17 | //! |
| 18 | //! The clean-room lane exists so that a later rediscovery can be checked: a |
| 19 | //! crumb enters it only if nothing about its construction came from human |
| 20 | //! theory, human constants or human physical ontology. The lane has its own |
| 21 | //! ledger partition, and the partition refuses forbidden records outright. |
| 22 | |
| 23 | use serde::{Deserialize, Serialize}; |
| 24 | |
| 25 | /// Where the structure behind a crumb came from. |
| 26 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] |
| 27 | pub enum ContaminationClass { |
| 28 | /// Invented by a generator with no reference to human theory. |
| 29 | SyntheticNovel = 1, |
| 30 | /// Invented to mislead (rabbit holes); still no human theory. |
| 31 | AdversarialSynthetic = 2, |
| 32 | /// Encodes a relationship known from human mathematics or science. |
| 33 | HumanTheoryDerived = 3, |
| 34 | /// Finite instances of structures around open problems. |
| 35 | FrontierDerived = 4, |
| 36 | /// Measurements of the real world. |
| 37 | RealWorldMeasured = 5, |
| 38 | } |
| 39 | |
| 40 | /// Everything the clean-room policy needs to judge a crumb. |
| 41 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] |
| 42 | pub struct Provenance { |
| 43 | pub class: ContaminationClass, |
| 44 | pub uses_human_constants: bool, |
| 45 | pub uses_human_ontology: bool, |
| 46 | } |
| 47 | |
| 48 | impl Provenance { |
| 49 | pub const fn synthetic() -> Self { |
| 50 | Provenance { |
| 51 | class: ContaminationClass::SyntheticNovel, |
| 52 | uses_human_constants: false, |
| 53 | uses_human_ontology: false, |
| 54 | } |
| 55 | } |
| 56 | pub const fn adversarial() -> Self { |
| 57 | Provenance { |
| 58 | class: ContaminationClass::AdversarialSynthetic, |
| 59 | uses_human_constants: false, |
| 60 | uses_human_ontology: false, |
| 61 | } |
| 62 | } |
| 63 | pub const fn human_theory() -> Self { |
| 64 | Provenance { |
| 65 | class: ContaminationClass::HumanTheoryDerived, |
| 66 | uses_human_constants: true, |
| 67 | uses_human_ontology: false, |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | /// Ledger lanes. Each lane is a separate hash chain. |
| 73 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] |
| 74 | pub enum Lane { |
| 75 | Main = 1, |
| 76 | CleanRoom = 2, |
| 77 | } |
| 78 | |
| 79 | /// Why the clean-room lane refused a crumb. |
| 80 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] |
| 81 | pub enum CleanRoomViolation { |
| 82 | HumanTheoryDerived, |
| 83 | FrontierDerived, |
| 84 | RealWorldMeasured, |
| 85 | HumanConstants, |
| 86 | HumanOntology, |
| 87 | } |
| 88 | |
| 89 | /// The clean-room forbidden list. Permitted: synthetic and adversarial |
| 90 | /// synthetic structure with no human constants and no human ontology. |
| 91 | pub fn clean_room_check(p: &Provenance) -> Result<(), CleanRoomViolation> { |
| 92 | match p.class { |
| 93 | ContaminationClass::HumanTheoryDerived => { |
| 94 | return Err(CleanRoomViolation::HumanTheoryDerived) |
| 95 | } |
| 96 | ContaminationClass::FrontierDerived => return Err(CleanRoomViolation::FrontierDerived), |
| 97 | ContaminationClass::RealWorldMeasured => return Err(CleanRoomViolation::RealWorldMeasured), |
| 98 | ContaminationClass::SyntheticNovel | ContaminationClass::AdversarialSynthetic => {} |
| 99 | } |
| 100 | if p.uses_human_constants { |
| 101 | return Err(CleanRoomViolation::HumanConstants); |
| 102 | } |
| 103 | if p.uses_human_ontology { |
| 104 | return Err(CleanRoomViolation::HumanOntology); |
| 105 | } |
| 106 | Ok(()) |
| 107 | } |