Skip to content
Snippets Groups Projects
Commit f2c345ce authored by Arthur Correnson's avatar Arthur Correnson
Browse files

clean inter_correct proof

parent 7ac41d60
No related branches found
No related tags found
1 merge request!16Fp/ieee
Pipeline #36665 waiting for manual action
...@@ -257,6 +257,17 @@ Qed. ...@@ -257,6 +257,17 @@ Qed.
Ltac classify f := Ltac classify f :=
destruct (classification f) as [ | [ | [ | ]]]; try (subst; easy). destruct (classification f) as [ | [ | [ | ]]]; try (subst; easy).
Ltac classify_nan x :=
match goal with
| [ H : is_nan x = true |- _ ] =>
rewrite (is_nan_inv x H) in *
| [ H : Bleb _ x = true |- _ ] =>
assert (is_nan x = false) by apply (le_not_nan_r _ _ H)
| [ H : Bleb x _ = true |- _ ] =>
assert (is_nan x = false) by apply (le_not_nan_l _ _ H)
| _ => fail "can't determine if" x "is NaN"
end.
Lemma is_finite_not_nan : Lemma is_finite_not_nan :
forall (x : float), is_finite x = true -> is_nan x = false. forall (x : float), is_finite x = true -> is_nan x = false.
Proof. fdestruct x. Qed. Proof. fdestruct x. Qed.
...@@ -266,14 +277,10 @@ Program Lemma inter_correct : ...@@ -266,14 +277,10 @@ Program Lemma inter_correct :
forall (I1 I2 : Interval) x, forall (I1 I2 : Interval) x,
contains I1 x -> contains I2 x -> contains (inter I1 I2) x. contains I1 x -> contains I2 x -> contains (inter I1 I2) x.
Proof. Proof.
intros [ [ | | ? ? [ ]] H1 ] [ [ | | ? ? [ ]] H2 ] x Hx1 Hx2; simpl in *; try easy. intros [ [ | | ? ? [ ]] H1 ] [ [ | | ? ? [ ]] H2 ] x Hx1 Hx2; simpl in *;
- fdestruct x; intuition. try easy; try (fdestruct x; intuition; fail).
- destruct Hx1 as [[Hc1 Hc1'] |], Hx2 as [[Hc2 Hc2'] |]. - destruct Hx1 as [[Hc1 Hc1'] |], Hx2 as [[Hc2 Hc2'] |]; try (fdestruct x ; fail).
+ pose proof (le_not_nan_r _ _ Hc1). + classify_nan l; classify_nan h; classify_nan l0; classify_nan h0.
pose proof (le_not_nan_l _ _ H1).
pose proof (le_not_nan_r _ _ H1).
pose proof (le_not_nan_l _ _ H2).
pose proof (le_not_nan_r _ _ H2).
destruct (Bltb h l0) eqn:E1, (Bltb h0 l) eqn:E2; simpl in *; try easy. destruct (Bltb h l0) eqn:E1, (Bltb h0 l) eqn:E2; simpl in *; try easy.
* apply Bltb_true_Bleb in E1; auto. * apply Bltb_true_Bleb in E1; auto.
now rewrite (Bleb_trans _ _ _ _ _ Hc2 Hc1') in E1. now rewrite (Bleb_trans _ _ _ _ _ Hc2 Hc1') in E1.
...@@ -282,16 +289,10 @@ Proof. ...@@ -282,16 +289,10 @@ Proof.
* apply Bltb_true_Bleb in E2; auto. * apply Bltb_true_Bleb in E2; auto.
now rewrite (Bleb_trans _ _ _ _ _ Hc1 Hc2') in E2. now rewrite (Bleb_trans _ _ _ _ _ Hc1 Hc2') in E2.
* left; split; [ now apply Bmax_le | now apply Bmin_le ]. * left; split; [ now apply Bmax_le | now apply Bmin_le ].
+ fdestruct x.
+ fdestruct x.
+ fdestruct x. + fdestruct x.
destruct (Bltb h _), (Bltb h0); simpl; auto. destruct (Bltb h _), (Bltb h0); simpl; auto.
- destruct Hx1 as [[Hc1 Hc1'] |], Hx2 as [[Hc2 Hc2'] |]. - destruct Hx1 as [[Hc1 Hc1'] |], Hx2 as [[Hc2 Hc2'] |]; try (fdestruct x ; fail).
+ pose proof (le_not_nan_r _ _ Hc1). classify_nan l; classify_nan h; classify_nan l0; classify_nan h0.
pose proof (le_not_nan_l _ _ H1).
pose proof (le_not_nan_r _ _ H1).
pose proof (le_not_nan_l _ _ H2).
pose proof (le_not_nan_r _ _ H2).
destruct (Bltb h l0) eqn:E1, (Bltb h0 l) eqn:E2; simpl in *; try easy. destruct (Bltb h l0) eqn:E1, (Bltb h0 l) eqn:E2; simpl in *; try easy.
* apply Bltb_true_Bleb in E1; auto. * apply Bltb_true_Bleb in E1; auto.
now rewrite (Bleb_trans _ _ _ _ _ Hc2 Hc1') in E1. now rewrite (Bleb_trans _ _ _ _ _ Hc2 Hc1') in E1.
...@@ -300,16 +301,8 @@ Proof. ...@@ -300,16 +301,8 @@ Proof.
* apply Bltb_true_Bleb in E2; auto. * apply Bltb_true_Bleb in E2; auto.
now rewrite (Bleb_trans _ _ _ _ _ Hc1 Hc2') in E2. now rewrite (Bleb_trans _ _ _ _ _ Hc1 Hc2') in E2.
* left; split; [ now apply Bmax_le | now apply Bmin_le ]. * left; split; [ now apply Bmax_le | now apply Bmin_le ].
+ fdestruct x. - destruct Hx1 as [[Hc1 Hc1'] |], Hx2 as [[Hc2 Hc2'] |]; try (fdestruct x; fail).
+ fdestruct x. classify_nan l; classify_nan h; classify_nan l0; classify_nan h0.
+ fdestruct x.
- fdestruct x; intuition.
- destruct Hx1 as [[Hc1 Hc1'] |], Hx2 as [[Hc2 Hc2'] |].
+ pose proof (le_not_nan_r _ _ Hc1).
pose proof (le_not_nan_l _ _ H1).
pose proof (le_not_nan_r _ _ H1).
pose proof (le_not_nan_l _ _ H2).
pose proof (le_not_nan_r _ _ H2).
destruct (Bltb h l0) eqn:E1, (Bltb h0 l) eqn:E2; simpl in *; try easy. destruct (Bltb h l0) eqn:E1, (Bltb h0 l) eqn:E2; simpl in *; try easy.
* apply Bltb_true_Bleb in E1; auto. * apply Bltb_true_Bleb in E1; auto.
now rewrite (Bleb_trans _ _ _ _ _ Hc2 Hc1') in E1. now rewrite (Bleb_trans _ _ _ _ _ Hc2 Hc1') in E1.
...@@ -318,15 +311,8 @@ Proof. ...@@ -318,15 +311,8 @@ Proof.
* apply Bltb_true_Bleb in E2; auto. * apply Bltb_true_Bleb in E2; auto.
now rewrite (Bleb_trans _ _ _ _ _ Hc1 Hc2') in E2. now rewrite (Bleb_trans _ _ _ _ _ Hc1 Hc2') in E2.
* left; split; [ now apply Bmax_le | now apply Bmin_le ]. * left; split; [ now apply Bmax_le | now apply Bmin_le ].
+ fdestruct x. - destruct Hx1 as [[Hc1 Hc1'] |], Hx2 as [[Hc2 Hc2'] |]; try (fdestruct x; fail).
+ fdestruct x. classify_nan l; classify_nan h; classify_nan l0; classify_nan h0.
+ fdestruct x.
- destruct Hx1 as [[Hc1 Hc1'] |], Hx2 as [[Hc2 Hc2'] |].
+ pose proof (le_not_nan_r _ _ Hc1).
pose proof (le_not_nan_l _ _ H1).
pose proof (le_not_nan_r _ _ H1).
pose proof (le_not_nan_l _ _ H2).
pose proof (le_not_nan_r _ _ H2).
destruct (Bltb h l0) eqn:E1, (Bltb h0 l) eqn:E2; simpl in *; try easy. destruct (Bltb h l0) eqn:E1, (Bltb h0 l) eqn:E2; simpl in *; try easy.
* apply Bltb_true_Bleb in E1; auto. * apply Bltb_true_Bleb in E1; auto.
now rewrite (Bleb_trans _ _ _ _ _ Hc2 Hc1') in E1. now rewrite (Bleb_trans _ _ _ _ _ Hc2 Hc1') in E1.
...@@ -335,21 +321,6 @@ Proof. ...@@ -335,21 +321,6 @@ Proof.
* apply Bltb_true_Bleb in E2; auto. * apply Bltb_true_Bleb in E2; auto.
now rewrite (Bleb_trans _ _ _ _ _ Hc1 Hc2') in E2. now rewrite (Bleb_trans _ _ _ _ _ Hc1 Hc2') in E2.
* left; split; [ now apply Bmax_le | now apply Bmin_le ]. * left; split; [ now apply Bmax_le | now apply Bmin_le ].
+ fdestruct x.
+ fdestruct x.
+ fdestruct x.
Qed. Qed.
Ltac classify_nan x :=
match goal with
| [ H : is_nan x = true |- _ ] =>
rewrite (is_nan_inv x H) in *
| [ H : Bleb _ x = true |- _ ] =>
assert (is_nan x = false) by apply (le_not_nan_r _ _ H)
| [ H : Bleb x _ = true |- _ ] =>
assert (is_nan x = false) by apply (le_not_nan_l _ _ H)
| _ => fail "can't determine if" x "is NaN"
end.
End Finterval. End Finterval.
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment