-
Notifications
You must be signed in to change notification settings - Fork 0
/
ValRngUPol.mag
657 lines (560 loc) · 19.4 KB
/
ValRngUPol.mag
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
// This file is part of ExactpAdics
// Copyright (C) 2018 Christopher Doris
//
// ExactpAdics is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ExactpAdics is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with ExactpAdics. If not, see <http://www.gnu.org/licenses/>.
///# Valuations
///## ValRngUPolElt_FldPadExact
/// Represents the valuation of a univariate polynomial over a p-adic field.
import "Promotion.mag": do_binop;
import "ValFldPad.mag": VAL_FLDPADEXACTELT_INFINITY, VAL_FLDPADEXACTELT_NEGINFINITY, VAL_FLDPADEXACTELT_ZERO;
Z := Integers();
// the valuation of a RngUPolElt[FldPad], RngUPolElt_FldPadExact or similar
declare type ValRngUPolElt_FldPadExact: Val_PadExactElt;
declare attributes ValRngUPolElt_FldPadExact
: values // REQ: AssocDflt: [RngIntElt] -> ValFldPadExactElt (valuation at each degree)
;
VAL_RNGUPOLELT_FLDPADEXACT_INFINITY := New(ValRngUPolElt_FldPadExact);
VAL_RNGUPOLELT_FLDPADEXACT_INFINITY`values := DefaultAssociativeArray(VAL_FLDPADEXACTELT_INFINITY);
VAL_RNGUPOLELT_FLDPADEXACT_NEGINFINITY := New(ValRngUPolElt_FldPadExact);
VAL_RNGUPOLELT_FLDPADEXACT_NEGINFINITY`values := DefaultAssociativeArray(VAL_FLDPADEXACTELT_NEGINFINITY);
VAL_RNGUPOLELT_FLDPADEXACT_ZERO := New(ValRngUPolElt_FldPadExact);
VAL_RNGUPOLELT_FLDPADEXACT_ZERO`values := DefaultAssociativeArray(VAL_FLDPADEXACTELT_ZERO);
///### Creation
intrinsic ValRngUPolElt_FldPadExact_IsCoercible(v) -> BoolElt, .
{True if v is coercible to a ValRngUPolElt_FldPadExact.}
ok, v2 := ValFldPadExactElt_IsCoercible(v);
if ok then
r := New(ValRngUPolElt_FldPadExact);
r`values := DefaultAssociativeArray(v2);
return true, r;
end if;
return false, "wrong type";
end intrinsic;
intrinsic ValRngUPolElt_FldPadExact_IsCoercible(v :: ValRngUPolElt_FldPadExact) -> BoolElt, .
{"}
return true, v;
end intrinsic;
intrinsic ValRngUPolElt_FldPadExact_IsCoercible(v :: AssocDflt) -> BoolElt, .
{"}
// check exact correctness first
if Type(DefaultValue(v)) eq ValFldPadExactElt and (#v`array eq 0 or Universe(v`array) cmpeq Z) and forall{k : k in Keys(v`array) | Type(v`array[k]) eq ValFldPadExactElt} then
r := New(ValRngUPolElt_FldPadExact);
r`values := v;
return true, r;
end if;
// check coercibility
ok, d := ValFldPadExactElt_IsCoercible(DefaultValue(v));
if not ok then
return false, Sprintf("default value: %o", d);
end if;
ok, ks := CanChangeUniverse(SetToSequence(Keys(v`array)), Z);
if not ok then
return false, "keys: expecting integers";
end if;
vs := [];
for k in ks do
ok, w := ValFldPadExactElt_IsCoercible(v`array[k]);
if not ok then
return false, Sprintf("value %o: %o", k, w);
end if;
Append(~vs, w);
end for;
r := New(ValRngUPolElt_FldPadExact);
r`values := DefaultAssociativeArray(d, ks, vs);
return true, r;
end intrinsic;
intrinsic IsPromotable(v :: ValRngUPolElt_FldPadExact, w) -> BoolElt, .
{True if v and w are promotable to a common type.}
ok, w2 := ValRngUPolElt_FldPadExact_IsCoercible(w);
if ok then
return true, v, w2;
end if;
return false, _, _;
end intrinsic;
intrinsic ValRngUPolElt_FldPadExact_IsCoercible(dflt, v) -> BoolElt, .
{True if v is coercible to a ValRngUPolElt_FldPadExact with given default.}
ok, d := ValFldPadExactElt_IsCoercible(dflt);
if not ok then
return false, "default not coercible: " cat d;
end if;
return ValRngUPolElt_FldPadExact_IsCoercible(d, v);
end intrinsic;
intrinsic ValRngUPolElt_FldPadExact_IsCoercible(dflt :: ValFldPadExactElt, v) -> BoolElt, .
{"}
reasons := {"wrong type"};
// first try coercing v to a AssocDflt with the given default and then to a Val
ok, x := IsCoercible_DefaultAssociativeArray(dflt, v);
if ok then
ok, w := ValRngUPolElt_FldPadExact_IsCoercible(x);
if ok then
return true, w;
else
Include(~reasons, w);
end if;
else
Include(~reasons, x);
end if;
// now try coercing v=[v0,v1,...] to AssocDflt [i]->vi with given default and then to Val
if ISA(Type(v), SeqEnum) then
ok, x := IsCoercible_DefaultAssociativeArray(dflt, [<i-1, v[i]> : i in [1..#v] | IsDefined(v,i)]);
if ok then
ok, w := ValRngUPolElt_FldPadExact_IsCoercible(x);
if ok then
return true, w;
else
Include(~reasons, w);
end if;
else
Include(~reasons, x);
end if;
end if;
// now try coercing v to a AssocDflt and see if it has the right default
ok, w := ValRngUPolElt_FldPadExact_IsCoercible(v);
if ok and DefaultValue(Value(w)) eq dflt then
return true, w;
elif ok then
Include(~reasons, "wrong default");
end if;
// give up
return false, Join(SetToSequence(reasons), " or ");
end intrinsic;
///hide
intrinsic IsValidAbsolutePrecision(x :: RngUPolElt_FldPadExact, v) -> BoolElt, .
{True if v is coercible to an absolute precision for x. Also returns the coerced value.}
reasons := {};
ok, w := ValRngUPolElt_FldPadExact_IsCoercible(VAL_FLDPADEXACTELT_INFINITY, v);
if ok then
return true, w;
else
Include(~reasons, w);
end if;
ok, w := ValRngUPolElt_FldPadExact_IsCoercible(v);
if ok then
return true, w;
else
Include(~reasons, w);
end if;
return false, Join(SetToSequence(reasons), " or ");
end intrinsic;
///hide
intrinsic IsValidAbsolutePrecisionDiff(x :: RngUPolElt_FldPadExact, v) -> BoolElt, .
{True if v is coercible to an absolute precision diff for x. Also returns the coerced value.}
reasons := {};
ok, w := ValRngUPolElt_FldPadExact_IsCoercible(VAL_FLDPADEXACTELT_NEGINFINITY, v);
if ok then
return true, w;
else
Include(~reasons, w);
end if;
ok, w := ValRngUPolElt_FldPadExact_IsCoercible(v);
if ok then
return true, w;
else
Include(~reasons, w);
end if;
return false, Join(SetToSequence(reasons), " or ");
end intrinsic;
intrinsic ValRngUPolElt_FldPadExact_Make(v) -> ValRngUPolElt_FldPadExact
{A ValRngUPolElt_FldPadExact with value v.}
ok, v := ValRngUPolElt_FldPadExact_IsCoercible(v);
require ok: v;
return v;
end intrinsic;
intrinsic ValRngUPolElt_FldPadExact_Make(x, y) -> ValRngUPolElt_FldPadExact
{Same as ValRngUPolElt_FldPadExact_Make(DefaultAssociativeArray(x,y)).}
return ValRngUPolElt_FldPadExact_Make(DefaultAssociativeArray(x,y));
end intrinsic;
intrinsic ValRngUPolElt_FldPadExact_Make(x, y, z) -> ValRngUPolElt_FldPadExact
{Same as ValRngUPolElt_FldPadExact_Make(DefaultAssociativeArray(x,y,z)).}
return ValRngUPolElt_FldPadExact_Make(DefaultAssociativeArray(x,y,z));
end intrinsic;
///### Special values
intrinsic ValRngUPolElt_FldPadExact_Infinity() -> ValRngUPolElt_FldPadExact
{The valuation Infinity.}
return VAL_RNGUPOLELT_FLDPADEXACT_INFINITY;
end intrinsic;
intrinsic ValRngUPolElt_FldPadExact_NegInfinity() -> ValRngUPolElt_FldPadExact
{The valuation -Infinity.}
return VAL_RNGUPOLELT_FLDPADEXACT_NEGINFINITY;
end intrinsic;
intrinsic ValRngUPolElt_FldPadExact_Zero() -> ValRngUPolElt_FldPadExact
{The valuation 0.}
return VAL_RNGUPOLELT_FLDPADEXACT_ZERO;
end intrinsic;
///hide
intrinsic Print(v :: ValRngUPolElt_FldPadExact, lvl :: MonStgElt)
{Print.}
case lvl:
when "Magma":
printf "ValRngUPolElt_FldPadExact_Make(%m)", Value(v);
else
printf "%O", DefaultValue(Value(v)), lvl;
x := SpecialAssociativeArray(Value(v));
if #x gt 0 then
printf " except (%o)", Join([Sprintf("%O->%O", k, lvl, x[k], lvl) : k in Keys(x)], ", ");
end if;
end case;
end intrinsic;
///### Other operations
intrinsic Value(v :: ValRngUPolElt_FldPadExact) -> AssocDflt
{The underlying associative array of values.}
return v`values;
end intrinsic;
intrinsic Ceiling(v :: ValRngUPolElt_FldPadExact) -> ValRngUPolElt_FldPadExact
{The integer valuation larger than v, or just v if infinite.}
return ValRngUPolElt_FldPadExact_Make(ApplyPointwise(Ceiling, Value(v)));
end intrinsic;
///hide
intrinsic '-'(v :: ValRngUPolElt_FldPadExact) -> ValRngUPolElt_FldPadExact
{Negation.}
return ValRngUPolElt_FldPadExact_Make(ApplyPointwise('-', Value(v)));
end intrinsic;
///hide
intrinsic '&+'(vs :: [ValRngUPolElt_FldPadExact]) -> ValRngUPolElt_FldPadExact
{Sum.}
return ValRngUPolElt_FldPadExact_Make(ZipApplyPointwise('&+', [Value(v) : v in vs]));
end intrinsic;
///hide
intrinsic '+'(v :: ValRngUPolElt_FldPadExact, w :: ValRngUPolElt_FldPadExact) -> ValRngUPolElt_FldPadExact
{Add.}
return &+[v,w];
end intrinsic;
///hide
intrinsic '+'(v :: ValRngUPolElt_FldPadExact, w) -> .
{"}
return do_binop('+', v, w);
end intrinsic;
///hide
intrinsic '+'(v, w :: ValRngUPolElt_FldPadExact) -> .
{"}
return do_binop('+', v, w);
end intrinsic;
///hide
intrinsic '+'(v :: ValRngUPolElt_FldPadExact, w :: Infty) -> .
{"}
return do_binop('+', v, w);
end intrinsic;
///hide
intrinsic '+'(v :: Infty, w :: ValRngUPolElt_FldPadExact) -> .
{"}
return do_binop('+', v, w);
end intrinsic;
///hide
intrinsic '-'(v :: ValRngUPolElt_FldPadExact, w :: ValRngUPolElt_FldPadExact) -> ValRngUPolElt_FldPadExact
{Subtract.}
return ValRngUPolElt_FldPadExact_Make(ApplyPointwise('-', Value(v), Value(w)));
end intrinsic;
///hide
intrinsic '-'(v :: ValRngUPolElt_FldPadExact, w) -> .
{"}
return do_binop('-', v, w);
end intrinsic;
///hide
intrinsic '-'(v, w :: ValRngUPolElt_FldPadExact) -> .
{"}
return do_binop('-', v, w);
end intrinsic;
///hide
intrinsic '-'(v :: ValRngUPolElt_FldPadExact, w :: Infty) -> .
{"}
return do_binop('-', v, w);
end intrinsic;
///hide
intrinsic '-'(v :: Infty, w :: ValRngUPolElt_FldPadExact) -> .
{"}
return do_binop('-', v, w);
end intrinsic;
///hide
intrinsic '*'(v :: ValRngUPolElt_FldPadExact, w :: RngIntElt) -> ValRngUPolElt_FldPadExact
{Multiply.}
return ValRngUPolElt_FldPadExact_Make(ApplyPointwise(func<u | u*w>, Value(v)));
end intrinsic;
///hide
intrinsic '*'(v :: ValRngUPolElt_FldPadExact, w :: FldRatElt) -> ValRngUPolElt_FldPadExact
{"}
return ValRngUPolElt_FldPadExact_Make(ApplyPointwise(func<u | u*w>, Value(v)));
end intrinsic;
///hide
intrinsic '*'(v :: RngIntElt, w :: ValRngUPolElt_FldPadExact) -> ValRngUPolElt_FldPadExact
{"}
return ValRngUPolElt_FldPadExact_Make(ApplyPointwise(func<u | v*u>, Value(w)));
end intrinsic;
///hide
intrinsic '*'(v :: FldRatElt, w :: ValRngUPolElt_FldPadExact) -> ValRngUPolElt_FldPadExact
{"}
return ValRngUPolElt_FldPadExact_Make(ApplyPointwise(func<u | v*u>, Value(w)));
end intrinsic;
///hide
intrinsic '/'(v :: ValRngUPolElt_FldPadExact, w :: RngIntElt) -> ValRngUPolElt_FldPadExact
{Divide.}
return ValRngUPolElt_FldPadExact_Make(ApplyPointwise(func<u | u/w>, Value(v)));
end intrinsic;
///hide
intrinsic '/'(v :: ValRngUPolElt_FldPadExact, w :: FldRatElt) -> ValRngUPolElt_FldPadExact
{"}
return ValRngUPolElt_FldPadExact_Make(ApplyPointwise(func<u | u/w>, Value(v)));
end intrinsic;
///hide
intrinsic 'join'(v :: ValRngUPolElt_FldPadExact, w :: ValRngUPolElt_FldPadExact) -> ValRngUPolElt_FldPadExact
{The smallest u with u ge v and u ge w. That is, pointwise join.}
return ValRngUPolElt_FldPadExact_Make(ApplyPointwise('join', Value(v), Value(w)));
end intrinsic;
///hide
intrinsic 'join'(v :: ValRngUPolElt_FldPadExact, w) -> .
{"}
return do_binop('join', v, w);
end intrinsic;
///hide
intrinsic 'join'(v, w :: ValRngUPolElt_FldPadExact) -> .
{"}
return do_binop('join', v, w);
end intrinsic;
///hide
intrinsic 'join'(v :: ValRngUPolElt_FldPadExact, w :: Infty) -> .
{"}
return do_binop('join', v, w);
end intrinsic;
///hide
intrinsic 'join'(v :: Infty, w :: ValRngUPolElt_FldPadExact) -> .
{"}
return do_binop('join', v, w);
end intrinsic;
///hide
intrinsic 'meet'(v :: ValRngUPolElt_FldPadExact, w :: ValRngUPolElt_FldPadExact) -> ValRngUPolElt_FldPadExact
{The largest u with u le v and u le w. That is, pointwise meet.}
return ValRngUPolElt_FldPadExact_Make(ApplyPointwise('meet', Value(v), Value(w)));
end intrinsic;
///hide
intrinsic 'meet'(v :: ValRngUPolElt_FldPadExact, w) -> .
{"}
return do_binop('meet', v, w);
end intrinsic;
///hide
intrinsic 'meet'(v, w :: ValRngUPolElt_FldPadExact) -> .
{"}
return do_binop('meet', v, w);
end intrinsic;
///hide
intrinsic 'meet'(v :: ValRngUPolElt_FldPadExact, w :: Infty) -> .
{"}
return do_binop('meet', v, w);
end intrinsic;
///hide
intrinsic 'meet'(v :: Infty, w :: ValRngUPolElt_FldPadExact) -> .
{"}
return do_binop('meet', v, w);
end intrinsic;
///hide
intrinsic 'diff'(v :: ValRngUPolElt_FldPadExact, w :: ValRngUPolElt_FldPadExact) -> ValRngUPolElt_FldPadExact
{v wherever v is larger than w, and -OO elsewhere. That is, pointwise diff.}
return ValRngUPolElt_FldPadExact_Make(ApplyPointwise('diff', Value(v), Value(w)));
end intrinsic;
///hide
intrinsic 'diff'(v :: ValRngUPolElt_FldPadExact, w) -> .
{"}
return do_binop('diff', v, w);
end intrinsic;
///hide
intrinsic 'diff'(v, w :: ValRngUPolElt_FldPadExact) -> .
{"}
return do_binop('diff', v, w);
end intrinsic;
///hide
intrinsic 'diff'(v :: ValRngUPolElt_FldPadExact, w :: Infty) -> .
{"}
return do_binop('diff', v, w);
end intrinsic;
///hide
intrinsic 'diff'(v :: Infty, w :: ValRngUPolElt_FldPadExact) -> .
{"}
return do_binop('diff', v, w);
end intrinsic;
///hide
intrinsic 'eq'(v :: ValRngUPolElt_FldPadExact, w :: ValRngUPolElt_FldPadExact) -> BoolElt
{Equality.}
return ForAll(Value(v), Value(w), 'eq');
end intrinsic;
///hide
intrinsic 'eq'(v :: ValRngUPolElt_FldPadExact, w) -> .
{"}
return do_binop('eq', v, w);
end intrinsic;
///hide
intrinsic 'eq'(v, w :: ValRngUPolElt_FldPadExact) -> .
{"}
return do_binop('eq', v, w);
end intrinsic;
///hide
intrinsic 'eq'(v :: ValRngUPolElt_FldPadExact, w :: Infty) -> .
{"}
return do_binop('eq', v, w);
end intrinsic;
///hide
intrinsic 'eq'(v :: Infty, w :: ValRngUPolElt_FldPadExact) -> .
{"}
return do_binop('eq', v, w);
end intrinsic;
///hide
intrinsic 'ne'(v :: ValRngUPolElt_FldPadExact, w :: ValRngUPolElt_FldPadExact) -> BoolElt
{Inequality.}
return not (v eq w);
end intrinsic;
///hide
intrinsic 'ne'(v :: ValRngUPolElt_FldPadExact, w) -> .
{"}
return do_binop('ne', v, w);
end intrinsic;
///hide
intrinsic 'ne'(v, w :: ValRngUPolElt_FldPadExact) -> .
{"}
return do_binop('ne', v, w);
end intrinsic;
///hide
intrinsic 'ne'(v :: ValRngUPolElt_FldPadExact, w :: Infty) -> .
{"}
return do_binop('ne', v, w);
end intrinsic;
///hide
intrinsic 'ne'(v :: Infty, w :: ValRngUPolElt_FldPadExact) -> .
{"}
return do_binop('ne', v, w);
end intrinsic;
///hide
intrinsic 'le'(v :: ValRngUPolElt_FldPadExact, w :: ValRngUPolElt_FldPadExact) -> BoolElt
{Test if v is less than or equal to w everywhere. That is, pointwise 'le'.}
return ForAll(Value(v), Value(w), 'le');
end intrinsic;
///hide
intrinsic 'le'(v :: ValRngUPolElt_FldPadExact, w) -> .
{"}
return do_binop('le', v, w);
end intrinsic;
///hide
intrinsic 'le'(v, w :: ValRngUPolElt_FldPadExact) -> .
{"}
return do_binop('le', v, w);
end intrinsic;
///hide
intrinsic 'le'(v :: ValRngUPolElt_FldPadExact, w :: Infty) -> .
{"}
return do_binop('le', v, w);
end intrinsic;
///hide
intrinsic 'le'(v :: Infty, w :: ValRngUPolElt_FldPadExact) -> .
{"}
return do_binop('le', v, w);
end intrinsic;
///hide
intrinsic 'lt'(v :: ValRngUPolElt_FldPadExact, w :: ValRngUPolElt_FldPadExact) -> BoolElt
{Test if v is less than w everywhere. That is, pointwise 'lt'.}
return (v le w) and (v ne w);
end intrinsic;
///hide
intrinsic 'lt'(v :: ValRngUPolElt_FldPadExact, w) -> .
{"}
return do_binop('lt', v, w);
end intrinsic;
///hide
intrinsic 'lt'(v, w :: ValRngUPolElt_FldPadExact) -> .
{"}
return do_binop('lt', v, w);
end intrinsic;
///hide
intrinsic 'lt'(v :: ValRngUPolElt_FldPadExact, w :: Infty) -> .
{"}
return do_binop('lt', v, w);
end intrinsic;
///hide
intrinsic 'lt'(v :: Infty, w :: ValRngUPolElt_FldPadExact) -> .
{"}
return do_binop('lt', v, w);
end intrinsic;
///hide
intrinsic 'ge'(v :: ValRngUPolElt_FldPadExact, w :: ValRngUPolElt_FldPadExact) -> BoolElt
{Test if v is greater than or equal to w everywhere. That is, pointwise 'ge'.}
return ForAll(Value(v), Value(w), 'ge');
end intrinsic;
///hide
intrinsic 'ge'(v :: ValRngUPolElt_FldPadExact, w) -> .
{"}
return do_binop('ge', v, w);
end intrinsic;
///hide
intrinsic 'ge'(v, w :: ValRngUPolElt_FldPadExact) -> .
{"}
return do_binop('ge', v, w);
end intrinsic;
///hide
intrinsic 'ge'(v :: ValRngUPolElt_FldPadExact, w :: Infty) -> .
{"}
return do_binop('ge', v, w);
end intrinsic;
///hide
intrinsic 'ge'(v :: Infty, w :: ValRngUPolElt_FldPadExact) -> .
{"}
return do_binop('ge', v, w);
end intrinsic;
///hide
intrinsic 'gt'(v :: ValRngUPolElt_FldPadExact, w :: ValRngUPolElt_FldPadExact) -> BoolElt
{Test if v is greater than w everywhere. That is, pointwise 'gt'.}
return (v ge w) and (v ne w);
end intrinsic;
///hide
intrinsic 'gt'(v :: ValRngUPolElt_FldPadExact, w) -> .
{"}
return do_binop('gt', v, w);
end intrinsic;
///hide
intrinsic 'gt'(v, w :: ValRngUPolElt_FldPadExact) -> .
{"}
return do_binop('gt', v, w);
end intrinsic;
///hide
intrinsic 'gt'(v :: ValRngUPolElt_FldPadExact, w :: Infty) -> .
{"}
return do_binop('gt', v, w);
end intrinsic;
///hide
intrinsic 'gt'(v :: Infty, w :: ValRngUPolElt_FldPadExact) -> .
{"}
return do_binop('gt', v, w);
end intrinsic;
intrinsic '&join'(v :: ValRngUPolElt_FldPadExact) -> ValFldPadExactElt
{The join of the valuations at each coefficient. Equivalent to "&join Image(Value(v))".}
return &join Image(Value(v));
end intrinsic;
intrinsic '&meet'(v :: ValRngUPolElt_FldPadExact) -> ValFldPadExactElt
{The meet of the valuations at each coefficient. Equivalent to "&meet Image(Value(v))".}
return &meet Image(Value(v));
end intrinsic;
intrinsic '@'(i :: RngIntElt, v :: ValRngUPolElt_FldPadExact) -> ValFldPadExactElt
{The valuation of coefficient i.}
return Value(v)(i);
end intrinsic;
intrinsic ShiftSlope(v :: ValRngUPolElt_FldPadExact, s) -> ValRngUPolElt_FldPadExact
{Adds i*s onto v(i).}
s := ValFldPadExactElt_Make(s);
a := v`values;
require Type(a`dflt`value) eq Infty: "The constant part of argument 1 must be infinite";
ks := SetToSequence(Keys(a`array));
return ValRngUPolElt_FldPadExact_Make(a`dflt, ks, [a`array[k] + k*s : k in ks]);
end intrinsic;
intrinsic ExactpAdics_Val(f :: RngUPolElt[FldPad]) -> ValRngUPolElt_FldPadExact
{The valuation of f.}
return ValRngUPolElt_FldPadExact_Make(VAL_FLDPADEXACTELT_INFINITY, [0..Degree(f)], [ExactpAdics_Val(c) : c in Coefficients(f)]);
end intrinsic;
intrinsic ExactpAdics_APr(f :: RngUPolElt[FldPad]) -> ValRngUPolElt_FldPadExact
{The absolute precision of f.}
return ValRngUPolElt_FldPadExact_Make(VAL_FLDPADEXACTELT_INFINITY, [0..Degree(f)], [ExactpAdics_APr(c) : c in Coefficients(f)]);
end intrinsic;