Skip to content

Commit a893b63

Browse files
Add properties of RP
1 parent 460c494 commit a893b63

File tree

1 file changed

+77
-13
lines changed

1 file changed

+77
-13
lines changed

coq_error_metrics/absolute_prec.v

Lines changed: 77 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,13 @@ Section AbsPrec.
1616

1717
End AbsPrec.
1818

19-
Section RelPrec.
20-
21-
Context {R : realType}.
22-
23-
Definition RelPrec (a a' α : R) : Prop := α >= 0 -> ln(a - a') <= α.
24-
25-
End RelPrec.
26-
2719
Notation "a ~ a' ; ap( α )" := (AbsPrec a a' α) (at level 99).
28-
Notation "a ~ a' ; rp( α )" := (RelPrec a a' α) (at level 99).
2920

3021
Fact abs_eq : forall {R : realType} (a b : R), a = b -> `|a| = `|b|.
3122
Proof. move => HR a b H1; by rewrite H1. Qed.
3223

3324
(* Properties from Olver Section 2.2 *)
34-
Section ElementaryProperties.
25+
Section APElementaryProperties.
3526

3627
Context {R : realType}.
3728
Variables (a a' α : R).
@@ -75,7 +66,7 @@ Section ElementaryProperties.
7566
rewrite (@le_trans _ _ (normr (a-a') + normr (a'-a''))) => //.
7667
rewrite ler_normD => //. rewrite lerD => //; [rewrite H1|rewrite H2] => //=. Qed.
7768

78-
End ElementaryProperties.
69+
End APElementaryProperties.
7970

8071
Fact normr_inv : forall {R : realType} (x : R), `|1/x| = 1/`|x|.
8172
Proof. move => H x; have Hx : (0 <= x) \/ (x < 0) by nra. destruct Hx;
@@ -87,7 +78,7 @@ Proof. move => H x y H1 H2. rewrite ler_pdivrMr => //; [|nra].
8778
rewrite div1r ler_pdivlMl => //; nra. Qed.
8879

8980
(* Theorems from Section 2.3 *)
90-
Section MultDiv.
81+
Section APMultDiv.
9182

9283
Context {R : realType}.
9384
Variables (a a' b b' α β : R).
@@ -131,7 +122,7 @@ Section MultDiv.
131122
rewrite (@le_trans _ _ `|b' - b|) => //. rewrite lerB_dist => //.
132123
rewrite Prop1 => //. apply /andP; split; rewrite -normr_gt0 (@le_lt_trans _ _ β) => //. Qed.
133124

134-
End MultDiv.
125+
End APMultDiv.
135126

136127
Section MultDiv2.
137128

@@ -152,4 +143,77 @@ Hypothesis Hbeta : 0 <= β.
152143
End MultDiv2.
153144

154145

146+
Section RelPrec.
147+
148+
Context {R : realType}.
149+
150+
Definition RelPrec (a a' α : R) : Prop :=
151+
α >= 0 ->
152+
(a > 0 /\ a' > 0) \/ (a < 0 /\ a' < 0) ->
153+
`|ln(a / a')| <= α.
154+
155+
End RelPrec.
156+
157+
Notation "a ~ a' ; rp( α )" := (RelPrec a a' α) (at level 99).
158+
159+
Section RPElementaryProperties.
160+
161+
Context {R : realType}.
162+
Variables (a a' α : R).
163+
Hypothesis Halpha : 0 <= α.
155164

165+
Theorem RPProp1 : (a ~ a' ; rp(α)) -> (a' ~ a ; rp(α)).
166+
Proof. rewrite /RelPrec.
167+
move => H1 H2 H3.
168+
apply H1 in H2.
169+
suff sym : ((`|ln (R:=R) (a' / a)|) = `|ln (R:=R) (a / a')|).
170+
rewrite sym.
171+
apply: H2.
172+
suff inv_neg : (ln (R:=R) (a' / a) = - 1 * ln (R:=R) (a / a')).
173+
rewrite inv_neg.
174+
suff neg_1_swap : ( - 1 * ln (R:=R) (a / a') = - ln (R:=R) (a / a')).
175+
rewrite neg_1_swap.
176+
apply normrN.
177+
apply mulN1r.
178+
rewrite - (GRing.invf_div a a').
179+
rewrite - ln_powR.
180+
rewrite powRN.
181+
rewrite powRr1.
182+
reflexivity.
183+
destruct H3.
184+
+ destruct H.
185+
apply divr_ge0; lra.
186+
+ destruct H.
187+
suff temp: 0 <= (- a) / (- a') by lra.
188+
suff neg_a: 0 <= - a'.
189+
suff neg_a': 0 <= - a.
190+
apply divr_ge0; lra.
191+
lra.
192+
lra.
193+
+ destruct H3; auto; destruct H; try split; auto.
194+
Qed.
195+
196+
Theorem RPProp2 : forall (δ : R), (a ~ a' ; rp(α)) -> 0 <= α -> α <= δ -> (a ~ a' ; rp(δ)).
197+
Proof. Admitted.
198+
199+
Theorem RPProp3 : forall (k : R), (a ~ a'; rp(α)) -> (a+k ~ a'+k ; rp(α)).
200+
Proof. Admitted.
201+
202+
Fact RPabs_mul_eq : forall (k : R), `|k * a| = `|k| * `|a|.
203+
Proof. Admitted.
204+
205+
Theorem RPProp4 : forall (k : R), (a ~ a' ; rp(α)) -> 0 <= α -> a*k ~ a'*k ; rp(`|k|*α).
206+
Proof. Admitted.
207+
208+
Lemma RPProp4_1 : a ~ a' ; rp(α) -> -a ~ -a' ; rp(α).
209+
Proof. Admitted.
210+
211+
Theorem RPProp5 : forall (b b' β : R),
212+
a ~ a' ; rp(α) -> b ~ b' ; rp(β) -> 0 <= β -> a + b ~ a' + b' ; rp(α + β).
213+
Proof. Admitted.
214+
215+
Theorem RPProp6 : forall (a'' δ : R ),
216+
a ~ a' ; rp(α) -> a' ~ a'' ; rp(δ) -> 0 <= δ -> a ~ a'' ; rp(α + δ).
217+
Proof. Admitted.
218+
219+
End RPElementaryProperties.

0 commit comments

Comments
 (0)