sim-lib-interference-runtime 0.1.0

Tensor-backed Citizen records and Shape contracts for coherent interference studies.
Documentation
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
//! Truth-carrying sampling, work, solver, and complete-study records.

use sim_kernel::{Cx, Result, Symbol, Value};
use sim_lib_interference_core::{
    SamplingCertificate, SamplingPolicy, SamplingVerdict, WorkEstimate,
};
use sim_lib_interference_solve::{HostPhasorField, SolveEvidence};
use sim_lib_numbers_tensor::domains;

use crate::{
    PhasorFieldDescriptor, PlaneDescriptor, ProblemDescriptor,
    citizen::{RecordCitizenSpec, decode_record, encode_field, encode_record, invalid, next_field},
    records::{sample_plane, sample_problem},
};

/// Citizen descriptor for complete physical sampling evidence.
#[derive(Clone, Debug, PartialEq)]
pub struct SamplingCertificateDescriptor {
    /// Comfortable carrier samples per wavelength.
    pub resolved_min_samples_per_wavelength: f64,
    /// Marginal carrier samples per wavelength.
    pub marginal_min_samples_per_wavelength: f64,
    /// Comfortable maximum fractional envelope change per cell.
    pub resolved_max_envelope_fraction_per_cell: f64,
    /// Marginal maximum fractional envelope change per cell.
    pub marginal_max_envelope_fraction_per_cell: f64,
    /// Carrier wavelength in metres.
    pub wavelength_m: f64,
    /// Carrier samples per wavelength on the `u` axis.
    pub samples_per_wavelength_u: f64,
    /// Carrier samples per wavelength on the `v` axis.
    pub samples_per_wavelength_v: f64,
    /// Squared-magnitude fringe samples on `u`.
    pub samples_per_power_fringe_u: f64,
    /// Squared-magnitude fringe samples on `v`.
    pub samples_per_power_fringe_v: f64,
    /// Nearest point-source distance, absent for plane-only problems.
    pub nearest_point_source_distance_m: Option<f64>,
    /// Conservative fractional `1/r` envelope change per cell.
    pub max_envelope_fraction_per_cell: f64,
    /// `interference/resolved`, `marginal`, or `aliased`.
    pub verdict: Symbol,
}

impl SamplingCertificateDescriptor {
    /// Projects a domain sampling certificate without dropping thresholds.
    pub fn from_certificate(certificate: SamplingCertificate) -> Self {
        Self {
            resolved_min_samples_per_wavelength: certificate
                .thresholds
                .resolved_min_samples_per_wavelength,
            marginal_min_samples_per_wavelength: certificate
                .thresholds
                .marginal_min_samples_per_wavelength,
            resolved_max_envelope_fraction_per_cell: certificate
                .thresholds
                .resolved_max_envelope_fraction_per_cell,
            marginal_max_envelope_fraction_per_cell: certificate
                .thresholds
                .marginal_max_envelope_fraction_per_cell,
            wavelength_m: certificate.wavelength_m,
            samples_per_wavelength_u: certificate.samples_per_wavelength_u,
            samples_per_wavelength_v: certificate.samples_per_wavelength_v,
            samples_per_power_fringe_u: certificate.samples_per_power_fringe_u,
            samples_per_power_fringe_v: certificate.samples_per_power_fringe_v,
            nearest_point_source_distance_m: certificate.nearest_point_source_distance_m,
            max_envelope_fraction_per_cell: certificate.max_envelope_fraction_per_cell,
            verdict: verdict_symbol(certificate.verdict),
        }
    }
}

/// Citizen descriptor for checked allocation and evaluation counts.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct WorkEstimateDescriptor {
    /// Sampling cells.
    pub cells: u64,
    /// Coherent emitters.
    pub emitters: u64,
    /// Cell/emitter evaluations.
    pub emitter_evaluations: u64,
    /// Peak host bytes.
    pub host_bytes: u64,
    /// Result bytes.
    pub result_bytes: u64,
    /// Seven-point certificate stencil work.
    pub certificate_stencil_work: u64,
}

impl WorkEstimateDescriptor {
    /// Projects a checked domain estimate.
    pub fn from_estimate(estimate: WorkEstimate) -> Self {
        Self {
            cells: estimate.cells,
            emitters: estimate.emitters,
            emitter_evaluations: estimate.emitter_evaluations,
            host_bytes: estimate.host_bytes,
            result_bytes: estimate.result_bytes,
            certificate_stencil_work: estimate.certificate_stencil_work,
        }
    }

