#20590·aptos-core

[prover] spec let shadows a quantifier binder and turns a true exists into false

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

Bug

A spec let sets i to 0. A quantifier in the same spec also uses i as a binder name. Inside the range of the next binder, the prover reads the let value, not the binder. That makes the range empty. So an exists that is true comes out false.

returns_false always returns false. The postcondition says the result is equal to an exists that is true. So the postcondition is false. The prover accepts it anyway.

To reproduce

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

The test passes. That means the prover found nothing.

Code snippet to reproduce

move
module 0x42::DependentQuantifierShadowing {
    public fun returns_false(): bool {
        false
    }

    spec returns_false {
        let i = 0u64;
        ensures result == (
            exists i in 1u64..2u64, j in 0u64..i: true
        );
    }
}

Expected Behavior

The prover should reject the postcondition:

error: post-condition does not hold
  02_dependent_quantifier_shadowing.move
        ensures result == (
            exists i in 1u64..2u64, j in 0u64..i: true
        );

Move binds quantifier variables from left to right. The first range holds only i = 1. With that i in scope, the second range is 0..1. It holds j = 0. The body is true. So the exists is true. The function returns false. The prover accepted false == true.

Additional context

The rewriter walks all quantifier ranges first. It puts the binders in scope after that. See third_party/move/move-model/src/exp_rewriter.rs:425-435,914-929. So the let swap turns 0u64..i into 0u64..0u64. That range is empty.

The model builder uses the right left to right scope. See third_party/move/move-model/src/builder/exp_builder.rs:6400-6463. The two passes do not agree.

The Boogie backend also computes all ranges before it writes the binders. See third_party/move/move-prover/boogie-backend/src/spec_translator.rs:4296-4324.