Skip to content

lia does not terminate in the presence of a section variable #22093

@fpottier

Description

@fpottier

Description of the problem

A statement that can be normally proved by lia causes divergence if the hypothesis unsigned n is turned into a section variable. Note that the definition of unsigned involves the very large constant wB (which is 2^63).

Note: this is not an artificial example... I have run into this problem in a real proof.

Thanks!

Small Rocq / Coq file to reproduce the bug

From Stdlib Require Import ZArith Lia.
From Stdlib Require Import Uint63 ZifyUint63.

Open Scope Z_scope.

Notation unsigned z :=
  (0 <= z < wB).

(* This proof works: *)

Goal forall n : Z, unsigned n -> 0 < n -> unsigned (n-1).
Proof. lia. Qed.

(* Now let's try the same thing again, using a section: *)

Section S.

Variable n : Z.
Variable bound_n : unsigned n.

Goal True.
Proof.
  lia. (* does not terminate! *)
Qed.

End S.

Version of Rocq / Coq where this bug occurs

No response

Interface of Rocq / Coq where this bug occurs

No response

Last version of Rocq / Coq where the bug did not occur

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind: bugAn error, flaw, fault or unintended behaviour.needs: triageThe validity of this issue needs to be checked, or the issue itself updated.
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions