Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lia performance regression #11242

Closed
samuelgruetter opened this issue Dec 5, 2019 · 3 comments · Fixed by #11263
Closed

lia performance regression #11242

samuelgruetter opened this issue Dec 5, 2019 · 3 comments · Fixed by #11263
Labels
kind: performance Improvements to performance and efficiency.
Milestone

Comments

@samuelgruetter
Copy link
Contributor

Consider this lia goal:

Require Import Lia.
Require Import ZArith.
Open Scope Z_scope.

Goal
  forall Y r0 r q q0 r1 q1 : Z,
  ~
  (131072 <= Y < 139264 \/
   268468224 <= Y < 268500992 \/ 268509184 <= Y < 268513280 \/ 268513280 <= Y < 268517376) ->
  131072 <= r0 < 139264 \/
  268468224 <= r0 < 268500992 \/ 268509184 <= r0 < 268513280 \/ 268513280 <= r0 < 268517376 ->
  r = 0 ->
  0 <= Y < 4294967296 ->
  (4 <> 0 -> r0 = 4 * q + r) ->
  (0 < 4 -> 0 <= r < 4) ->
  (4 < 0 -> 4 < r <= 0) ->
  (4 = 0 -> q = 0) ->
  (4 = 0 -> r = 0) ->
  (4294967296 <> 0 -> Y - r1 = 4294967296 * q0 + r0) ->
  (0 < 4294967296 -> 0 <= r0 < 4294967296) ->
  (4294967296 < 0 -> 4294967296 < r0 <= 0) ->
  (4294967296 = 0 -> q0 = 0) ->
  (4294967296 = 0 -> r0 = 0) ->
  (4294967296 <> 0 -> 2 = 4294967296 * q1 + r1) ->
  (0 < 4294967296 -> 0 <= r1 < 4294967296) ->
  (4294967296 < 0 -> 4294967296 < r1 <= 0) ->
  (4294967296 = 0 -> q1 = 0) -> (4294967296 = 0 -> r1 = 0) -> False.
