#20593·aptos-core

[prover] StateDomain quantifier value can fall outside its Move type

Author: GotenJBZCreated Sep 22, 2026Updated Sep 22, 2026
Labelsbug

Bug

A quantifier over a StateDomain gets a plain Boogie integer. The backend adds a type check for TypeDomain ranges. It does not add one for StateDomain ranges. So the state value never gets its Move type limits. The solver can then pick a value that no u64 can have, such as -1.

returns_zero is public. It always returns 0. The postcondition says the result has a predecessor kept in a state. No u64 makes that true. The prover accepts it by using -1.

To reproduce

  1. Save the snippet as third_party/move/move-prover/tests/sources/regression/unsoundness_showcase/05_state_domain_invalid_value.move.
  2. Create an empty .exp file next to it with the same base name.
  3. Run cargo test -p move-prover --test testsuite 05_state_domain_invalid_value -- --test-threads=1.

The test passes. That means the prover found nothing.

Code snippet to reproduce

move
module 0x42::state_domain_invalid_value {
    spec fun increments_to(x: &mut u64, value: u64): bool {
        old(x) + 1 == value
    }

    public fun returns_zero(_x: &mut u64): u64 {
        0
    }

    spec returns_zero {
        ensures exists S in *:
            S.. |~ increments_to(_x, result);
    }
}

Expected Behavior

The prover should reject the postcondition:

error: post-condition does not hold
  05_state_domain_invalid_value.move
        ensures exists S in *:
            S.. |~ increments_to(_x, result);

Every value picked for a StateDomain must fit its Move type.

Every call returns 0. Call s the u64 value tied to _x in state S. The call to increments_to needs s + 1 == result. So it needs s + 1 == 0. The only answer is s = -1. A u64 cannot be -1. So no real Move state makes the claim true.

Additional context

translate_quant writes the StateDomain part as a Boogie integer binder. See third_party/move/move-prover/boogie-backend/src/spec_translator.rs:4421-4503.

The range code adds type checks for TypeDomain and skips StateDomain. See third_party/move/move-prover/boogie-backend/src/spec_translator.rs:4577-4589.

So the exists has no $IsValid'u64' check. Boogie can use -1 as the u64 state value.