    /// Recomputes and checks every derived work dimension.
    pub fn to_estimate(self) -> Result<WorkEstimate> {
        let expected = WorkEstimate::new(self.cells, self.emitters)
            .map_err(|error| invalid("WorkEstimate", format!("{error:?}")))?;
        let actual = Self::from_estimate(expected);
        if actual != self {
            return Err(invalid(
                "WorkEstimate",
                "derived counts or byte sizes are inconsistent",
            ));
        }
        Ok(expected)
    }
}

impl RecordCitizenSpec for WorkEstimateDescriptor {
    const FIELDS: &'static [&'static str] = &[
        "cells",
        "emitters",
        "emitter-evaluations",
        "host-bytes",
        "result-bytes",
        "certificate-stencil-work",
    ];

    fn encode_fields(&self, _cx: &mut Cx) -> Result<Vec<sim_kernel::Expr>> {
        Ok(vec![
            encode_field(&self.cells),
            encode_field(&self.emitters),
            encode_field(&self.emitter_evaluations),
            encode_field(&self.host_bytes),
            encode_field(&self.result_bytes),
            encode_field(&self.certificate_stencil_work),
        ])
    }

    fn decode_fields(cx: &mut Cx, fields: Vec<Value>) -> Result<Self> {
        let mut fields = fields.into_iter();
        let value = Self {
            cells: next_field(cx, &mut fields, "cells")?,
            emitters: next_field(cx, &mut fields, "emitters")?,
            emitter_evaluations: next_field(cx, &mut fields, "emitter-evaluations")?,
            host_bytes: next_field(cx, &mut fields, "host-bytes")?,
            result_bytes: next_field(cx, &mut fields, "result-bytes")?,
            certificate_stencil_work: next_field(cx, &mut fields, "certificate-stencil-work")?,
        };
        value.validate()?;
        Ok(value)
    }

    fn example() -> Self {
        Self::from_estimate(WorkEstimate::new(4, 1).expect("example work"))
    }

    fn validate(&self) -> Result<()> {
        self.to_estimate().map(|_| ())
    }
}

impl_record_citizen!(WorkEstimateDescriptor, "interference/WorkEstimate", 6);

/// Citizen descriptor for one solver's immutable completion evidence.
#[derive(Clone, Debug, PartialEq)]
pub struct StudyEvidenceDescriptor {
    /// `interference/strict` or `interference/annotate`.
    pub sampling_policy: Symbol,
    /// Unchanged sampling truth.
    pub sampling: SamplingCertificateDescriptor,
    /// Preflight work estimate.
    pub work: WorkEstimateDescriptor,
    /// Provider identity.
    pub provider: Symbol,
    /// Component dtype.
    pub dtype: Symbol,
    /// Absolute Cartesian-component tolerance.
    pub component_absolute_tolerance: f64,
    /// Absolute squared-magnitude tolerance.
    pub squared_magnitude_absolute_tolerance: f64,
    /// Completed output cells.
    pub completed_cells: u64,
    /// Completed source evaluations.
    pub completed_emitter_evaluations: u64,
    /// Host-to-provider uploads.
    pub uploads: u64,
    /// Accepted provider submissions.
    pub submissions: u64,
    /// Intermediate host readbacks.
    pub intermediate_materializations: u64,
    /// Final component readbacks.
    pub final_materializations: u64,
    /// Ordered execution segments.
    pub segments: u64,
    /// Adapter/provider implementation identity.
    pub adapter: String,
    /// Optional measured hardware/profile identity.
    pub profile: Option<String>,
}

impl StudyEvidenceDescriptor {
    /// Projects evidence from the deterministic host reference solver.
    pub fn from_reference(evidence: &SolveEvidence) -> Self {
        let preflight = evidence.preflight();
        Self {
            sampling_policy: sampling_policy_symbol(preflight.sampling_policy),
            sampling: SamplingCertificateDescriptor::from_certificate(
                preflight.sampling_certificate,
            ),
            work: WorkEstimateDescriptor::from_estimate(preflight.work_estimate),
            provider: reference_provider_symbol(),
            dtype: domains::f64(),
            component_absolute_tolerance: 0.0,
            squared_magnitude_absolute_tolerance: 0.0,
            completed_cells: evidence.completed_cells(),
            completed_emitter_evaluations: evidence.completed_emitter_evaluations(),
            uploads: 0,
            submissions: 0,
            intermediate_materializations: 0,
            final_materializations: 0,
            segments: 1,
            adapter: "reference-f64".to_owned(),
            profile: None,
        }
    }

