Skip to content

Commit b7ee061

Browse files
committed
Extending rationalify_R_goal to support more variants of real constants.
This is to address the 8.7 change of representation of real constants.
1 parent 50b7f8d commit b7ee061

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

Q_to_R.v

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,21 @@ Proof.
728728
repeat rewrite Ropp_Ropp_IZR; repeat rewrite <- INR_IZR_INZ; unfold IZR, INR at 2; rewrite <- INR_IPR; field; auto.
729729
Qed.
730730

731+
Lemma IZR_Zneg_Zpos : forall p, IZR (Zneg p) = Ropp (IZR (Zpos p)).
732+
Proof.
733+
reflexivity.
734+
Qed.
735+
736+
Lemma IZR_Zpos_xO : forall p, IZR (Zpos (xO p)) = ((1+1) * (IZR (Zpos p)))%R.
737+
Proof.
738+
intro. unfold IZR, IPR. destruct p; simpl; trivial. rewrite Rmult_1_r. trivial.
739+
Qed.
740+
741+
Lemma IZR_Zpos_xI : forall p, IZR (Zpos (xI p)) = (1 + (1+1) * IZR (Zpos p))%R.
742+
Proof.
743+
intro. unfold IZR, IPR. destruct p; simpl; trivial. rewrite Rmult_1_r. trivial.
744+
Qed.
745+
731746
(** These tactics transfer hypotheses and goals from Q to R *)
732747

733748
Ltac realify_Q_assumptions :=
@@ -764,8 +779,11 @@ Ltac rationalify_R_goal :=
764779
| [ |- context [(Rdiv (Q_to_R ?X1) (Q_to_R ?X2))] ] => rewrite <- Q_to_Rdiv; auto; rationalify_R_goal
765780
| [ |- context [(Ropp (Q_to_R ?X1)) ]] => rewrite <- Q_to_Ropp; rationalify_R_goal
766781
| [ |- context [(Rinv (Q_to_R ?X1))] ] => rewrite <- Q_to_Rinv; auto; rationalify_R_goal
767-
| [ |- context [R0] ] => rewrite <- Q_to_R_Zero; rationalify_R_goal
768-
| [ |- context [R1] ] => rewrite <- Q_to_R_Qone; rationalify_R_goal
782+
| [ |- context [0%R] ] => rewrite <- Q_to_R_Zero; rationalify_R_goal
783+
| [ |- context [1%R] ] => rewrite <- Q_to_R_Qone; rationalify_R_goal
784+
| [ |- context [(IZR (Zneg ?X1))] ] => rewrite IZR_Zneg_Zpos; rationalify_R_goal
785+
| [ |- context [(IZR (Zpos (xI ?X1)))] ] => rewrite IZR_Zpos_xI; rationalify_R_goal
786+
| [ |- context [(IZR (Zpos (xO ?X1)))] ] => rewrite IZR_Zpos_xO; rationalify_R_goal
769787
| [ |- context [(IZR ?X1)] ] => rewrite <- Z_to_Q_to_R_IZR; realify_Q_goal
770788
| [ |- _ ] => idtac
771789
end.

0 commit comments

Comments
 (0)