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

ring mysteriously fails or succeeds on convertible goals #101

Open
andrew-appel opened this issue Sep 4, 2024 · 3 comments
Open

ring mysteriously fails or succeeds on convertible goals #101

andrew-appel opened this issue Sep 4, 2024 · 3 comments

Comments

@andrew-appel
Copy link

In this example, we see that the ring tactic fails or succeeds on terms that are equivalence modulo change, and in fact the original term comes up naturally in one of my proofs. Is this a bug or a feature?

From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq choice.
From mathcomp Require Import fintype finfun bigop finset fingroup perm order.
From mathcomp Require Import div prime binomial ssralg countalg finalg zmodp matrix.
From mathcomp Require Import ssrnum reals interval classical_sets topology normedtype.
Require Import mathcomp.algebra_tactics.ring.
Open Scope ring_scope.

Lemma test: forall (F : realType)
 (n : nat)
 (c y : 'cV[F]_n.+1)
 (z : 'cV[F]_1),
@eq (Real.sort F)
  (@GRing.add
     (GRing_SemiRing__to__GRing_Nmodule (reals_Real__to__GRing_SemiRing F))
     (@fun_of_matrix (Real.sort F) 1 1
        (@mulmx (reals_Real__to__GRing_SemiRing F) 1 1 1
           (@mulmx (reals_Real__to__GRing_SemiRing F) 1 
              (S n) 1 (@trmx (Real.sort F) (S n) 1 y) c) z)
        (@GRing.zero (fintype_ordinal__canonical__GRing_Nmodule 0))
        (@GRing.zero (fintype_ordinal__canonical__GRing_Nmodule 0)))
     (@fun_of_matrix (Real.sort F) 1 1
        (@mulmx (reals_Real__to__GRing_SemiRing F) 1
           (GRing.one Datatypes_nat__canonical__GRing_SemiRing) 1
           (@mulmx (reals_Real__to__GRing_SemiRing F) 1 
              (S n) (GRing.one Datatypes_nat__canonical__GRing_SemiRing)
              (@trmx (Real.sort F) (S n) 1 y) c) z)
        (@GRing.zero (fintype_ordinal__canonical__GRing_Nmodule 0))
        (@GRing.zero (fintype_ordinal__canonical__GRing_Nmodule 0))))
  (@GRing.mul (reals_Real__to__GRing_SemiRing F) 2
     (@fun_of_matrix (Real.sort F) 1 1
        (@mulmx (reals_Real__to__GRing_SemiRing F) 1 1 1
           (@mulmx (reals_Real__to__GRing_SemiRing F) 1 
              (S n) 1 (@trmx (Real.sort F) (S n) 1 y) c) z)
        (@GRing.zero (fintype_ordinal__canonical__GRing_Nmodule 0))
        (@GRing.zero (fintype_ordinal__canonical__GRing_Nmodule 0)))).
Proof.
move => F n c y z.
Fail ring.
Succeed change (GRing.one Datatypes_nat__canonical__GRing_SemiRing) with (S O); ring.
Succeed set (a := fun_of_matrix _ 0 0); ring. 

And here is the detailed version information:

coq                          8.19.1         The Coq Proof Assistant
coq-mathcomp-algebra         2.2.0          Mathematical Components Library on Algebra
coq-mathcomp-algebra-tactics 1.2.3          Ring, field, lra, nra, and psatz tactics for Mathematical Components
coq-mathcomp-analysis        1.2.0          An analysis library for mathematical components
coq-mathcomp-bigenough       1.0.1          A small library to do epsilon - N reasoning
coq-mathcomp-classical       1.2.0          A library for classical logic for mathematical components
coq-mathcomp-field           2.2.0          Mathematical Components Library on Fields
coq-mathcomp-fingroup        2.2.0          Mathematical Components Library on finite groups
coq-mathcomp-finmap          2.1.0          Finite sets, finite maps, finitely supported functions
coq-mathcomp-solvable        2.2.0          Mathematical Components Library on finite groups (II)
coq-mathcomp-ssreflect       2.2.0          Small Scale Reflection
coq-mathcomp-zify            1.5.0+2.0+8.16 Micromega tactics for Mathematical Components
@pi8027
Copy link
Member

pi8027 commented Oct 10, 2024

Duplicate of #18

I'm not going to fix it very soon. I suggest using the set tactic as a workaround.

@gares
Copy link
Member

gares commented Oct 10, 2024

This bug is also related to a (Coq) feature we recently discussed with @CohenCyril and @Tragicus, that would eagerly simplify (GRing.one Datatypes_nat__canonical__GRing_SemiRing) to (S O) at goal "creation time". With that in place, ring would work as expected.

@pi8027
Copy link
Member

pi8027 commented Oct 10, 2024

@gares I think GRing.one Datatypes_nat__canonical__GRing_SemiRing should not be simplified to S O automatically. This issue has to be eventually fixed in Algebra Tactics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants