-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathRX_div.v
65 lines (55 loc) · 2.1 KB
/
RX_div.v
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
(*
Copyright © 2009 Valentin Blot
Permission is hereby granted, free of charge, to any person obtaining a copy of
this proof and associated documentation files (the "Proof"), to deal in
the Proof without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Proof, and to permit persons to whom the Proof is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Proof.
THE PROOF IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE PROOF OR THE USE OR OTHER DEALINGS IN THE PROOF.
*)
Require Import CPoly_Degree CPoly_Euclid RingClass CRingClass.
Import CRing_Homomorphisms.coercions.
Section RX_div.
Variable R : CRing.
Let RX := cpoly_cring R.
Add Ring r_r : (r_rt (Ring:=CRing_is_Ring R)).
Add Ring rx_r : (r_rt (Ring:=CRing_is_Ring (cpoly_cring R))).
Lemma _X_monic : forall a : R, monic 1 (_X_ [-] _C_ a).
Proof.
split.
reflexivity.
intro m; destruct m.
intro H; inversion H.
destruct m.
intro H; destruct (Nat.lt_irrefl _ H).
reflexivity.
Qed.
Definition RX_div (p : RX) (a : R) : RX.
Proof.
destruct (cpoly_div p (_X_monic a)) as [qr Hunq Heq]; exact (fst qr).
Defined.
Lemma RX_div_spec : forall (p : RX) (a : R), p [=] (RX_div p a) [*] (_X_ [-] _C_ a) [+] _C_ (p ! a).
Proof.
intros p a.
unfold RX_div.
destruct (cpoly_div p (_X_monic a)) as [[q r] s [s0 d]].
unfold fst, snd in *.
rewrite -> s0.
apply cs_bin_op_wd; [reflexivity|].
destruct d.
destruct (_X_monic a).
destruct (degree_le_zero _ _ (d _ H0)).
rewrite -> s2.
apply csf_wd.
rewrite -> plus_apply, mult_apply, minus_apply.
rewrite -> x_apply, c_apply, c_apply; unfold cg_minus; ring.
Qed.
End RX_div.