Commit 8f094df0 authored by Heiko Becker's avatar Heiko Becker

Start working on coq 8.7.2 port

parent 1aa71784
...@@ -48,63 +48,51 @@ Qed. ...@@ -48,63 +48,51 @@ Qed.
Lemma Q2R_max (a:Q) (b:Q) : Lemma Q2R_max (a:Q) (b:Q) :
Rmax (Q2R a) (Q2R b) = Q2R (Qmax a b). Rmax (Q2R a) (Q2R b) = Q2R (Qmax a b).
Proof. Proof.
apply Q.max_case_strong. destruct (Qlt_le_dec a b).
- intros c d eq_c_d Rmax_x. - pose proof (Qlt_Rlt _ _ q) as Rlt_H.
rewrite Rmax_x. rewrite Rmax_right; try lra.
unfold Q2R. f_equal. unfold Qmax. unfold GenericMinMax.gmax.
rewrite <- RMicromega.Rinv_elim. rewrite Qlt_alt in *.
setoid_rewrite Rmult_comm at 1. rewrite q; auto.
+ rewrite <- Rmult_assoc. - pose proof (Qle_Rle _ _ q) as Rle_H.
rewrite <- RMicromega.Rinv_elim. hnf in Rle_H.
rewrite <- mult_IZR. destruct Rle_H.
rewrite eq_c_d. + rewrite Rmax_left; try lra.
rewrite mult_IZR. apply Rlt_Qlt in H.
rewrite Rmult_comm; auto. f_equal; unfold Qmax. unfold GenericMinMax.gmax.
hnf; intros. rewrite Qgt_alt in *.
pose proof (pos_INR_nat_of_P (Qden d)). rewrite H; auto.
simpl in H. + rewrite Rmax_left; try lra.
rewrite H in H0. f_equal.
lra. unfold Qmax, GenericMinMax.gmax.
+ simpl; hnf; intros. apply eqR_Qeq in H.
pose proof (pos_INR_nat_of_P (Qden c)). symmetry in H.
rewrite H in H0; lra. rewrite Qeq_alt in H. rewrite H; auto.
- intros less. apply Qle_Rle in less.
assert (Rmax (Q2R a) (Q2R b) = Q2R a) by (apply Rmax_left; auto).
rewrite H; auto.
- intros less. apply Qle_Rle in less.
assert (Rmax (Q2R a) (Q2R b) = Q2R b) by (apply Rmax_right; auto).
rewrite H; auto.
Qed. Qed.
Lemma Q2R_min (a:Q) (b:Q) : Lemma Q2R_min (a:Q) (b:Q) :
Rmin (Q2R a) (Q2R b) = Q2R (Qmin a b). Rmin (Q2R a) (Q2R b) = Q2R (Qmin a b).
Proof. Proof.
apply Q.min_case_strong. destruct (Qlt_le_dec a b).
- intros c d eq_c_d Rmin_x. - pose proof (Qlt_Rlt _ _ q) as Rlt_H.
rewrite Rmin_x. rewrite Rmin_left; try lra.
unfold Q2R. f_equal. unfold Qmin. unfold GenericMinMax.gmin.
rewrite <- RMicromega.Rinv_elim. rewrite Qlt_alt in *.
setoid_rewrite Rmult_comm at 1. rewrite q; auto.
+ rewrite <- Rmult_assoc. - pose proof (Qle_Rle _ _ q) as Rle_H.
rewrite <- RMicromega.Rinv_elim. hnf in Rle_H.
rewrite <- mult_IZR. destruct Rle_H.
rewrite eq_c_d. + rewrite Rmin_right; try lra.
rewrite mult_IZR. apply Rlt_Qlt in H.
rewrite Rmult_comm; auto. f_equal; unfold Qmin. unfold GenericMinMax.gmin.
hnf; intros. rewrite Qgt_alt in *.
pose proof (pos_INR_nat_of_P (Qden d)). rewrite H; auto.
simpl in H. + rewrite Rmin_left; try lra.
rewrite H in H0. f_equal.
lra. unfold Qmin, GenericMinMax.gmin.
+ simpl; hnf; intros. apply eqR_Qeq in H.
pose proof (pos_INR_nat_of_P (Qden c)). symmetry in H.
rewrite H in H0; lra. rewrite Qeq_alt in H. rewrite H; auto.
- intros less. apply Qle_Rle in less.
assert (Rmin (Q2R a) (Q2R b) = Q2R a) by (apply Rmin_left; auto).
rewrite H; auto.
- intros less. apply Qle_Rle in less.
assert (Rmin (Q2R a) (Q2R b) = Q2R b) by (apply Rmin_right; auto).
rewrite H; auto.
Qed. Qed.
Lemma maxAbs_impl_RmaxAbs (ivlo:Q) (ivhi:Q): Lemma maxAbs_impl_RmaxAbs (ivlo:Q) (ivhi:Q):
......
...@@ -77,7 +77,7 @@ Lemma Rabs_0_impl_eq (d:R): ...@@ -77,7 +77,7 @@ Lemma Rabs_0_impl_eq (d:R):
Proof. Proof.
intros abs_leq_0. intros abs_leq_0.
pose proof (Rabs_pos d) as abs_geq_0. pose proof (Rabs_pos d) as abs_geq_0.
pose proof (Rle_antisym (Rabs d) R0 abs_leq_0 abs_geq_0) as Rabs_eq. pose proof (Rle_antisym (Rabs d) 0%R abs_leq_0 abs_geq_0) as Rabs_eq.
rewrite <- Rabs_R0 in Rabs_eq. rewrite <- Rabs_R0 in Rabs_eq.
apply Rsqr_eq_asb_1 in Rabs_eq. apply Rsqr_eq_asb_1 in Rabs_eq.
rewrite Rsqr_0 in Rabs_eq. rewrite Rsqr_0 in Rabs_eq.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment