1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//! # nescioDB
//!
//! *nescio* (lat.): "I do not know". A working implementation of
//! **Aporia** — a database whose primary object is ignorance, not values.
//!
//! A slot without evidence is not `NULL`; it is a region of maximal
//! entropy. Evidence narrows regions, time widens them again (erosion as
//! storage physics), couplings let knowledge flow between slots. A
//! classical relational database is the limit case in which every
//! evidence is axiomatic and every region is a point.
//!
//! ## The verbs
//!
//! - **BOUND** — [`engine::Query::bound`]: credible region + entropy in
//! bits + MAP estimate. How ignorant is the DB, really?
//! - **SAMPLE** — [`engine::Query::sample`]: one consistent world,
//! deterministic under a seed, couplings respected.
//! - **RESOLVE** — [`engine::Query::resolve`]: which minimal-cost evidence
//! would push a slot's entropy under a target? The DB plans its own
//! data procurement, across slot boundaries, Monte-Carlo-validated.
//! - **FIND** — [`engine::Query::find`]: region queries across entities
//! ("all objects whose price certainly lies below 600k").
//! - **certainly** — [`engine::Query::certainly`]: three-valued predicates
//! as region containment: `true` / `possible` / `false`.
//!
//! ## Quick start
//!
//! ```
//! use nescio::prelude::*;
//! use std::collections::BTreeMap;
//!
//! let mut slots = BTreeMap::new();
//! slots.insert("price".into(), Domain::Continuous { lo: 0.0, hi: 1e6, n_bins: 200 });
//! let schema = Schema { slots, couplings: vec![] };
//! let broker = Source { name: "broker".into(), reliability: 0.85,
//! half_life_days: Some(90.0), axiomatic: false };
//! let mut db = Db::in_memory(schema, vec![broker]).unwrap();
//!
//! db.ingest(EvidenceRecord {
//! entity: "house_1".into(),
//! claim: Claim::Interval { slot: "price".into(), lo: 400_000.0, hi: 500_000.0 },
//! source: "broker".into(),
//! observed_at: 0,
//! }).unwrap();
//!
//! let q = Query::new(&db, 86_400); // one day later
//! let b = q.bound("house_1", "price", 0.95).unwrap();
//! assert!(b.entropy_bits < b.max_entropy_bits);
//! ```