    /// Returns the checked sampling policy.
    pub fn sampling_policy(&self) -> Result<SamplingPolicy> {
        if self.sampling_policy == strict_policy_symbol() {
            Ok(SamplingPolicy::Strict)
        } else if self.sampling_policy == annotate_policy_symbol() {
            Ok(SamplingPolicy::Annotate)
        } else {
            Err(invalid(
                "StudyEvidence",
                format!("unknown sampling policy {}", self.sampling_policy),
            ))
        }
    }
}

impl RecordCitizenSpec for StudyEvidenceDescriptor {
    const FIELDS: &'static [&'static str] = &[
        "sampling-policy",
        "sampling",
        "work",
        "provider",
        "dtype",
        "component-absolute-tolerance",
        "squared-magnitude-absolute-tolerance",
        "completed-cells",
        "completed-emitter-evaluations",
        "uploads",
        "submissions",
        "intermediate-materializations",
        "final-materializations",
        "segments",
        "adapter",
        "profile",
    ];

    fn encode_fields(&self, cx: &mut Cx) -> Result<Vec<sim_kernel::Expr>> {
        Ok(vec![
            encode_field(&self.sampling_policy),
            encode_record(cx, &self.sampling)?,
            encode_record(cx, &self.work)?,
            encode_field(&self.provider),
            encode_field(&self.dtype),
            encode_field(&self.component_absolute_tolerance),
            encode_field(&self.squared_magnitude_absolute_tolerance),
            encode_field(&self.completed_cells),
            encode_field(&self.completed_emitter_evaluations),
            encode_field(&self.uploads),
            encode_field(&self.submissions),
            encode_field(&self.intermediate_materializations),
            encode_field(&self.final_materializations),
            encode_field(&self.segments),
            encode_field(&self.adapter),
            encode_field(&self.profile),
        ])
    }

    fn decode_fields(cx: &mut Cx, fields: Vec<Value>) -> Result<Self> {
        let mut fields = fields.into_iter();
        let sampling_policy = next_field(cx, &mut fields, "sampling-policy")?;
        let sampling = decode_record(
            cx,
            fields
                .next()
                .ok_or_else(|| invalid("StudyEvidence", "missing sampling evidence"))?,
            "sampling",
        )?;
        let work = decode_record(
            cx,
            fields
                .next()
                .ok_or_else(|| invalid("StudyEvidence", "missing work estimate"))?,
            "work",
        )?;
        let value = Self {
            sampling_policy,
            sampling,
            work,
            provider: next_field(cx, &mut fields, "provider")?,
            dtype: next_field(cx, &mut fields, "dtype")?,
            component_absolute_tolerance: next_field(
                cx,
                &mut fields,
                "component-absolute-tolerance",
            )?,
            squared_magnitude_absolute_tolerance: next_field(
                cx,
                &mut fields,
                "squared-magnitude-absolute-tolerance",
            )?,
            completed_cells: next_field(cx, &mut fields, "completed-cells")?,
            completed_emitter_evaluations: next_field(
                cx,
                &mut fields,
                "completed-emitter-evaluations",
            )?,
            uploads: next_field(cx, &mut fields, "uploads")?,
            submissions: next_field(cx, &mut fields, "submissions")?,
            intermediate_materializations: next_field(
                cx,
                &mut fields,
                "intermediate-materializations",
            )?,
            final_materializations: next_field(cx, &mut fields, "final-materializations")?,
            segments: next_field(cx, &mut fields, "segments")?,
            adapter: next_field(cx, &mut fields, "adapter")?,
            profile: next_field(cx, &mut fields, "profile")?,
        };
        value.validate()?;
        Ok(value)
    }

    fn example() -> Self {
        sample_study_evidence()
    }

    fn validate(&self) -> Result<()> {
        let policy = self.sampling_policy()?;
        let sampling = self.sampling.to_certificate()?;
        self.work.to_estimate()?;
        if policy == SamplingPolicy::Strict && sampling.verdict != SamplingVerdict::Resolved {
            return Err(invalid(
                "StudyEvidence",
                "strict policy cannot carry non-resolved sampling",
            ));
        }
        if self.provider.to_string().trim().is_empty() {
            return Err(invalid("StudyEvidence", "provider cannot be empty"));
        }
        if self.dtype != domains::f32() && self.dtype != domains::f64() {
            return Err(invalid(
                "StudyEvidence",
                "dtype must be numbers/f32 or numbers/f64",
            ));
        }
        for (name, value) in [
            (
                "component absolute tolerance",
                self.component_absolute_tolerance,
            ),
            (
                "squared-magnitude absolute tolerance",
                self.squared_magnitude_absolute_tolerance,
            ),
        ] {
            if !value.is_finite() || value < 0.0 {
                return Err(invalid(
                    "StudyEvidence",
                    format!("{name} must be finite and non-negative"),
                ));
            }
        }
        if self.completed_cells != self.work.cells
            || self.completed_emitter_evaluations != self.work.emitter_evaluations
        {
            return Err(invalid(
                "StudyEvidence",
                "completion counts must equal the admitted work",
            ));
        }
        if self.intermediate_materializations != 0 {
            return Err(invalid(
                "StudyEvidence",
                "intermediate materialization is forbidden",
            ));
        }
        if self.final_materializations > 2 {
            return Err(invalid(
                "StudyEvidence",
                "a two-component field permits at most two final materializations",
            ));
        }
        if self.segments == 0 {
            return Err(invalid(
                "StudyEvidence",
                "completed evidence must name at least one segment",
            ));
        }
        if self.adapter.trim().is_empty()
            || self
                .profile
                .as_ref()
                .is_some_and(|profile| profile.trim().is_empty())
        {
            return Err(invalid(
                "StudyEvidence",
                "adapter and present profile identities cannot be empty",
            ));
        }
        if self.provider == reference_provider_symbol()
            && (self.dtype != domains::f64()
                || self.component_absolute_tolerance != 0.0
                || self.squared_magnitude_absolute_tolerance != 0.0
                || self.uploads != 0
                || self.submissions != 0
                || self.final_materializations != 0
                || self.profile.is_some())
        {
            return Err(invalid(
                "StudyEvidence",
                "reference provider evidence must remain exact host f64",
            ));
        }
        Ok(())
    }
}

