0

I'm really annoyed by the following goal:

a%:R \is a unit

where a is a nat. The only lemma that seems to help is unitrE, but then it seems impossible to simplify further. This goal should be solvable. Can someone explain how to coerce this to a field type so I can use unitfE which I can easily work with.

dvr
  • 370
  • 1
  • 9

2 Answers2

1

you can only use unitfE if the structure you work with is a field. Otherwise you need to deal with the characteristic ([char R]) of your ring. What is your structure?

Lolo
  • 604
  • 2
  • 7
  • I think `a%:R` has `numDomainType`. However, it should be a rational number, so I confused as to why I can't use unitfE. The rational numbers are a field. – dvr Jan 24 '23 at 00:17
  • so you should have a ```numFieldType``` – Lolo Jan 24 '23 at 00:22
  • I believe that type it is looking for is `(UnitRing.sort unitRingType)`. – dvr Jan 24 '23 at 00:31
  • I can `apply/unitrP` which will give me the definition of `\is a unit`, but then the goal is `exists y0 : t, y0 * D%:R = 1 /\ D%:R * y0 = 1` and using `exists D%:R^-1` will place me in the same trap as before. – dvr Jan 24 '23 at 00:33
  • `int` and `rat` are two `numDomainType`, so what you would like ```a%:R \is a unit``` to be turned into? – Lolo Jan 24 '23 at 00:37
  • Ah I actually figured it out. I was using the ssreflect assert syntax `have -> :` for this goal and it was forcing me to prove this for general ring types I think. Applying the same tactics without `have -> :` allowed me to use `unitfE`. – dvr Jan 24 '23 at 00:39
0

If you assume that a is non-zero (which makes sense, to have an inverse), then you can do this:

From mathcomp Require Import all_ssreflect all_algebra.

Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.

Open Scope ring_scope.
Import GRing.Theory.

Variable (R : numFieldType).

Variable (a : nat).

Definition a' : R := a%:R.

Hypothesis nea'0 : a' != 0.

Lemma a'unit : a' \is a GRing.unit.
Proof. by rewrite unitfE nea'0. Qed.
Pierre Jouvelot
  • 901
  • 3
  • 13