diff options
| author | Enrico | 2018-04-16 16:25:09 +0200 |
|---|---|---|
| committer | GitHub | 2018-04-16 16:25:09 +0200 |
| commit | fd5f56c9861e6d1f4619f1306b0badc2a5c3f53c (patch) | |
| tree | 321e261cffeedb7a7c18dd1a1b6f038dacbfc202 /mathcomp | |
| parent | c1ec9cd8e7e50f73159613c492aad4c6c40bc3aa (diff) | |
[separable] put clear switch near view
Dear devs, in an attempt to simplify the code of intro patterns we came up with a proposal that:
- simplifies the code of the plugin
- breaks only one line in the entire mathcomp, the one fixed by this patch.
The code we want to simplify is the one deferring clear switches inside an intro pattern.
The implementation is tricky because just delaying the clear switch until the end of the pattern is not enough, for example:
```
move=> {x} /andP[x y].
```
In this case `x` is both cleared and used. In order to be able to use `x`, given that the clear has not been performed yet, we rename `x` into `_x_` (when `{x}` is executed) so that when `x` is later executed we can use the name `x`, and then `.` is executed clear `_x_` instead of `x`.
So systematically "always rename now & clear later" seem to be OK, but it is not. The extra complication is that "rename" may break later intro pattern using terms as views. Eg
```
move=> {x} /andP[Ha Hb] /x.
```
What the code does today is:
- when `{x}` is execute look-ahead in the patter and see if `x` is used as a name to be introduced
- if so, "rename"
- otherwise don't rename (just delay)
This way of doing things is not only complicated but also incomplete, Eg
```
move=> {x} /orP[x | /x].
```
would misbehave, since the look-ahead is not "semantic".
Anyway, the proposed behavior is:
- `{x}` always renames now and clears (the renamed) later
- `{clears}/views` is always "compiled" as `/views{clears}` (most of the occurrences in the library are ok with this simpler rule, but for the one fixed in this PR).
- bonus: support `{}/view` (as in `rewrite {}rule`) to signal that the immediately following `view` has to be cleared, that is `{}/v` compiled as `/v{v}`.
What do you think?
```
```
Diffstat (limited to 'mathcomp')
| -rw-r--r-- | mathcomp/field/separable.v | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mathcomp/field/separable.v b/mathcomp/field/separable.v index c5a1118..8185314 100644 --- a/mathcomp/field/separable.v +++ b/mathcomp/field/separable.v @@ -772,7 +772,7 @@ have sep_pKy: separable_poly (minPoly K y). have{sep_pKy} sep_q: separable_poly q by rewrite Dq separable_map in sep_pKy. have [r nz_r PETr] := large_field_PET nz_p px0 qy0 sep_q. have [[s [Us Ks /ltnW leNs]] | //] := finite_PET (size r). -have{s Us Ks leNs} /allPn[t /Ks Kt nz_rt]: ~~ all (root r) s. +have{s Us leNs} /allPn[t {Ks}/Ks Kt nz_rt]: ~~ all (root r) s. by apply: contraTN leNs; rewrite -ltnNge => /max_poly_roots->. have{PETr} [/= [p1 Dx] [q1 Dy]] := PETr (Subvs Kt) nz_rt. set z := t * y - x in Dx Dy; exists z; apply/eqP. |
