2

Basically, I want to observe the result of pseudo polynomial division on some instances (say 3 x^2+2 x +1 and 2 x +1). Pseudo division between polynomials is implemented in edivp in polydiv.v in Ssreflect 1.4. I would expect the code should be something like the following:

Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice fintype.
Require Import ssralg poly ssrnum zmodp polydiv interval.

Open Scope Z_scope.

Definition p := Poly [::1;2;3].

Definition q := Poly [:1;2:].

Eval compute in edivp p q.

However, the code stuck at definition p due to a failure in type unification. Any help is greatly appreciated.

Anton Trunov
  • 15,074
  • 2
  • 23
  • 43
Wenda Li
  • 33
  • 2
  • I don't have any ssr installation at hand to test your code, but know that computation of ssr term might be impossible due to internal restrictions of Canonical Structures, where they explicitly forbid computation to happen, in order to speed up instance resolution. – Vinz Dec 18 '14 at 09:23
  • After a simple remote by a friend, it seems you lack some typing information/coercion, more precisely Coq doesn't seem to be able to get the right canonical structure instance for EqType of Z – Vinz Dec 18 '14 at 16:10
  • Many thanks for your attention, @Vinz. I was wondering similar reasons as well, but I am really not sure the correct syntax to place a correct type constraint/instantiation. I am also not sure if Z_scope is appropriate here, as Ssreflect has its own integer type in ssrint.v. – Wenda Li Dec 18 '14 at 17:13
  • Indeed, I didn't check that. You should rely on their implementation of Z (Open Scope int_scope) – Vinz Dec 19 '14 at 08:34

1 Answers1

1

I finally had the time to install ssreflect to test your issue. As we discussed in the comments, you should rely on the ssreflect's integer, to get the correct canonical structure instances loaded. Here is my code, using ssr1.4 and coq8.4pl5:

Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice fintype.
Require Import ssralg poly ssrnum zmodp polydiv ssrint.

Open Scope int_scope.

Definition p := Poly [:: 1%:Z;2%:Z;3%:Z].

Definition q := Poly [:: 1%:Z;2%:Z].

Now the Eval compute is correctly typed, but its computation doesn't seem to terminate. I think this is due to the internal choices of ssr that forbid computations. You should ask more about this directly on ssreflect's mailing list.

Hope this helps, V.

Vinz
  • 5,997
  • 1
  • 31
  • 52