Commit c2fce16b authored by Heiko Becker's avatar Heiko Becker

Proof draft for interval bounds correctness

parent b2217643
......@@ -8,14 +8,6 @@ Section ComputableErrors.
Definition machineEpsilon := (1#(2^53)).
Fixpoint toRExp (e:exp Q) :=
match e with
|Var v => Var R v
|Param v => Param R v
|Const n => Const (Q2R n)
|Binop b e1 e2 => Binop b (toRExp e1) (toRExp e2)
end.
Fixpoint validErrorbound (e:exp Q) (env:analysisResult) :=
let (intv, err) := (env e) in
match e with
......
Require Import Coq.QArith.QArith Coq.QArith.Qminmax Coq.QArith.Qabs Coq.QArith.Qreals.
Require Import Coq.Reals.Reals Coq.micromega.Psatz.
Require Import Daisy.Infra.RationalSimps Daisy.Infra.Abbrevs.
Require Import Daisy.Infra.RationalSimps Daisy.Infra.Abbrevs Daisy.Expressions.
Definition RmaxAbsFun (iv:intv) :=
Fixpoint toRExp (e:exp Q) :=
match e with
|Var v => Var R v
|Param v => Param R v
|Const n => Const (Q2R n)
|Binop b e1 e2 => Binop b (toRExp e1) (toRExp e2)
end.
Definition RmaxAbsFun (iv:intv) :=
Rmax (Rabs (Q2R (fst iv))) (Rabs (Q2R (snd iv))).
Lemma Q2R0_is_0:
Lemma Q2R0_is_0:
Q2R 0 = 0%R.
Proof.
Proof.
unfold Q2R; simpl; lra.
Qed.
Qed.
Lemma Rabs_eq_Qabs:
Lemma Rabs_eq_Qabs:
forall x, Rabs (Q2R x) = Q2R (Qabs x).
Proof.
Proof.
intro.
apply Qabs_case; unfold Rabs; destruct Rcase_abs; intros; try auto.
- apply Qle_Rle in H. exfalso.
......@@ -36,11 +44,11 @@ Require Import Daisy.Infra.RationalSimps Daisy.Infra.Abbrevs.
hnf; right; auto.
+ unfold Q2R in *; simpl in *.
rewrite opp_IZR; lra.
Qed.
Qed.
Lemma maxAbs_impl_RmaxAbs (iv:intv):
Lemma maxAbs_impl_RmaxAbs (iv:intv):
RmaxAbsFun iv = Q2R (maxAbs iv).
Proof.
Proof.
unfold RmaxAbsFun, maxAbs.
repeat rewrite Rabs_eq_Qabs.
apply Q.max_case_strong.
......@@ -70,4 +78,4 @@ Require Import Daisy.Infra.RationalSimps Daisy.Infra.Abbrevs.
apply Qle_Rle in fst_le_snd.
apply Rmax_right in fst_le_snd.
subst; auto.
Qed.
\ No newline at end of file
Qed.
\ No newline at end of file
Require Import Coq.QArith.QArith.
Require Import Daisy.Expressions Daisy.Infra.Abbrevs Daisy.Infra.RationalSimps Daisy.IntervalArithQ Daisy.Infra.RationalConstruction.
Require Import Coq.QArith.QArith Coq.QArith.Qreals.
Require Import Daisy.Expressions Daisy.Infra.Abbrevs Daisy.Infra.RationalSimps Daisy.IntervalArithQ Daisy.Infra.RationalConstruction Daisy.Infra.RealRationalProps Daisy.IntervalArith.
Fixpoint validIntervalbounds (e:exp Q) (absenv:analysisResult) (P:precond):=
let (intv, _) := absenv e in
......@@ -33,6 +33,53 @@ Fixpoint validIntervalbounds (e:exp Q) (absenv:analysisResult) (P:precond):=
andb rec opres
end.
Lemma validIntervalbounds_correct (e:exp Q):
forall (absenv:analysisResult) (P:precond) cenv vR,
validIntervalbounds e absenv P = true ->
eval_exp 0%R cenv (toRExp e) vR ->
contained vR (Q2R (fst (fst(absenv e))), Q2R (snd (fst (absenv e)))).
Proof.
induction e.
- intros absenv P cenv vR valid_bounds eval_e.
unfold validIntervalbounds in valid_bounds.
destruct (absenv (Var Q n)) as [intv err].
simpl.
(* needs that Precond approximates value *)
admit.
- intros absenv P cenv vR valid_bounds eval_e.
unfold validIntervalbounds in valid_bounds.
destruct (absenv (Param Q n)) as [intv err].
(* same *)
admit.
- intros absenv P cenv vR valid_bounds eval_e.
unfold validIntervalbounds in valid_bounds.
destruct (absenv (Const v)) as [intv err].
simpl.
apply Is_true_eq_left in valid_bounds.
apply andb_prop_elim in valid_bounds.
destruct valid_bounds.
unfold contained; simpl.
split.
+ apply Is_true_eq_true in H.
unfold Qleb in *.
apply Qle_bool_iff in H.
admit.
+ admit.
- destruct b.
+ admit.
+ admit.
+ admit.
+ intros absenv P cenv vR valid_bounds eval_e.
simpl in valid_bounds.
destruct (absenv (Binop Div e1 e2));
destruct (absenv e1);
destruct (absenv e2).
apply Is_true_eq_left in valid_bounds.
apply andb_prop_elim in valid_bounds.
destruct valid_bounds.
unfold Is_true in *; simpl in *. contradiction.
Admitted.
Definition u:nat := 1.
(** 1655/5 = 331; 0,4 = 2/5 **)
Definition cst1:Q := 1657 # 5.
......
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