impl_record_citizen!(StudyEvidenceDescriptor, "interference/StudyEvidence", 16);

/// Complete Tensor-backed interference study with inseparable truth.
#[derive(Clone, Debug, PartialEq)]
pub struct StudyDescriptor {
    /// Exact coherent problem.
    pub problem: ProblemDescriptor,
    /// Exact physical sampling plane.
    pub plane: PlaneDescriptor,
    /// Two-component Tensor field.
    pub field: PhasorFieldDescriptor,
    /// Sampling, work, provider, tolerance, and execution evidence.
    pub evidence: StudyEvidenceDescriptor,
}

impl StudyDescriptor {
    /// Builds and validates a complete study from canonical runtime records.
    ///
    /// Alternate study solvers use this constructor so they cannot bypass the
    /// same problem, plane, field, sampling, work, and dtype invariants as the
    /// reference provider.
    pub fn new(
        problem: ProblemDescriptor,
        plane: PlaneDescriptor,
        field: PhasorFieldDescriptor,
        evidence: StudyEvidenceDescriptor,
    ) -> Result<Self> {
        let value = Self {
            problem,
            plane,
            field,
            evidence,
        };
        value.validate()?;
        Ok(value)
    }

    /// Projects one completed reference solve into runtime records.
    pub fn from_reference(
        problem: &sim_lib_interference_core::InterferenceProblem,
        plane: sim_lib_interference_core::SamplingPlane,
        field: HostPhasorField,
        evidence: &SolveEvidence,
    ) -> Result<Self> {
        Self::new(
            ProblemDescriptor::from_problem(problem),
            PlaneDescriptor::from_plane(plane),
            PhasorFieldDescriptor::from_host(field)?,
            StudyEvidenceDescriptor::from_reference(evidence),
        )
    }
}