Proof.
  intros.

  (* workaround by @thery *)
  repeat match goal with
	 | [ H : ?x -> _, H' : ?x -> _ |- _ ] =>
	   pose proof (fun u : x => conj (H u) (H' u)); clear H H' end.

  Timeout 60 Time lia.

Time Qed.

It used to have (close to) good performance in 8.9.0, but times out on Coq master:

Coq 8.9.0:

  • with workaround: lia takes 20.55 secs, Qed takes 43.705 secs
  • without workaround: timeout

Coq master of Nov 4:

  • with workaround: timeout
  • without workaround: timeout

For all tests, I first deleted .lia.cache and then ran coqc on the above file from the command line.

I'd be curious to know what caused this, but before I delve into a git bisect, maybe @fajb would have some intuition about what it could be?

@fajb
Copy link
Contributor

fajb commented Dec 5, 2019

I have no clue :(
With my current experimental version, PR #11047 it is instantaneous with thery's workaround.

fajb added a commit to fajb/coq that referenced this issue Dec 6, 2019
- PR coq#9725 fixes completness bugs introduces some inefficiency.
  The current PR intends to fix the inefficiency
  while retaining completness. The fix removes a pre-processing
  step and instead relies on a more elaborate proof
  format introducing positivity constraints on the fly.

fixes coq#11063, fixes coq#11242

- Better interval analysis for product of variables.
  (fixes coq#11191 , first case)

- Generation of positivity constrains for Z.pow
  (fixes coq#11191 , second case)

- More aggressive pruning of (useless) hypotheses
@maximedenes
Copy link
Member

Seems like it could be related to #11063.

@samuelgruetter
Copy link
Contributor Author

For the record, here's the problem in the context of bedrock2: The build which succeeds in 8.9 and 8.10 but fails on master, and the commit which "fixed" (admitted) it (but also revealed the next problem).

fajb added a commit to fajb/coq that referenced this issue Dec 9, 2019
PR coq#9725 fixes completness bugs introduces some inefficiency. The
current PR intends to fix the inefficiency while retaining
completness. The fix removes a pre-processing step and instead relies
on a more elaborate proof format introducing positivity constraints on
the fly.

Solve bootstrapping issues: RMicromega <-> Rbase <-> lia.

Fixes coq#11063 and fixes coq#11242
fajb added a commit to fajb/coq that referenced this issue Dec 12, 2019
PR coq#9725 fixes completness bugs introduces some inefficiency. The
current PR intends to fix the inefficiency while retaining
completness. The fix removes a pre-processing step and instead relies
on a more elaborate proof format introducing positivity constraints on
the fly.

Solve bootstrapping issues: RMicromega <-> Rbase <-> lia.

Fixes coq#11063 and fixes coq#11242 and fixes coq#11270
fajb added a commit to fajb/coq that referenced this issue Dec 12, 2019
PR coq#9725 fixes completness bugs introduces some inefficiency. The
current PR intends to fix the inefficiency while retaining
completness. The fix removes a pre-processing step and instead relies
on a more elaborate proof format introducing positivity constraints on
the fly.

Solve bootstrapping issues: RMicromega <-> Rbase <-> lia.

Fixes coq#11063 and fixes coq#11242 and fixes coq#11270
ejgallego pushed a commit to fajb/coq that referenced this issue Dec 13, 2019
PR coq#9725 fixes completness bugs introduces some inefficiency. The
current PR intends to fix the inefficiency while retaining
completness. The fix removes a pre-processing step and instead relies
on a more elaborate proof format introducing positivity constraints on
the fly.

Solve bootstrapping issues: RMicromega <-> Rbase <-> lia.

Fixes coq#11063 and fixes coq#11242 and fixes coq#11270
ejgallego pushed a commit to fajb/coq that referenced this issue Dec 14, 2019
PR coq#9725 fixes completness bugs introduces some inefficiency. The
current PR intends to fix the inefficiency while retaining
completness. The fix removes a pre-processing step and instead relies
on a more elaborate proof format introducing positivity constraints on
the fly.

Solve bootstrapping issues: RMicromega <-> Rbase <-> lia.

Fixes coq#11063 and fixes coq#11242 and fixes coq#11270
ejgallego pushed a commit to ejgallego/coq that referenced this issue Dec 14, 2019
PR coq#9725 fixes completness bugs introduces some inefficiency. The
current PR intends to fix the inefficiency while retaining
completness. The fix removes a pre-processing step and instead relies
on a more elaborate proof format introducing positivity constraints on
the fly.

Solve bootstrapping issues: RMicromega <-> Rbase <-> lia.

Fixes coq#11063 and fixes coq#11242 and fixes coq#11270
fajb added a commit to fajb/coq that referenced this issue Dec 16, 2019
PR coq#9725 fixes completness bugs introduces some inefficiency. The
current PR intends to fix the inefficiency while retaining
completness. The fix removes a pre-processing step and instead relies
on a more elaborate proof format introducing positivity constraints on
the fly.

Solve bootstrapping issues: RMicromega <-> Rbase <-> lia.

Fixes coq#11063 and fixes coq#11242 and fixes coq#11270
@coqbot coqbot added this to the 8.11.0 milestone Dec 18, 2019
ppedrot pushed a commit to ppedrot/coq that referenced this issue Dec 18, 2019
PR coq#9725 fixes completness bugs introduces some inefficiency. The
current PR intends to fix the inefficiency while retaining
completness. The fix removes a pre-processing step and instead relies
on a more elaborate proof format introducing positivity constraints on
the fly.

Solve bootstrapping issues: RMicromega <-> Rbase <-> lia.

Fixes coq#11063 and fixes coq#11242 and fixes coq#11270

(cherry picked from commit 7d961a9)
@Zimmi48 Zimmi48 added the kind: performance Improvements to performance and efficiency. label Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: performance Improvements to performance and efficiency.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants