Commit 1a95eddd authored by Heiko Becker's avatar Heiko Becker

Renaming in Coq dev, move attic files to separate folder

parent 9113b954
...@@ -14,7 +14,7 @@ coq/*.vo ...@@ -14,7 +14,7 @@ coq/*.vo
coq/.* coq/.*
coq/*.v.d coq/*.v.d
coq/*/*.v.d coq/*/*.v.d
coq/Makefile coq/Makefile*
coq/*/*.glob coq/*/*.glob
coq/*/.* coq/*/.*
coq/*/*.vo coq/*/*.vo
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
used to verify analsysis result in the final theorem of a certificate. used to verify analsysis result in the final theorem of a certificate.
**) **)
Require Import Coq.Reals.Reals. Require Import Coq.Reals.Reals.
Require Import Daisy.Infra.Abbrevs Daisy.Infra.RealConstruction Daisy.Infra.RealSimps. Require Import Flover.Infra.Abbrevs Flover.Infra.RealConstruction Flover.Infra.RealSimps.
Require Import Daisy.IntervalArith Daisy.Expressions Daisy.Commands. Require Import Flover.IntervalArith Flover.Expressions Flover.Commands.
Definition abs_env:Type := exp R -> interval -> err -> Prop. Definition abs_env:Type := exp R -> interval -> err -> Prop.
......
(** (**
Formalization of the Abstract Syntax Tree of a subset used in the Daisy framework Formalization of the Abstract Syntax Tree of a subset used in the Flover framework
**) **)
Require Import Coq.Reals.Reals. Require Import Coq.Reals.Reals.
Require Import Daisy.Infra.Abbrevs Daisy.Expressions. Require Import Flover.Infra.Abbrevs Flover.Expressions.
(** (**
Next define what a program is. Next define what a program is.
Currently no loops, only conditionals and assignments Currently no loops, only conditionals and assignments
...@@ -15,7 +15,7 @@ Let: nat -> exp V -> cmd V -> cmd V ...@@ -15,7 +15,7 @@ Let: nat -> exp V -> cmd V -> cmd V
| Nop: cmd V. | Nop: cmd V.
(** (**
Small Step semantics for Daisy language, parametric by evaluation function. Small Step semantics for Flover language, parametric by evaluation function.
**) **)
Inductive sstep : cmd R -> env_ty -> R -> cmd R -> env_ty -> Prop := Inductive sstep : cmd R -> env_ty -> R -> cmd R -> env_ty -> Prop :=
let_s x e s env v eps: let_s x e s env v eps:
...@@ -31,7 +31,7 @@ Inductive sstep : cmd R -> env_ty -> R -> cmd R -> env_ty -> Prop := ...@@ -31,7 +31,7 @@ Inductive sstep : cmd R -> env_ty -> R -> cmd R -> env_ty -> Prop :=
eval_exp eps env e v -> eval_exp eps env e v ->
sstep (Ret R e) env eps (Nop R) (updEnv 0 v env). sstep (Ret R e) env eps (Nop R) (updEnv 0 v env).
(** (**
Analogously define Big Step semantics for the Daisy language, Analogously define Big Step semantics for the Flover language,
parametric by the evaluation function parametric by the evaluation function
**) **)
Inductive bstep : cmd R -> env_ty -> R -> cmd R -> env_ty -> Prop := Inductive bstep : cmd R -> env_ty -> R -> cmd R -> env_ty -> Prop :=
......
(** (**
Formalization of the base expression language for the daisy framework Formalization of the base expression language for the flover framework
**) **)
Require Import Coq.Reals.Reals Coq.micromega.Psatz Coq.QArith.QArith Interval.Interval_tactic. Require Import Coq.Reals.Reals Coq.micromega.Psatz Coq.QArith.QArith Interval.Interval_tactic.
Require Import Daisy.Infra.RealConstruction Daisy.Infra.RealSimps Daisy.Infra.Abbrevs. Require Import Flover.Infra.RealConstruction Flover.Infra.RealSimps Flover.Infra.Abbrevs.
Set Implicit Arguments. Set Implicit Arguments.
Module Type Expression. Module Type Expression.
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Precondition agreement checker and its soundness proof Precondition agreement checker and its soundness proof
**) **)
Require Import Coq.Reals.Reals Coq.Lists.List Coq.QArith.QArith. Require Import Coq.Reals.Reals Coq.Lists.List Coq.QArith.QArith.
Require Import Daisy.Infra.Abbrevs Daisy.Expressions Daisy.Infra.RationalSimps Daisy.Infra.ExpressionAbbrevs Daisy.IntervalArithQ. Require Import Flover.Infra.Abbrevs Flover.Expressions Flover.Infra.RationalSimps Flover.Infra.ExpressionAbbrevs Flover.IntervalArithQ.
Import Lists.List.ListNotations. Import Lists.List.ListNotations.
......
Require Import Daisy.CertificateChecker. Require Import Flover.CertificateChecker.
(* (*
TODO: update according to: TODO: update according to:
[ Info ] [ Info ]
......
Require Import Daisy.CertificateChecker. Require Import Flover.CertificateChecker.
(* (*
[ Info ] [ Info ]
......
Require Import Coq.Reals.Reals. Require Import Coq.Reals.Reals.
Require Import Daisy.Infra.abbrevs Daisy.daisy_lang Daisy.abs_err Daisy.exps. Require Import Flover.Infra.abbrevs Flover.flover_lang Flover.abs_err Flover.exps.
(** (**
Notes: Notes:
......
Require Import Coq.Reals.Reals. Require Import Coq.Reals.Reals.
Require Import Interval.Interval_tactic. Require Import Interval.Interval_tactic.
Require Import Daisy.Infra.abbrevs. Require Import Flover.Infra.abbrevs.
Definition min4 (a:R) (b:R) (c:R) (d:R) := Rmin a (Rmin b (Rmin c d)). Definition min4 (a:R) (b:R) (c:R) (d:R) := Rmin a (Rmin b (Rmin c d)).
Definition max4 (a:R) (b:R) (c:R) (d:R) := Rmax a (Rmax b (Rmax c d)). Definition max4 (a:R) (b:R) (c:R) (d:R) := Rmax a (Rmax b (Rmax c d)).
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Toy Example to understand what certificate we will need for a given program Toy Example to understand what certificate we will need for a given program
**) **)
Require Import Coq.Reals.Reals. Require Import Coq.Reals.Reals.
Require Import Daisy.daisy_lang Daisy.exps Daisy.abs_err. Require Import Flover.flover_lang Flover.exps Flover.abs_err.
Definition prg :cmd R := Definition prg :cmd R :=
Ret R (Binop Mult (Const (3%R)) (Var R 1)). Ret R (Binop Mult (Const (3%R)) (Var R 1)).
......
...@@ -2,7 +2,7 @@ open preamble ...@@ -2,7 +2,7 @@ open preamble
open machine_ieeeTheory binary_ieeeTheory lift_ieeeTheory realTheory open machine_ieeeTheory binary_ieeeTheory lift_ieeeTheory realTheory
open MachineTypeTheory ExpressionsTheory RealSimpsTheory DaisyTactics CertificateCheckerTheory open MachineTypeTheory ExpressionsTheory RealSimpsTheory FloverTactics CertificateCheckerTheory
open FPRangeValidatorTheory IntervalValidationTheory TypingTheory ErrorValidationTheory IntervalArithTheory AbbrevsTheory open FPRangeValidatorTheory IntervalValidationTheory TypingTheory ErrorValidationTheory IntervalArithTheory AbbrevsTheory
......
...@@ -5,15 +5,15 @@ ...@@ -5,15 +5,15 @@
as shown in the soundness theorem. as shown in the soundness theorem.
**) **)
Require Import Coq.Reals.Reals Coq.QArith.Qreals. Require Import Coq.Reals.Reals Coq.QArith.Qreals.
Require Import Daisy.Infra.RealSimps Daisy.Infra.RationalSimps Daisy.Infra.RealRationalProps Daisy.Infra.Ltacs. Require Import Flover.Infra.RealSimps Flover.Infra.RationalSimps Flover.Infra.RealRationalProps Flover.Infra.Ltacs.
Require Import Daisy.IntervalValidation Daisy.ErrorValidation Daisy.Environments Daisy.Typing Daisy.FPRangeValidator. Require Import Flover.IntervalValidation Flover.ErrorValidation Flover.Environments Flover.Typing Flover.FPRangeValidator.
Require Export Coq.QArith.QArith. Require Export Coq.QArith.QArith.
Require Export Daisy.Infra.ExpressionAbbrevs Daisy.Commands. Require Export Flover.Infra.ExpressionAbbrevs Flover.Commands.
(** Certificate checking function **) (** Certificate checking function **)
Definition CertificateChecker (e:exp Q) (absenv:analysisResult) (P:precond) (defVars:nat -> option mType) := Definition CertificateChecker (e:exp Q) (absenv:analysisResult) (P:precond) (defVars:nat -> option mType) :=
let tMap := (typeMap defVars e (DaisyMap.empty mType)) in let tMap := (typeMap defVars e (FloverMap.empty mType)) in
if (typeCheck e defVars tMap) if (typeCheck e defVars tMap)
then then
if (validIntervalbounds e absenv P NatSet.empty) && FPRangeValidator e absenv tMap NatSet.empty if (validIntervalbounds e absenv P NatSet.empty) && FPRangeValidator e absenv tMap NatSet.empty
...@@ -37,7 +37,7 @@ Theorem Certificate_checking_is_sound (e:exp Q) (absenv:analysisResult) P defVar ...@@ -37,7 +37,7 @@ Theorem Certificate_checking_is_sound (e:exp Q) (absenv:analysisResult) P defVar
defVars v = Some m) -> defVars v = Some m) ->
CertificateChecker e absenv P defVars = true -> CertificateChecker e absenv P defVars = true ->
exists iv err vR vF m, exists iv err vR vF m,
DaisyMap.find e absenv = Some (iv, err) /\ FloverMap.find e absenv = Some (iv, err) /\
eval_exp E1 (toRMap defVars) (toREval (toRExp e)) vR M0 /\ eval_exp E1 (toRMap defVars) (toREval (toRExp e)) vR M0 /\
eval_exp E2 defVars (toRExp e) vF m /\ eval_exp E2 defVars (toRExp e) vF m /\
(forall vF m, (forall vF m,
...@@ -67,12 +67,12 @@ Proof. ...@@ -67,12 +67,12 @@ Proof.
edestruct (validIntervalbounds_sound e (A:=absenv) (P:=P) (fVars:=usedVars e) (dVars:=NatSet.empty) (Gamma:=defVars) (E:=E1)) edestruct (validIntervalbounds_sound e (A:=absenv) (P:=P) (fVars:=usedVars e) (dVars:=NatSet.empty) (Gamma:=defVars) (E:=E1))
as [iv_e [ err_e [vR [ map_e [eval_real real_bounds_e]]]]]; eauto. as [iv_e [ err_e [vR [ map_e [eval_real real_bounds_e]]]]]; eauto.
destruct iv_e as [elo ehi]. destruct iv_e as [elo ehi].
edestruct (validErrorbound_sound e (typeMap defVars e (DaisyMap.empty mType)) L approxE1E2 H0 eval_real R0 L1 H P_valid H1 map_e) as [[vF [mF eval_float]] err_bounded]; auto. edestruct (validErrorbound_sound e (typeMap defVars e (FloverMap.empty mType)) L approxE1E2 H0 eval_real R0 L1 H P_valid H1 map_e) as [[vF [mF eval_float]] err_bounded]; auto.
exists (elo, ehi), err_e, vR, vF, mF; split; auto. exists (elo, ehi), err_e, vR, vF, mF; split; auto.
Qed. Qed.
Definition CertificateCheckerCmd (f:cmd Q) (absenv:analysisResult) (P:precond) defVars:= Definition CertificateCheckerCmd (f:cmd Q) (absenv:analysisResult) (P:precond) defVars:=
let tMap := typeMapCmd defVars f (DaisyMap.empty mType) in let tMap := typeMapCmd defVars f (FloverMap.empty mType) in
if (typeCheckCmd f defVars tMap && validSSA f (freeVars f)) if (typeCheckCmd f defVars tMap && validSSA f (freeVars f))
then then
if (validIntervalboundsCmd f absenv P NatSet.empty) && if (validIntervalboundsCmd f absenv P NatSet.empty) &&
...@@ -92,7 +92,7 @@ Theorem Certificate_checking_cmds_is_sound (f:cmd Q) (absenv:analysisResult) P d ...@@ -92,7 +92,7 @@ Theorem Certificate_checking_cmds_is_sound (f:cmd Q) (absenv:analysisResult) P d
defVars v = Some m) -> defVars v = Some m) ->
CertificateCheckerCmd f absenv P defVars = true -> CertificateCheckerCmd f absenv P defVars = true ->
exists iv err vR vF m, exists iv err vR vF m,
DaisyMap.find (getRetExp f) absenv = Some (iv,err) /\ FloverMap.find (getRetExp f) absenv = Some (iv,err) /\
bstep (toREvalCmd (toRCmd f)) E1 (toRMap defVars) vR M0 /\ bstep (toREvalCmd (toRCmd f)) E1 (toRMap defVars) vR M0 /\
bstep (toRCmd f) E2 defVars vF m /\ bstep (toRCmd f) E2 defVars vF m /\
(forall vF m, (forall vF m,
......
Require Import Daisy.CertificateChecker Daisy.daisyParser. Require Import Flover.CertificateChecker Flover.floverParser.
Require Import Coq.extraction.ExtrOcamlString Coq.extraction.ExtrOcamlBasic Coq.extraction.ExtrOcamlNatBigInt Coq.extraction.ExtrOcamlZBigInt. Require Import Coq.extraction.ExtrOcamlString Coq.extraction.ExtrOcamlBasic Coq.extraction.ExtrOcamlNatBigInt Coq.extraction.ExtrOcamlZBigInt.
Extraction Language Ocaml. Extraction Language Ocaml.
......
(** (**
Formalization of the Abstract Syntax Tree of a subset used in the Daisy framework Formalization of the Abstract Syntax Tree of a subset used in the Flover framework
**) **)
Require Import Coq.Reals.Reals Coq.QArith.QArith. Require Import Coq.Reals.Reals Coq.QArith.QArith.
Require Import Daisy.Expressions. Require Import Flover.Expressions.
Require Export Daisy.Infra.ExpressionAbbrevs Daisy.Infra.NatSet. Require Export Flover.Infra.ExpressionAbbrevs Flover.Infra.NatSet.
(** (**
Next define what a program is. Next define what a program is.
...@@ -35,7 +35,7 @@ Fixpoint toREvalCmd (f:cmd R) := ...@@ -35,7 +35,7 @@ Fixpoint toREvalCmd (f:cmd R) :=
(* (*
UNUSED! UNUSED!
Small Step semantics for Daisy language Small Step semantics for Flover language
Inductive sstep : cmd R -> env -> R -> cmd R -> env -> Prop := Inductive sstep : cmd R -> env -> R -> cmd R -> env -> Prop :=
let_s x e s E v eps: let_s x e s E v eps:
eval_exp eps E e v -> eval_exp eps E e v ->
...@@ -46,7 +46,7 @@ Inductive sstep : cmd R -> env -> R -> cmd R -> env -> Prop := ...@@ -46,7 +46,7 @@ Inductive sstep : cmd R -> env -> R -> cmd R -> env -> Prop :=
*) *)
(** (**
Define big step semantics for the Daisy language, terminating on a "returned" Define big step semantics for the Flover language, terminating on a "returned"
result value result value
**) **)
Inductive bstep : cmd R -> env -> (nat -> option mType) -> R -> mType -> Prop := Inductive bstep : cmd R -> env -> (nat -> option mType) -> R -> mType -> Prop :=
......
(** (**
Environment library. Environment library.
Defines the environment type for the Daisy framework and a simulation relation between environments. Defines the environment type for the Flover framework and a simulation relation between environments.
**) **)
Require Import Coq.Reals.Reals Coq.micromega.Psatz Coq.QArith.Qreals. Require Import Coq.Reals.Reals Coq.micromega.Psatz Coq.QArith.Qreals.
Require Import Daisy.Infra.ExpressionAbbrevs Daisy.Infra.RationalSimps Daisy.Commands. Require Import Flover.Infra.ExpressionAbbrevs Flover.Infra.RationalSimps Flover.Commands.
(** (**
Define an approximation relation between two environments. Define an approximation relation between two environments.
...@@ -22,7 +22,7 @@ Inductive approxEnv : env -> (nat -> option mType) -> analysisResult -> NatSet.t ...@@ -22,7 +22,7 @@ Inductive approxEnv : env -> (nat -> option mType) -> analysisResult -> NatSet.t
approxEnv (updEnv x v1 E1) (updDefVars x m defVars) A (NatSet.add x fVars) dVars (updEnv x v2 E2) approxEnv (updEnv x v1 E1) (updDefVars x m defVars) A (NatSet.add x fVars) dVars (updEnv x v2 E2)
|approxUpdBound E1 E2 defVars A v1 v2 x fVars dVars m iv err: |approxUpdBound E1 E2 defVars A v1 v2 x fVars dVars m iv err:
approxEnv E1 defVars A fVars dVars E2 -> approxEnv E1 defVars A fVars dVars E2 ->
DaisyMap.find (Var Q x) A = Some (iv, err) -> FloverMap.find (Var Q x) A = Some (iv, err) ->
(Rabs (v1 - v2) <= Q2R err)%R -> (Rabs (v1 - v2) <= Q2R err)%R ->
NatSet.mem x (NatSet.union fVars dVars) = false -> NatSet.mem x (NatSet.union fVars dVars) = false ->
approxEnv (updEnv x v1 E1) (updDefVars x m defVars) A fVars (NatSet.add x dVars) (updEnv x v2 E2). approxEnv (updEnv x v1 E1) (updDefVars x m defVars) A fVars (NatSet.add x dVars) (updEnv x v2 E2).
...@@ -102,7 +102,7 @@ Section RelationProperties. ...@@ -102,7 +102,7 @@ Section RelationProperties.
E2 x = Some v2 -> E2 x = Some v2 ->
NatSet.In x dVars -> NatSet.In x dVars ->
Gamma x = Some m -> Gamma x = Some m ->
DaisyMap.find (Var Q x) A = Some (iv, e) -> FloverMap.find (Var Q x) A = Some (iv, e) ->
(Rabs (v - v2) <= Q2R e)%R. (Rabs (v - v2) <= Q2R e)%R.
Proof. Proof.
induction approxEnvs; induction approxEnvs;
......
...@@ -4,8 +4,8 @@ This shortens soundness proofs later. ...@@ -4,8 +4,8 @@ This shortens soundness proofs later.
Bounds are explained in section 5, Deriving Computable Error Bounds Bounds are explained in section 5, Deriving Computable Error Bounds
**) **)
Require Import Coq.Reals.Reals Coq.micromega.Psatz Coq.QArith.QArith Coq.QArith.Qreals. Require Import Coq.Reals.Reals Coq.micromega.Psatz Coq.QArith.QArith Coq.QArith.Qreals.
Require Import Daisy.Infra.Abbrevs Daisy.Infra.RationalSimps Daisy.Infra.RealSimps Daisy.Infra.RealRationalProps. Require Import Flover.Infra.Abbrevs Flover.Infra.RationalSimps Flover.Infra.RealSimps Flover.Infra.RealRationalProps.
Require Import Daisy.Environments Daisy.Infra.ExpressionAbbrevs. Require Import Flover.Environments Flover.Infra.ExpressionAbbrevs.
Lemma const_abs_err_bounded (n:R) (nR:R) (nF:R) (E1 E2:env) (m:mType) defVars: Lemma const_abs_err_bounded (n:R) (nR:R) (nF:R) (E1 E2:env) (m:mType) defVars:
......
...@@ -9,17 +9,17 @@ ...@@ -9,17 +9,17 @@
From Coq From Coq
Require Import QArith.QArith QArith.Qminmax QArith.Qabs QArith.Qreals Require Import QArith.QArith QArith.Qminmax QArith.Qabs QArith.Qreals
micromega.Psatz Reals.Reals. micromega.Psatz Reals.Reals.
From Daisy From Flover
Require Import Infra.Abbrevs Infra.RationalSimps Infra.RealRationalProps Require Import Infra.Abbrevs Infra.RationalSimps Infra.RealRationalProps
Infra.RealSimps Infra.Ltacs Environments IntervalValidation Typing Infra.RealSimps Infra.Ltacs Environments IntervalValidation Typing
ErrorBounds. ErrorBounds.
(** Error bound validator **) (** Error bound validator **)
Fixpoint validErrorbound (e:exp Q) (* analyzed expression *) Fixpoint validErrorbound (e:exp Q) (* analyzed expression *)
(typeMap:DaisyMap.t mType) (* derived types for e *) (typeMap:FloverMap.t mType) (* derived types for e *)
(A:analysisResult) (* encoded result of Daisy *) (A:analysisResult) (* encoded result of Flover *)
(dVars:NatSet.t) (* let-bound variables encountered previously *):= (dVars:NatSet.t) (* let-bound variables encountered previously *):=
match DaisyMap.find e A, DaisyMap.find e typeMap with match FloverMap.find e A, FloverMap.find e typeMap with
| Some (intv, err), Some m => | Some (intv, err), Some m =>
if (Qleb 0 err) (* encoding soundness: errors are positive *) if (Qleb 0 err) (* encoding soundness: errors are positive *)
then then
...@@ -33,7 +33,7 @@ Fixpoint validErrorbound (e:exp Q) (* analyzed expression *) ...@@ -33,7 +33,7 @@ Fixpoint validErrorbound (e:exp Q) (* analyzed expression *)
|Unop Neg e1 => |Unop Neg e1 =>
if (validErrorbound e1 typeMap A dVars) if (validErrorbound e1 typeMap A dVars)
then then
match DaisyMap.find e1 A with match FloverMap.find e1 A with
| Some (iv_e1, err1) => Qeq_bool err err1 | Some (iv_e1, err1) => Qeq_bool err err1
| None => false | None => false
end end
...@@ -43,7 +43,7 @@ Fixpoint validErrorbound (e:exp Q) (* analyzed expression *) ...@@ -43,7 +43,7 @@ Fixpoint validErrorbound (e:exp Q) (* analyzed expression *)
if ((validErrorbound e1 typeMap A dVars) if ((validErrorbound e1 typeMap A dVars)
&& (validErrorbound e2 typeMap A dVars)) && (validErrorbound e2 typeMap A dVars))
then then
match DaisyMap.find e1 A, DaisyMap.find e2 A with match FloverMap.find e1 A, FloverMap.find e2 A with
| Some (ive1, err1), Some (ive2, err2) => | Some (ive1, err1), Some (ive2, err2) =>
let errIve1 := widenIntv ive1 err1 in let errIve1 := widenIntv ive1 err1 in
let errIve2 := widenIntv ive2 err2 in let errIve2 := widenIntv ive2 err2 in
...@@ -74,7 +74,7 @@ Fixpoint validErrorbound (e:exp Q) (* analyzed expression *) ...@@ -74,7 +74,7 @@ Fixpoint validErrorbound (e:exp Q) (* analyzed expression *)
&& (validErrorbound e2 typeMap A dVars) && (validErrorbound e2 typeMap A dVars)
&& (validErrorbound e3 typeMap A dVars)) && (validErrorbound e3 typeMap A dVars))
then then
match DaisyMap.find e1 A, DaisyMap.find e2 A, DaisyMap.find e3 A with match FloverMap.find e1 A, FloverMap.find e2 A, FloverMap.find e3 A with
| Some (ive1, err1), Some (ive2, err2), Some (ive3, err3) => | Some (ive1, err1), Some (ive2, err2), Some (ive3, err3) =>
let errIve1 := widenIntv ive1 err1 in let errIve1 := widenIntv ive1 err1 in
let errIve2 := widenIntv ive2 err2 in let errIve2 := widenIntv ive2 err2 in
...@@ -91,7 +91,7 @@ Fixpoint validErrorbound (e:exp Q) (* analyzed expression *) ...@@ -91,7 +91,7 @@ Fixpoint validErrorbound (e:exp Q) (* analyzed expression *)
|Downcast m1 e1 => |Downcast m1 e1 =>
if validErrorbound e1 typeMap A dVars if validErrorbound e1 typeMap A dVars
then then
match DaisyMap.find e1 A with match FloverMap.find e1 A with
| Some (ive1, err1) => | Some (ive1, err1) =>
let errIve1 := widenIntv ive1 err1 in let errIve1 := widenIntv ive1 err1 in
(Qleb (err1 + maxAbs errIve1 * (mTypeToQ m1)) err) (Qleb (err1 + maxAbs errIve1 * (mTypeToQ m1)) err)
...@@ -107,12 +107,12 @@ Fixpoint validErrorbound (e:exp Q) (* analyzed expression *) ...@@ -107,12 +107,12 @@ Fixpoint validErrorbound (e:exp Q) (* analyzed expression *)
(** Error bound command validator **) (** Error bound command validator **)
Fixpoint validErrorboundCmd (f:cmd Q) (* analyzed cmd with let's *) Fixpoint validErrorboundCmd (f:cmd Q) (* analyzed cmd with let's *)
typeMap (* inferred types *) typeMap (* inferred types *)
(A:analysisResult) (* Daisy's encoded result *) (A:analysisResult) (* Flover's encoded result *)
(dVars:NatSet.t) (* defined variables *) (dVars:NatSet.t) (* defined variables *)
: bool := : bool :=
match f with match f with
|Let m x e g => |Let m x e g =>
match DaisyMap.find e A, DaisyMap.find (Var Q x) A with match FloverMap.find e A, FloverMap.find (Var Q x) A with
| Some (iv_e, err_e), Some (iv_x, err_x) => | Some (iv_e, err_e), Some (iv_x, err_x) =>
if ((validErrorbound e typeMap A dVars) && (Qeq_bool err_e err_x)) if ((validErrorbound e typeMap A dVars) && (Qeq_bool err_e err_x))
then validErrorboundCmd g typeMap A (NatSet.add x dVars) then validErrorboundCmd g typeMap A (NatSet.add x dVars)
...@@ -132,11 +132,11 @@ Arguments mTypeToQ _ :simpl nomatch. ...@@ -132,11 +132,11 @@ Arguments mTypeToQ _ :simpl nomatch.
**) **)
Lemma err_always_positive e tmap (A:analysisResult) dVars iv err: Lemma err_always_positive e tmap (A:analysisResult) dVars iv err:
validErrorbound e tmap A dVars = true -> validErrorbound e tmap A dVars = true ->
DaisyMap.find e A = Some (iv,err) -> FloverMap.find e A = Some (iv,err) ->
(0 <= Q2R err)%R. (0 <= Q2R err)%R.
Proof. Proof.
destruct e; cbn; intros; destruct e; cbn; intros;
Daisy_compute; canonize_hyps; Flover_compute; canonize_hyps;
auto. auto.
Qed. Qed.
...@@ -163,7 +163,7 @@ Lemma validErrorboundCorrectVariable_eval E1 E2 A (v:nat) e nR nlo nhi P fVars ...@@ -163,7 +163,7 @@ Lemma validErrorboundCorrectVariable_eval E1 E2 A (v:nat) e nR nlo nhi P fVars
dVars_range_valid dVars E1 A -> dVars_range_valid dVars E1 A ->
fVars_P_sound fVars E1 P -> fVars_P_sound fVars E1 P ->
vars_typed (NatSet.union fVars dVars) Gamma -> vars_typed (NatSet.union fVars dVars) Gamma ->
DaisyMap.find (Var Q v) A = Some ((nlo, nhi), e) -> FloverMap.find (Var Q v) A = Some ((nlo, nhi), e) ->
exists nF m, exists nF m,
eval_exp E2 Gamma (toRExp (Var Q v)) nF m. eval_exp E2 Gamma (toRExp (Var Q v)) nF m.
Proof. Proof.
...@@ -174,7 +174,7 @@ Proof. ...@@ -174,7 +174,7 @@ Proof.
pose proof (meps_0_deterministic _ eval_real eval_real2). subst. pose proof (meps_0_deterministic _ eval_real eval_real2). subst.
cbn in *. cbn in *.
inversion eval_real; subst. inversion eval_real; subst.
Daisy_compute; type_conv. Flover_compute; type_conv.
destruct (approxEnv_gives_value approxCEnv H1); try eauto. destruct (approxEnv_gives_value approxCEnv H1); try eauto.
set_tac. set_tac.
case_eq (NatSet.mem v dVars); intros v_case; set_tac. case_eq (NatSet.mem v dVars); intros v_case; set_tac.
...@@ -194,7 +194,7 @@ Lemma validErrorboundCorrectVariable: ...@@ -194,7 +194,7 @@ Lemma validErrorboundCorrectVariable:
dVars_range_valid dVars E1 A -> dVars_range_valid dVars E1 A ->
fVars_P_sound fVars E1 P -> fVars_P_sound fVars E1 P ->
vars_typed (NatSet.union fVars dVars) Gamma -> vars_typed (NatSet.union fVars dVars) Gamma ->
DaisyMap.find (Var Q v) A = Some ((nlo, nhi), e) -> FloverMap.find (Var Q v) A = Some ((nlo, nhi), e) ->
(Rabs (nR - nF) <= (Q2R e))%R. (Rabs (nR - nF) <= (Q2R e))%R.
Proof. Proof.
intros * eval_real eval_float typing_ok approxCEnv bounds_valid error_valid intros * eval_real eval_float typing_ok approxCEnv bounds_valid error_valid
...@@ -202,7 +202,7 @@ Proof. ...@@ -202,7 +202,7 @@ Proof.
eapply validIntervalbounds_sound in bounds_valid; eauto. eapply validIntervalbounds_sound in bounds_valid; eauto.
destruct_smart [find_v [eval_real2 bounds_valid]] bounds_valid. destruct_smart [find_v [eval_real2 bounds_valid]] bounds_valid.
pose proof (meps_0_deterministic _ eval_real eval_real2); subst. pose proof (meps_0_deterministic _ eval_real eval_real2); subst.
cbn in *; Daisy_compute; type_conv. cbn in *; Flover_compute; type_conv.
inversion eval_real; inversion eval_real;
inversion eval_float; inversion eval_float;
subst. subst.
...@@ -250,11 +250,11 @@ Lemma validErrorboundCorrectConstant E1 E2 A m n nR nF e nlo nhi dVars Gamma def ...@@ -250,11 +250,11 @@ Lemma validErrorboundCorrectConstant E1 E2 A m n nR nF e nlo nhi dVars Gamma def
typeCheck (Const m n) defVars Gamma = true -> typeCheck (Const m n) defVars Gamma = true ->
validErrorbound (Const m n) Gamma A dVars = true -> validErrorbound (Const m n) Gamma A dVars = true ->
(Q2R nlo <= nR <= Q2R nhi)%R -> (Q2R nlo <= nR <= Q2R nhi)%R ->
DaisyMap.find (Const m n) A = Some ((nlo,nhi),e) -> FloverMap.find (Const m n) A = Some ((nlo,nhi),e) ->
(Rabs (nR - nF) <= (Q2R e))%R. (Rabs (nR - nF) <= (Q2R e))%R.