impl RecordCitizenSpec for StudyDescriptor {
    const FIELDS: &'static [&'static str] = &["problem", "plane", "field", "evidence"];

    fn encode_fields(&self, cx: &mut Cx) -> Result<Vec<sim_kernel::Expr>> {
        Ok(vec![
            encode_record(cx, &self.problem)?,
            encode_record(cx, &self.plane)?,
            encode_record(cx, &self.field)?,
            encode_record(cx, &self.evidence)?,
        ])
    }

    fn decode_fields(cx: &mut Cx, fields: Vec<Value>) -> Result<Self> {
        let mut fields = fields.into_iter();
        let value = Self {
            problem: decode_next_record(cx, &mut fields, "problem")?,
            plane: decode_next_record(cx, &mut fields, "plane")?,
            field: decode_next_record(cx, &mut fields, "field")?,
            evidence: decode_next_record(cx, &mut fields, "evidence")?,
        };
        value.validate()?;
        Ok(value)
    }

    fn example() -> Self {
        let value = Self {
            problem: sample_problem(),
            plane: sample_plane(),
            field: <PhasorFieldDescriptor as RecordCitizenSpec>::example(),
            evidence: sample_study_evidence(),
        };
        value.validate().expect("example study");
        value
    }

    fn validate(&self) -> Result<()> {
        let problem = self.problem.to_problem()?;
        let plane = self.plane.to_plane()?;
        self.field.validate()?;
        self.evidence.validate()?;
        if self.field.rows != self.plane.rows || self.field.cols != self.plane.columns {
            return Err(invalid(
                "Study",
                "field dimensions must equal the physical plane dimensions",
            ));
        }
        if self.field.real.dtype() != &self.evidence.dtype {
            return Err(invalid(
                "Study",
                "field dtype must equal the evidence dtype",
            ));
        }
        let expected_work = WorkEstimate::for_request(&problem, &plane)
            .map_err(|error| invalid("Study", format!("{error:?}")))?;
        if self.evidence.work != WorkEstimateDescriptor::from_estimate(expected_work) {
            return Err(invalid(
                "Study",
                "work evidence does not match the problem and plane",
            ));
        }
        let thresholds = self.evidence.sampling.to_certificate()?.thresholds;
        let expected_sampling =
            SamplingCertificate::measure_with_thresholds(&problem, &plane, thresholds)
                .map_err(|error| invalid("Study", format!("{error:?}")))?;
        if self.evidence.sampling
            != SamplingCertificateDescriptor::from_certificate(expected_sampling)
        {
            return Err(invalid(
                "Study",
                "sampling evidence does not match the problem and plane",
            ));
        }
        Ok(())
    }
}

impl_record_citizen!(StudyDescriptor, "interference/Study", 4);

fn decode_next_record<T>(
    cx: &mut Cx,
    fields: &mut impl Iterator<Item = Value>,
    name: &'static str,
) -> Result<T>
where
    T: sim_citizen::CitizenRuntime,
{
    decode_record(
        cx,
        fields
            .next()
            .ok_or_else(|| invalid("Study", format!("missing {name}")))?,
        name,
    )
}

pub(crate) fn sample_sampling() -> SamplingCertificateDescriptor {
    let problem = sample_problem().to_problem().expect("example problem");
    let plane = sample_plane().to_plane().expect("example plane");
    SamplingCertificateDescriptor::from_certificate(
        SamplingCertificate::measure(&problem, &plane).expect("example sampling"),
    )
}

fn sample_study_evidence() -> StudyEvidenceDescriptor {
    let problem = sample_problem().to_problem().expect("example problem");
    let plane = sample_plane().to_plane().expect("example plane");
    let work = WorkEstimate::for_request(&problem, &plane).expect("example work");
    let sampling =
        SamplingCertificate::measure(&problem, &plane).expect("example sampling certificate");
    let value = StudyEvidenceDescriptor {
        sampling_policy: annotate_policy_symbol(),
        sampling: SamplingCertificateDescriptor::from_certificate(sampling),
        work: WorkEstimateDescriptor::from_estimate(work),
        provider: reference_provider_symbol(),
        dtype: domains::f64(),
        component_absolute_tolerance: 0.0,
        squared_magnitude_absolute_tolerance: 0.0,
        completed_cells: work.cells,
        completed_emitter_evaluations: work.emitter_evaluations,
        uploads: 0,
        submissions: 0,
        intermediate_materializations: 0,
        final_materializations: 0,
        segments: 1,
        adapter: "reference-f64".to_owned(),
        profile: None,
    };
    value.validate().expect("example study evidence");
    value
}

pub(crate) fn verdict_symbol(verdict: SamplingVerdict) -> Symbol {
    Symbol::qualified(
        "interference",
        match verdict {
            SamplingVerdict::Resolved => "resolved",
            SamplingVerdict::Marginal => "marginal",
            SamplingVerdict::Aliased => "aliased",
        },
    )
}

fn sampling_policy_symbol(policy: SamplingPolicy) -> Symbol {
    match policy {
        SamplingPolicy::Strict => strict_policy_symbol(),
        SamplingPolicy::Annotate => annotate_policy_symbol(),
    }
}

fn strict_policy_symbol() -> Symbol {
    Symbol::qualified("interference", "strict")
}

fn annotate_policy_symbol() -> Symbol {
    Symbol::qualified("interference", "annotate")
}

fn reference_provider_symbol() -> Symbol {
    Symbol::qualified("interference", "reference-f64")
}