crates.sage_ir.solver.schedule_independence

Scheduling cannot change the canonical return value. For fixed semantic inputs and configured limits, polling order may change discovery, cancellation timing, trace order, elapsed work, and memory use, but not the answer class, output, substitutions, residuals, hints, response numbering, ambiguity/overflow distinction, or overflow kind.

Read in specification context · design/crates/sage_ir/solver.sage

Implementation

Implemented crates/sage-ir/src/check/solve/merge.rs:13–18

sage_ir::check::solve::merge · lib:sage_ir

#![allow(unused)]
fn main() {
// {anchor}`crates.sage_ir.solver.schedule_independence`
// {anchor}`crates.sage_ir.modules.expand.completeness`
// {anchor}`crates.sage_ir.solver.candidate_completeness`
// {anchor}`crates.sage_ir.solver.canonical_outputs`
pub(crate) fn merge_candidate_results<'db>(
    db: &'db dyn crate::Db,

}

See more source ↗

TODO crates/sage-meta/tests/semantic_spec.rs:199–204

sage_meta::todo · test:semantic_spec

TODO: Deterministic resource accounting and scheduler perturbation guarantees remain planned. TODO: Complete the claim-specific verification matrix:

#![allow(unused)]
fn main() {
    // {anchor}`crates.sage_ir.solver.schedule_independence`
    // TODO: Deterministic resource accounting and scheduler perturbation guarantees remain planned.
    #[test]
    #[sage::test(crates.sage_ir.solver.schedule_independence)]
    fn solver_schedule_independence() {
        // TODO: Complete the claim-specific verification matrix:

}

See more source ↗

Tests and review

Indexed tests and the implementation-completeness and test-adequacy review; no test run is implied.

Implemented sage_ir::check::solve::merge::tests::final_answer_rules_are_order_independent

crates/sage-ir/src/check/solve/merge.rs · lib:sage_ir

#![allow(unused)]
fn main() {
#[test]
    #[sage::test(crates.sage_ir.solver.alternative_isolation)]
    #[sage::test(crates.sage_ir.solver.schedule_independence)]
    fn final_answer_rules_are_order_independent() {
        let db = Database::default();
        let no = no_result();
        let maybe = maybe();
        let unconditional = yes(true);
        for candidates in [
            vec![no.clone(), maybe.clone(), unconditional.clone()],
            vec![unconditional.clone(), no.clone(), maybe.clone()],
            vec![maybe.clone(), unconditional.clone(), no.clone()],
        ] {
            let result = merge_candidate_results(
                &db,
                0,
                &FxHashMap::default(),
                &FxHashMap::default(),
                candidates,
                false,
            );
            assert_eq!(result, unconditional);
        }

        let all_maybe = merge_candidate_results(
            &db,
            0,
            &FxHashMap::default(),
            &FxHashMap::default(),
            vec![maybe.clone(), maybe],
            false,
        );
        assert!(matches!(
            all_maybe.root().value,
            QueryResultData::Maybe { .. }
        ));
        let all_no = merge_candidate_results(
            &db,
            0,
            &FxHashMap::default(),
            &FxHashMap::default(),
            vec![no.clone(), no],
            false,
        );
        assert!(matches!(all_no.root().value, QueryResultData::No));
    }
}

Conditional source: #[cfg(test)]

See more source ↗

TODO sage_meta::todo::solver_schedule_independence

crates/sage-meta/tests/semantic_spec.rs · test:semantic_spec

#![allow(unused)]
fn main() {
#[test]
    #[sage::test(crates.sage_ir.solver.schedule_independence)]
    fn solver_schedule_independence() {
        // TODO: Complete the claim-specific verification matrix:
        // Deterministically perturbed ready queues produce byte-identical stashed results across proof,
        // normalization, residual, ambiguity, and every overflow case; only explicitly non-semantic trace
        // order may differ.
    }
}

See more source ↗

Review: Accepted · Codex /root/anchor_094.

Reviewed the entire schedule_independence claim, ordinary merge implementation, explicit implementation TODO and both tests; captured the solver design, resource/scheduling RFD and hint-merging helper. Source inspection only; no behavioral tests rerun and no source changes.

The claim fixes canonical semantic inputs/limits and permits differing discovery/cancellation/trace/work/memory while requiring identical answer class, output, substitutions, residuals, hints, response numbering and overflow distinctions/kinds. merge_candidate_results sorts and deduplicates canonical candidate values before its rules, retains an unconditional empty-substitution Proven result regardless of other alternatives, eliminates dominated Yes responses, distinguishes complete empty absence from incomplete sources and merges remaining possibilities through conservative hints. This provides deterministic processing of an already available answer set; it is not a full guarantee that all scheduler/resource executions produce that same set or canonically numbered outputs.

The ordinary final_answer_rules_are_order_independent test builds actual No, empty-hint Maybe and unconditional Proven responses using in-file constructors. Three permutations of those responses must equal the entire unconditional Stashed result, not merely share its enum variant. Additional duplicate-Maybe and duplicate-No inputs must remain Maybe and No respectively. It is meaningful coverage of the simple final-answer rules and duplicate handling, but contains no type output, nonempty substitution/residual/hint/binder, scheduler perturbation, cancellation or resource exhaustion.

The associated implementation TODO explicitly states deterministic resource accounting and scheduler perturbation guarantees remain planned. The solver_schedule_independence TODO test calls for perturbed ready queues yielding byte-identical results for proof, normalization, residual, ambiguity and every overflow case, allowing only nonsemantic trace order to differ. Completing the resource taxonomy/accounting and that perturbation matrix is prerequisite to the full claim, including all enumerated output fields and response numbering. Both TODOs remain visibly deferred; sorting candidate inputs is not substituted for the missing end-to-end guarantee. All requirements and evidence entries are accounted for, no concrete additional defect was identified in the inspected merge slice and no edits are requested.

Browse crates anchors

139 anchors

Specification anchors and declared coverage
AnchorImplementationTests
crates (139)114 Implemented37 TODO2 N/A74 Implemented107 TODO
crates.sage_inspector (15)13 Implemented1 TODO2 N/A3 Implemented15 TODO
crates.sage_inspector.inspection (15)13 Implemented1 TODO2 N/A3 Implemented15 TODO
balanced_tracesImplementedTODO
canonical_ownershipImplementedImplementedTODO
derive_reflectionImplementedImplementedTODO
detail_free_indexImplementedTODO
deterministic_traceImplementedTODO
durable_navigationN/ATODO
generic_browserN/ATODO
owned_reflectionImplementedImplementedTODO
product_availabilityImplementedTODO
revision_and_demandImplementedTODO
semantic_phase_boundaryImplementedTODO
source_evidenceImplementedTODO
typed_serviceImplementedTODO
unknown_workImplementedTODOTODO
workspace_actorImplementedTODO
crates.sage_ir (90)67 Implemented34 TODO40 Implemented88 TODO
crates.sage_ir.checking (12)12 Implemented3 TODO5 Implemented12 TODO
crates.sage_ir.checking.body (5)5 Implemented2 TODO3 Implemented5 TODO
elaborationImplementedImplementedTODO
expected_typesImplementedTODOTODO
interface_dependenciesImplementedImplementedTODO
isolated_completionImplementedImplementedTODO
operator_callsImplementedTODOTODO
identity_mintingImplementedTODO
owned_productsImplementedImplementedTODO
crates.sage_ir.checking.signature (4)4 Implemented1 TODO1 Implemented4 TODO
body_independenceImplementedTODO
narrow_detailImplementedTODOTODO
owner_binderImplementedImplementedTODO
storageImplementedTODO
symbol_keyed_interfacesImplementedTODO
crates.sage_ir.crate (9)9 TODO9 TODO
explicit_restrictionsTODOTODO
identity_before_detailTODOTODO
incremental_evidenceTODOTODO
narrow_demandsTODOTODO
reexecution_and_invalidationTODOTODO
represented_completenessTODOTODO
restrictions_and_gapsTODOTODO
semantic_query_boundariesTODOTODO
terminal_incompletenessTODOTODO
crates.sage_ir.inference (8)8 Implemented6 Implemented8 TODO
atomic_checkingImplementedImplementedTODO
body_local_quiescenceImplementedImplementedTODO
canonical_boundaryImplementedImplementedTODO
completed_body_boundaryImplementedTODO
numeric_domainsImplementedImplementedTODO
subtyping_and_coercionImplementedImplementedTODO
terminal_obligationsImplementedTODO
transaction_isolationImplementedImplementedTODO
crates.sage_ir.metadata (4)4 Implemented1 TODO4 TODO
explicit_incompletenessImplementedTODO
keyed_reuseImplementedTODOTODO
product_boundariesImplementedTODO
provider_authorityImplementedTODO
crates.sage_ir.modules (8)7 Implemented1 TODO4 Implemented8 TODO
crates.sage_ir.modules.expand (4)4 Implemented2 Implemented4 TODO
completenessImplementedImplementedTODO
dependenciesImplementedTODO
direct_membersImplementedTODO
recursion_and_fixpointImplementedImplementedTODO
crates.sage_ir.modules.parse (4)3 Implemented1 TODO2 Implemented4 TODO
dependenciesImplementedTODO
detail_firewallImplementedImplementedTODO
recovery_completenessTODOTODO
syntax_identitiesImplementedImplementedTODO
crates.sage_ir.resolution (5)5 Implemented1 TODO3 Implemented4 TODO
crates.sage_ir.resolution.lookup (5)5 Implemented1 TODO3 Implemented4 TODO
completenessImplementedTODOImplementedTODO
dependenciesImplementedTODO
expansion_import_ambiguityImplementedImplemented
identity_onlyImplementedTODO
precedenceImplementedImplementedTODO
crates.sage_ir.solver (9)7 Implemented7 TODO5 Implemented9 TODO
alternative_isolationImplementedTODOImplementedTODO
bounded_completenessImplementedTODOTODO
candidate_completenessImplementedTODO
canonical_cyclesTODOTODO
canonical_outputsImplementedImplementedTODO
local_index_firewallTODOTODO
normalization_demandImplementedTODOImplementedTODO
schedule_independenceImplementedTODOImplementedTODO
shared_final_resultImplementedTODOImplementedTODO
crates.sage_ir.symbols (8)8 Implemented4 Implemented7 TODO
associated_identityImplementedImplemented
associated_interfacesImplementedTODO
body_interfacesImplementedImplementedTODO
definition_identityImplementedTODO
external_fact_queriesImplementedTODO
external_identityImplementedTODO
kind_wrappersImplementedImplementedTODO
local_identityImplementedImplementedTODO
crates.sage_ir.types (27)16 Implemented12 TODO13 Implemented27 TODO
crates.sage_ir.types.aliases (2)1 Implemented1 TODO1 Implemented2 TODO
identityImplementedImplementedTODO
revelationTODOTODO
crates.sage_ir.types.binder (1)1 Implemented1 TODO1 Implemented1 TODO
owner_parametersImplementedTODOImplementedTODO
crates.sage_ir.types.body (13)4 Implemented9 TODO3 Implemented13 TODO
awaitTODOTODO
closuresTODOTODO
conditional_patternsTODOTODO
coroutinesTODOTODO
diagnosed_recoveryImplementedImplementedTODO
elaboratedTODOImplementedTODO
for_iterationTODOTODO
indexingTODOTODO
macro_expansionTODOTODO
no_inferenceImplementedImplementedTODO
resolved_referencesImplementedTODO
try_residualTODOTODO
typed_provenanceImplementedTODO
crates.sage_ir.types.calls (2)1 Implemented1 TODO1 Implemented2 TODO
dispatch_familiesTODOTODO
selected_semanticsImplementedImplementedTODO
crates.sage_ir.types.lifetimes (2)2 Implemented2 Implemented2 TODO
dummyImplementedImplementedTODO
unchecked_borrowsImplementedImplementedTODO
crates.sage_ir.types.operators (2)2 Implemented1 Implemented2 TODO
lazy_control_flowImplementedTODO
trait_callsImplementedImplementedTODO
scoped_identitiesImplementedTODO
crates.sage_ir.types.spans (4)4 Implemented4 Implemented4 TODO
generated_identityImplementedImplementedTODO
item_originImplementedImplementedTODO
offset_reuseImplementedImplementedTODO
relative_compositionImplementedImplementedTODO
crates.sage_oracle_harness (4)4 Implemented2 TODO1 Implemented4 TODO
crates.sage_oracle_harness.crate (4)4 Implemented2 TODO1 Implemented4 TODO
deterministic_emissionImplementedTODO
exact_comparisonImplementedTODOImplementedTODO
fixed_projectionImplementedTODO
independent_coverageImplementedTODOTODO
crates.sage_stash (5)5 Implemented5 Implemented
crates.sage_stash.storage (5)5 Implemented5 Implemented
handle_ownershipImplementedImplemented
immutable_entriesImplementedImplemented
query_valueImplementedImplemented
rooted_equalityImplementedImplemented
typed_interningImplementedImplemented
crates.sage_test_harness (25)25 Implemented25 Implemented
crates.sage_test_harness.compile_tests (25)25 Implemented25 Implemented
annotation_validationImplementedImplemented
blessing_gateImplementedImplemented
callsite_updatesImplementedImplemented
checking_scopeImplementedImplemented
compiler_conditionsImplementedImplemented
completed_typesImplementedImplemented
coordinatesImplementedImplemented
dependenciesImplementedImplemented
diagnostic_countsImplementedImplemented
diagnostic_locationsImplementedImplemented
editionImplementedImplemented
fixturesImplementedImplemented
grouped_observationsImplementedImplemented
invocationImplementedImplemented
production_executionImplementedImplemented
project_isolationImplementedImplemented
query_captureImplementedImplemented
query_projectionImplementedImplemented
renderingImplementedImplemented
resolved_symbolsImplementedImplemented
review_visibilityImplementedImplemented
rustc_executionImplementedImplemented
rustc_lintsImplementedImplemented
starting_expressionsImplementedImplemented
target_lineImplementedImplemented