Generate proof-bearing dynamic world histories
This commit is contained in:
+43
-44
@@ -5,78 +5,77 @@ from typing import Any
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Condition:
|
||||
"""A predicate over immutable inputs or mutable simulator state."""
|
||||
|
||||
source: str
|
||||
key: str
|
||||
operator: str
|
||||
value: Any
|
||||
class Entity:
|
||||
id: str
|
||||
type: str
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class HiddenRule:
|
||||
"""One executable rule in the hidden system language."""
|
||||
|
||||
class TransitionRule:
|
||||
id: str
|
||||
on_event: str
|
||||
conditions: tuple[Condition, ...]
|
||||
trigger: str
|
||||
preconditions: tuple[str, ...]
|
||||
probability: float
|
||||
action: str
|
||||
target: str
|
||||
effects: tuple[str, ...]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class HiddenSystem:
|
||||
"""The latent program. This object must never be sent to the renderer."""
|
||||
|
||||
initial_record: str
|
||||
conflict_policy: str
|
||||
rules: tuple[HiddenRule, ...]
|
||||
class HiddenProgram:
|
||||
types: tuple[str, ...]
|
||||
relations: tuple[str, ...]
|
||||
operators: tuple[str, ...]
|
||||
quantifiers: tuple[str, ...]
|
||||
structures: tuple[str, ...]
|
||||
inference_rules: tuple[str, ...]
|
||||
transition_rules: tuple[TransitionRule, ...]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class BehaviorCase:
|
||||
"""Observable inputs and aggregate output from repeated independent trials."""
|
||||
|
||||
class WorldEvent:
|
||||
id: str
|
||||
attributes: dict[str, Any]
|
||||
events: tuple[str, ...]
|
||||
trials: int
|
||||
observed_present: int | None
|
||||
observed_absent: int | None
|
||||
time: int
|
||||
kind: str
|
||||
participants: tuple[str, ...]
|
||||
arguments: dict[str, Any]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class BehaviorSkeleton:
|
||||
"""A hidden program plus its public behavioral evidence and answer-bearing query."""
|
||||
class Query:
|
||||
predicate: str
|
||||
arguments: tuple[str, ...]
|
||||
time: int
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class WorldSkeleton:
|
||||
id: str
|
||||
family: str
|
||||
complexity: int
|
||||
event_vocabulary: tuple[str, ...]
|
||||
attribute_vocabulary: dict[str, str]
|
||||
observation_protocol: tuple[str, ...]
|
||||
hidden_system: HiddenSystem
|
||||
support_cases: tuple[BehaviorCase, ...]
|
||||
query_case: BehaviorCase
|
||||
entity_count: int
|
||||
simulation_steps: int
|
||||
hidden_program: HiddenProgram
|
||||
entities: tuple[Entity, ...]
|
||||
initial_state: dict[str, Any]
|
||||
events: tuple[WorldEvent, ...]
|
||||
final_state: dict[str, Any]
|
||||
query: Query
|
||||
answer_options: tuple[str, ...]
|
||||
gold_answer: str
|
||||
gold_present_probability: float
|
||||
latent_trace: tuple[str, ...]
|
||||
proof_event_ids: tuple[str, ...]
|
||||
proof_facts: tuple[str, ...]
|
||||
generator_checks: dict[str, Any]
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
return asdict(self)
|
||||
|
||||
def renderer_payload(self) -> dict[str, Any]:
|
||||
"""Expose behavior only: no program, probability, trace, or answer."""
|
||||
"""Expose realized history, never the source program, proof, or answer."""
|
||||
return {
|
||||
"family": self.family,
|
||||
"complexity": self.complexity,
|
||||
"event_vocabulary": self.event_vocabulary,
|
||||
"attribute_vocabulary": self.attribute_vocabulary,
|
||||
"observation_protocol": self.observation_protocol,
|
||||
"support_cases": [asdict(case) for case in self.support_cases],
|
||||
"query_case": asdict(self.query_case),
|
||||
"entity_types": {entity.id: entity.type for entity in self.entities},
|
||||
"initial_observations": self.initial_state["public_observations"],
|
||||
"events": [asdict(event) for event in self.events],
|
||||
"query": asdict(self.query),
|
||||
"answer_options": self.answer_options,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user