Commit b0ff2319 authored by Heiko Becker's avatar Heiko Becker
Browse files

All unused files are now in the attic. Make some cleanups

parent 935df721
Require Import Coq.QArith.QArith Coq.QArith.Qminmax Coq.QArith.Qabs Coq.QArith.Qreals Coq.Lists.List.
(*Coq.QArith.Qcanon.*)
Require Import Coq.micromega.Psatz Coq.Reals.Reals Interval.Interval_tactic.
Require Import Daisy.Infra.Abbrevs Daisy.Infra.RationalSimps Daisy.Infra.RealRationalProps Daisy.Infra.RationalConstruction Daisy.Infra.RealSimps.
Require Import Daisy.Infra.Abbrevs Daisy.Infra.RationalSimps Daisy.Infra.RealRationalProps Daisy.Infra.RealSimps.
Require Import Daisy.Infra.ExpressionAbbrevs Daisy.IntervalArith Daisy.IntervalArithQ.
Require Import Daisy.ErrorBounds Daisy.IntervalValidation Daisy.PreconditionValidation.
Section ComputableErrors.
Fixpoint validErrorbound (e:exp Q) (env:analysisResult) :=
Fixpoint validErrorbound (e:exp Q) (env:analysisResult) :=
let (intv, err) := (env e) in
let errPos := Qleb 0 err in
match e with
......@@ -32,15 +30,15 @@ Section ComputableErrors.
end
in andb (andb rec errPos) theVal
end.
(*
(*
Functional Scheme validErrorbound_ind := Induction for validErrorbound Sort Prop.
*)
Lemma err_always_positive e (absenv:analysisResult) iv err:
Lemma err_always_positive e (absenv:analysisResult) iv err:
validErrorbound e absenv = true ->
(iv,err) = absenv e ->
(0 <= Q2R err)%R.
Proof.
Proof.
destruct e;intros validErrorbound_e absenv_e;
unfold validErrorbound in validErrorbound_e;
rewrite <- absenv_e in validErrorbound_e; simpl in *.
......@@ -63,16 +61,16 @@ Section ComputableErrors.
destruct hyp as [ _ hyp].
apply Is_true_eq_true in hyp.
apply Qle_bool_iff in hyp; apply Qle_Rle in hyp; rewrite Q2R0_is_0 in hyp; auto.
Qed.
Qed.
Ltac math_hnf := repeat rewrite Rsub_eq_Ropp_Rplus;
Ltac math_hnf := repeat rewrite Rsub_eq_Ropp_Rplus;
repeat rewrite Ropp_plus_distr;
repeat rewrite Rmult_plus_distr_r;
repeat rewrite Rmult_plus_distr_l;
repeat rewrite Ropp_involutive;
repeat rewrite <- Rplus_assoc.
Lemma validErrorboundCorrectConstant:
Lemma validErrorboundCorrectConstant:
forall cenv absenv (n:Q) nR nF e nlo nhi (P:precond),
eval_exp 0%R cenv (Const (Q2R n)) nR ->
eval_exp (Q2R (RationalSimps.machineEpsilon)) cenv (Const (Q2R n)) nF ->
......@@ -80,7 +78,7 @@ Section ComputableErrors.
validIntervalbounds (Const n) absenv P = true ->
absenv (Const n) = ((nlo,nhi),e) ->
(Rabs (nR - nF) <= (Q2R e))%R.
Proof.
Proof.
intros cenv absenv n nR nF e nlo nhi P eval_real eval_float error_valid intv_valid absenv_const.
unfold validErrorbound in error_valid.
rewrite absenv_const in error_valid.
......@@ -121,9 +119,9 @@ Section ComputableErrors.
rewrite <- maxAbs_impl_RmaxAbs.
apply RmaxAbs; simpl; apply Qle_Rle; rewrite <- Qle_bool_iff; unfold Qleb in *; simpl in *;
[destruct (Qle_bool nlo n); auto | destruct (Qle_bool n nhi); auto].
Qed.
Qed.
Lemma validErrorboundCorrectParam:
Lemma validErrorboundCorrectParam:
forall cenv absenv (v:nat) nR nF e P plo phi,
(forall n, List.In n (freeVars Q (Param Q v)) ->
Is_true(isSupersetIntv (P n) (fst (absenv (Param Q n))))) ->
......@@ -134,7 +132,7 @@ Section ComputableErrors.
validIntervalbounds (Param Q v) absenv P = true ->
absenv (Param Q v) = ((plo,phi),e) ->
(Rabs (nR - nF) <= (Q2R e))%R.
Proof.
Proof.
intros cenv absenv v nR nF e P plo phi absenv_approx_p cenv_approx_p eval_real eval_float error_valid intv_valid absenv_param.
unfold validErrorbound in error_valid.
rewrite absenv_param in error_valid.
......@@ -181,9 +179,9 @@ Section ComputableErrors.
apply Qle_Rle in error_valid.
rewrite Q2R_mult in error_valid.
apply error_valid.
Qed.
Qed.
Lemma validErrorboundCorrectAddition cenv absenv (e1:exp Q) (e2:exp Q) (nR nR1 nR2 nF nF1 nF2 :R) (e err1 err2 :error) (alo ahi e1lo e1hi e2lo e2hi:Q) P :
Lemma validErrorboundCorrectAddition cenv absenv (e1:exp Q) (e2:exp Q) (nR nR1 nR2 nF nF1 nF2 :R) (e err1 err2 :error) (alo ahi e1lo e1hi e2lo e2hi:Q) P :
(forall v, List.In v (freeVars Q (Binop Plus e1 e2)) ->
Is_true(isSupersetIntv (P v) (fst (absenv (Param Q v))))) ->
precondValidForExec P cenv ->
......@@ -201,7 +199,7 @@ Section ComputableErrors.
(Rabs (nR1 - nF1) <= (Q2R err1))%R ->
(Rabs (nR2 - nF2) <= (Q2R err2))%R ->
(Rabs (nR - nF) <= (Q2R e))%R.
Proof.
Proof.
intros env_approx_p p_valid e1_real e2_real eval_real e1_float e2_float eval_float valid_error valid_intv absenv_e1 absenv_e2 absenv_add err1_bounded err2_bounded.
eapply Rle_trans.
eapply add_abs_err_bounded.
......@@ -266,9 +264,9 @@ Section ComputableErrors.
pose proof (validIntervalbounds_sound _ _ _ _ _ env_approx_e2 p_valid valid_iv_e2 e2_real) as valid_bounds_e2.
apply (Rabs_error_bounded_maxAbs nR2); try auto.
unfold contained; rewrite absenv_e2 in valid_bounds_e2; auto.
Qed.
Qed.
Lemma validErrorboundCorrectSubtraction cenv absenv (e1:exp Q) (e2:exp Q) (nR nR1 nR2 nF nF1 nF2 :R) (e err1 err2 :error) (alo ahi e1lo e1hi e2lo e2hi:Q) P :
Lemma validErrorboundCorrectSubtraction cenv absenv (e1:exp Q) (e2:exp Q) (nR nR1 nR2 nF nF1 nF2 :R) (e err1 err2 :error) (alo ahi e1lo e1hi e2lo e2hi:Q) P :
(forall v, List.In v (freeVars Q (Binop Sub e1 e2)) ->
Is_true(isSupersetIntv (P v) (fst (absenv (Param Q v))))) ->
precondValidForExec P cenv ->
......@@ -286,7 +284,7 @@ Section ComputableErrors.
(Rabs (nR1 - nF1) <= (Q2R err1))%R ->
(Rabs (nR2 - nF2) <= (Q2R err2))%R ->
(Rabs (nR - nF) <= (Q2R e))%R.
Proof.
Proof.
intros env_approx_p p_valid e1_real e2_real eval_real e1_float e2_float eval_float
valid_error valid_intv absenv_e1 absenv_e2 absenv_sub
err1_bounded err2_bounded.
......@@ -350,9 +348,9 @@ Section ComputableErrors.
pose proof (validIntervalbounds_sound _ _ _ _ _ env_approx_e2 p_valid valid_iv_e2 e2_real) as valid_bounds_e2.
apply (Rabs_error_bounded_maxAbs nR2); try auto.
unfold contained; rewrite absenv_e2 in valid_bounds_e2; auto.
Qed.
Qed.
Lemma validErrorboundCorrectMult cenv absenv (e1:exp Q) (e2:exp Q) (nR nR1 nR2 nF nF1 nF2 :R) (e err1 err2 :error) (alo ahi e1lo e1hi e2lo e2hi:Q) P :
Lemma validErrorboundCorrectMult cenv absenv (e1:exp Q) (e2:exp Q) (nR nR1 nR2 nF nF1 nF2 :R) (e err1 err2 :error) (alo ahi e1lo e1hi e2lo e2hi:Q) P :
(forall v, List.In v (freeVars Q (Binop Mult e1 e2)) ->
Is_true(isSupersetIntv (P v) (fst (absenv (Param Q v))))) ->
precondValidForExec P cenv ->
......@@ -370,7 +368,7 @@ Section ComputableErrors.
(Rabs (nR1 - nF1) <= (Q2R err1))%R ->
(Rabs (nR2 - nF2) <= (Q2R err2))%R ->
(Rabs (nR - nF) <= (Q2R e))%R.
Proof.
Proof.
intros env_approx_p p_valid e1_real e2_real eval_real e1_float e2_float eval_float
valid_error valid_intv absenv_e1 absenv_e2 absenv_mult
err1_bounded err2_bounded.
......@@ -978,13 +976,13 @@ Section ComputableErrors.
rewrite absenv_e1 in valid_e1; simpl in *; unfold contained; auto.
+ apply (Rabs_error_bounded_maxAbs nR2); try auto.
rewrite absenv_e2 in valid_e2; simpl in *; unfold contained; auto.
Qed.
Qed.
Ltac iv_assert iv name:=
Ltac iv_assert iv name:=
assert (exists ivlo ivhi, iv = (ivlo, ivhi)) as name by (destruct iv; repeat eexists; auto).
Lemma validErrorbound_sound (e:exp Q):
Lemma validErrorbound_sound (e:exp Q):
forall cenv absenv nR nF err P elo ehi,
(forall v, List.In v (freeVars Q e) ->
Is_true(isSupersetIntv (P v) (fst (absenv (Param Q v))))) ->
......@@ -995,7 +993,7 @@ Section ComputableErrors.
validIntervalbounds e absenv P = true ->
absenv e = ((elo,ehi),err) ->
(Rabs (nR - nF) <= (Q2R err))%R.
Proof.
Proof.
induction e.
- intros; simpl in *.
rewrite H5 in H3; rewrite H5 in H4; inversion H3.
......@@ -1114,6 +1112,4 @@ Section ComputableErrors.
assert (List.In v (freeVars Q (Binop Mult e1 e2))) by (unfold freeVars; apply in_or_app; auto).
apply (env_approx_p v H).
+ inversion valid_error.
Qed.
End ComputableErrors.
Qed.
Require Import Coq.QArith.QArith Coq.QArith.Qreals QArith.Qminmax Coq.Lists.List.
Require Import Daisy.Infra.Abbrevs Daisy.Infra.RationalSimps Daisy.Infra.RationalConstruction Daisy.Infra.RealRationalProps.
Require Import Daisy.Infra.Abbrevs Daisy.Infra.RationalSimps Daisy.Infra.RealRationalProps.
Require Import Daisy.Infra.ExpressionAbbrevs Daisy.IntervalArithQ Daisy.IntervalArith Daisy.Infra.RealSimps Daisy.PreconditionValidation.
Fixpoint validIntervalbounds (e:exp Q) (absenv:analysisResult) (P:precond):=
......
Require Import Daisy.CertificateChecker.
(*Require Import Daisy.ErrorValidation Daisy.Infra.RationalConstruction Daisy.Infra.ExpressionAbbrevs. *)
(*
TODO: update according to:
[ Info ]
......
Require Import Coq.QArith.QArith Coq.QArith.Qabs Coq.QArith.Qminmax.
Require Import Daisy.ErrorValidation Daisy.Infra.RationalConstruction Daisy.Infra.ExpressionAbbrevs Daisy.Infra.RationalSimps Daisy.IntervalValidation.
Require Import Daisy.CertificateChecker.
(*
[ Info ]
......@@ -82,12 +81,9 @@ Definition precondition :precond := fun _ => (-(100#1),(100#1)).
Definition machineEpsilon := (1#(2^53)).
Definition l := Eval compute in (maxAbs (cst1,cst1) * machineEpsilon).
Definition r := Eval compute in (Qred errCst1).
Eval compute in (Qleb l r).
Eval compute in validErrorbound valCst absEnv.
Eval compute in validErrorbound varU absEnv.
Eval compute in validErrorbound valCstAddVarU absEnv.
Eval compute in CertificateChecker valCst absEnv precondition.
Eval compute in CertificateChecker varU absEnv precondition.
Eval compute in CertificateChecker valCstAddVarU absEnv precondition.
(* OLD STUFF BEGINS HERE
(** The added assertion becomes the precondition for us **)
......
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