Skip to Content.
Sympa Menu

coq-club - [Coq-Club] Tactic for solving goals with exponents?

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] Tactic for solving goals with exponents?


Chronological Thread 
  • From: Jason Gross <jasongross9 AT gmail.com>
  • To: coq-club <coq-club AT inria.fr>
  • Subject: [Coq-Club] Tactic for solving goals with exponents?
  • Date: Fri, 22 Jul 2016 18:27:33 +0000
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=jasongross9 AT gmail.com; spf=Pass smtp.mailfrom=jasongross9 AT gmail.com; spf=None smtp.helo=postmaster AT mail-oi0-f50.google.com
  • Ironport-phdr: 9a23:glR9hBP99kDyVdayzjMl6mtUPXoX/o7sNwtQ0KIMzox0KPj4rarrMEGX3/hxlliBBdydsKMczbeJ+Pm5BiQp2tWoiDg6aptCVhsI2409vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6kO74TNaIBjjLw09fr2zQd+KyZnonLnrpNX6WEZhvHKFe7R8LRG7/036l/I9ps9cEJs30QbDuXBSeu5blitCLFOXmAvgtI/rpMYwu3cYh/V0/MlZFK7+Yq5wGbdfFXEtN30/zMztrxjKCwWVsCgySGITxzhBGA/DpD7gWYzq+n/4v/F63iaAOtbtHJg7XD2j6+FgTxq+23RPDCIw7GyC0p84t6lcuh/0/xE=

Is there a tactic that can solve goals like this, in Q or R or Z?  (I haven't managed to get csdp working for psatz, and none of nsatz, lia, nia, nra, lra, fourier, field, ring, omega seem to work):

Require Import Coq.omega.Omega Coq.micromega.Psatz Coq.nsatz.Nsatz Coq.ZArith.ZArith Coq.QArith.QArith Coq.Reals.Reals Coq.setoid_ring.Field_tac Coq.setoid_ring.Ring_tac Coq.fourier.Fourier.
Coercion inject_Z : Z >-> Q.
Ltac begin := unfold inject_Z; simpl; intros.
Ltac arith := solve [ nsatz | omega | lia | nia | nra | lra | fourier | field | ring ].
Goal True.
  Fail assert (forall k, (2 < k -> 2^k * 2^(k-2) = 4^(k-1))%Q%Z) by (begin; arith).
  Fail assert (forall k, (2 < k -> 2^k * 2^(k-2) = 4^(k-1))%Z) by (begin; arith).
  Fail assert (forall k, (2 < k -> 2^k * 2^(k-2) = 4^(k-1))%R) by (begin; arith).
  (** This is provable with just lemmas in the standard library... *)
  assert (forall k, (2 < k -> 2^k * 2^(k-2) = 4^(k-1))%Z).
  { intros.
    assert (H0 : (4 = 2^2)%Z) by lia.
    assert (H1 : (2^k * 2^(k-2) = 2^(k + (k - 2)))%Z) by (rewrite Z.pow_add_r; lia).
    assert (H2 : (k + (k - 2) = 2 * k - 2)%Z) by lia.
    assert (H3 : ((2^2)^(k-1) = 2^(2*(k-1)))%Z) by (rewrite Z.pow_mul_r; lia).
    assert (H4 : (2*(k-1) = 2 * k - 2)%Z) by lia.
    congruence. }

Thanks,
Jason


  • [Coq-Club] Tactic for solving goals with exponents?, Jason Gross, 07/22/2016

Archive powered by MHonArc 2.6.18.

Top of Page