Commit fc30b638 authored by ='s avatar =
Browse files

Cleaning a few Coq files

parent ef97348d
...@@ -13,9 +13,8 @@ expression may yield different values for different machine epsilons ...@@ -13,9 +13,8 @@ expression may yield different values for different machine epsilons
(or environments that already only approximate each other) (or environments that already only approximate each other)
**) **)
Inductive approxEnv : env -> (nat -> option mType) -> analysisResult -> NatSet.t -> NatSet.t -> env -> Prop := Inductive approxEnv : env -> (nat -> option mType) -> analysisResult -> NatSet.t -> NatSet.t -> env -> Prop :=
|approxRefl A: |approxRefl defVars A:
(* TODO: this is weird. why not start with defVars?*) approxEnv emptyEnv defVars A NatSet.empty NatSet.empty emptyEnv
approxEnv emptyEnv (fun n => None) A NatSet.empty NatSet.empty emptyEnv
|approxUpdFree E1 E2 defVars A v1 v2 x fVars dVars m: |approxUpdFree E1 E2 defVars A v1 v2 x fVars dVars m:
approxEnv E1 defVars A fVars dVars E2 -> approxEnv E1 defVars A fVars dVars E2 ->
defVars x = Some m -> defVars x = Some m ->
......
...@@ -7,8 +7,8 @@ Require Import Coq.Reals.Reals Coq.micromega.Psatz Coq.QArith.QArith Coq.QArith. ...@@ -7,8 +7,8 @@ Require Import Coq.Reals.Reals Coq.micromega.Psatz Coq.QArith.QArith Coq.QArith.
Require Import Daisy.Infra.Abbrevs Daisy.Infra.RationalSimps Daisy.Infra.RealSimps Daisy.Infra.RealRationalProps. Require Import Daisy.Infra.Abbrevs Daisy.Infra.RationalSimps Daisy.Infra.RealSimps Daisy.Infra.RealRationalProps.
Require Import Daisy.Environments Daisy.Infra.ExpressionAbbrevs. Require Import Daisy.Environments Daisy.Infra.ExpressionAbbrevs.
(* TODO: absenv not used *)
Lemma const_abs_err_bounded (n:R) (nR:R) (nF:R) (E1 E2:env) (absenv:analysisResult) (m:mType) defVars: Lemma const_abs_err_bounded (n:R) (nR:R) (nF:R) (E1 E2:env) (m:mType) defVars:
eval_exp E1 (toREvalVars defVars) (Const M0 n) nR M0 -> eval_exp E1 (toREvalVars defVars) (Const M0 n) nR M0 ->
eval_exp E2 defVars (Const m n) nF m -> eval_exp E2 defVars (Const m n) nF m ->
(Rabs (nR - nF) <= Rabs n * (Q2R (meps m)))%R. (Rabs (nR - nF) <= Rabs n * (Q2R (meps m)))%R.
...@@ -51,7 +51,9 @@ Lemma add_abs_err_bounded (e1:exp Q) (e1R:R) (e1F:R) (e2:exp Q) (e2R:R) (e2F:R) ...@@ -51,7 +51,9 @@ Lemma add_abs_err_bounded (e1:exp Q) (e1R:R) (e1F:R) (e2:exp Q) (e2R:R) (e2F:R)
eval_exp E1 (toREvalVars defVars) (toREval (toRExp e2)) e2R M0 -> eval_exp E1 (toREvalVars defVars) (toREval (toRExp e2)) e2R M0 ->
eval_exp E2 defVars (toRExp e2) e2F m2 -> eval_exp E2 defVars (toRExp e2) e2F m2 ->
eval_exp E1 (toREvalVars defVars) (toREval (Binop Plus (toRExp e1) (toRExp e2))) vR M0 -> eval_exp E1 (toREvalVars defVars) (toREval (Binop Plus (toRExp e1) (toRExp e2))) vR M0 ->
eval_exp (updEnv 2 e2F (updEnv 1 e1F emptyEnv)) (fun n => if (n =? 2) then Some m2 else if (n =? 1) then Some m1 else defVars n) (Binop Plus (Var R 1) (Var R 2)) vF m-> eval_exp (updEnv 2 e2F (updEnv 1 e1F emptyEnv))
(updDefVars 2 m2 (updDefVars 1 m1 defVars))
(Binop Plus (Var R 1) (Var R 2)) vF m ->
(Rabs (e1R - e1F) <= Q2R err1)%R -> (Rabs (e1R - e1F) <= Q2R err1)%R ->
(Rabs (e2R - e2F) <= Q2R err2)%R -> (Rabs (e2R - e2F) <= Q2R err2)%R ->
(Rabs (vR - vF) <= Q2R err1 + Q2R err2 + (Rabs (e1F + e2F) * (Q2R (meps m))))%R. (Rabs (vR - vF) <= Q2R err1 + Q2R err2 + (Rabs (e1F + e2F) * (Q2R (meps m))))%R.
...@@ -116,7 +118,9 @@ Lemma subtract_abs_err_bounded (e1:exp Q) (e1R:R) (e1F:R) (e2:exp Q) (e2R:R) ...@@ -116,7 +118,9 @@ Lemma subtract_abs_err_bounded (e1:exp Q) (e1R:R) (e1F:R) (e2:exp Q) (e2R:R)
eval_exp E1 (toREvalVars defVars) (toREval (toRExp e2)) e2R M0 -> eval_exp E1 (toREvalVars defVars) (toREval (toRExp e2)) e2R M0 ->
eval_exp E2 defVars (toRExp e2) e2F m2 -> eval_exp E2 defVars (toRExp e2) e2F m2 ->
eval_exp E1 (toREvalVars defVars) (toREval (Binop Sub (toRExp e1) (toRExp e2))) vR M0 -> eval_exp E1 (toREvalVars defVars) (toREval (Binop Sub (toRExp e1) (toRExp e2))) vR M0 ->
eval_exp (updEnv 2 e2F (updEnv 1 e1F emptyEnv)) (fun n => if (n =? 2) then Some m2 else if (n =? 1) then Some m1 else defVars n) (Binop Sub (Var R 1) (Var R 2)) vF m -> eval_exp (updEnv 2 e2F (updEnv 1 e1F emptyEnv))
(updDefVars 2 m2 (updDefVars 1 m1 defVars))
(Binop Sub (Var R 1) (Var R 2)) vF m ->
(Rabs (e1R - e1F) <= Q2R err1)%R -> (Rabs (e1R - e1F) <= Q2R err1)%R ->
(Rabs (e2R - e2F) <= Q2R err2)%R -> (Rabs (e2R - e2F) <= Q2R err2)%R ->
(Rabs (vR - vF) <= Q2R err1 + Q2R err2 + ((Rabs (e1F - e2F)) * (Q2R (meps m))))%R. (Rabs (vR - vF) <= Q2R err1 + Q2R err2 + ((Rabs (e1F - e2F)) * (Q2R (meps m))))%R.
...@@ -175,7 +179,9 @@ Lemma mult_abs_err_bounded (e1:exp Q) (e1R:R) (e1F:R) (e2:exp Q) (e2R:R) (e2F:R) ...@@ -175,7 +179,9 @@ Lemma mult_abs_err_bounded (e1:exp Q) (e1R:R) (e1F:R) (e2:exp Q) (e2R:R) (e2F:R)
eval_exp E1 (toREvalVars defVars) (toREval (toRExp e2)) e2R M0 -> eval_exp E1 (toREvalVars defVars) (toREval (toRExp e2)) e2R M0 ->
eval_exp E2 defVars (toRExp e2) e2F m2 -> eval_exp E2 defVars (toRExp e2) e2F m2 ->
eval_exp E1 (toREvalVars defVars) (toREval (Binop Mult (toRExp e1) (toRExp e2))) vR M0 -> eval_exp E1 (toREvalVars defVars) (toREval (Binop Mult (toRExp e1) (toRExp e2))) vR M0 ->
eval_exp (updEnv 2 e2F (updEnv 1 e1F emptyEnv)) (fun n => if (n =? 2) then Some m2 else if (n =? 1) then Some m1 else defVars n) (Binop Mult (Var R 1) (Var R 2)) vF m-> eval_exp (updEnv 2 e2F (updEnv 1 e1F emptyEnv))
(updDefVars 2 m2 (updDefVars 1 m1 defVars))
(Binop Mult (Var R 1) (Var R 2)) vF m ->
(Rabs (vR - vF) <= Rabs (e1R * e2R - e1F * e2F) + Rabs (e1F * e2F) * (Q2R (meps m)))%R. (Rabs (vR - vF) <= Rabs (e1R * e2R - e1F * e2F) + Rabs (e1F * e2F) * (Q2R (meps m)))%R.
Proof. Proof.
intros e1_real e1_float e2_real e2_float mult_real mult_float. intros e1_real e1_float e2_real e2_float mult_real mult_float.
...@@ -224,7 +230,9 @@ Lemma div_abs_err_bounded (e1:exp Q) (e1R:R) (e1F:R) (e2:exp Q) (e2R:R) (e2F:R) ...@@ -224,7 +230,9 @@ Lemma div_abs_err_bounded (e1:exp Q) (e1R:R) (e1F:R) (e2:exp Q) (e2R:R) (e2F:R)
eval_exp E1 (toREvalVars defVars) (toREval (toRExp e2)) e2R M0 -> eval_exp E1 (toREvalVars defVars) (toREval (toRExp e2)) e2R M0 ->
eval_exp E2 defVars (toRExp e2) e2F m2 -> eval_exp E2 defVars (toRExp e2) e2F m2 ->
eval_exp E1 (toREvalVars defVars) (toREval (Binop Div (toRExp e1) (toRExp e2))) vR M0 -> eval_exp E1 (toREvalVars defVars) (toREval (Binop Div (toRExp e1) (toRExp e2))) vR M0 ->
eval_exp (updEnv 2 e2F (updEnv 1 e1F emptyEnv)) (fun n => if (n =? 2) then Some m2 else if (n =? 1) then Some m1 else defVars n) (Binop Div (Var R 1) (Var R 2)) vF m -> eval_exp (updEnv 2 e2F (updEnv 1 e1F emptyEnv))
(updDefVars 2 m2 (updDefVars 1 m1 defVars))
(Binop Div (Var R 1) (Var R 2)) vF m ->
(Rabs (vR - vF) <= Rabs (e1R / e2R - e1F / e2F) + Rabs (e1F / e2F) * (Q2R (meps m)))%R. (Rabs (vR - vF) <= Rabs (e1R / e2R - e1F / e2F) + Rabs (e1F / e2F) * (Q2R (meps m)))%R.
Proof. Proof.
intros e1_real e1_float e2_real e2_float div_real div_float. intros e1_real e1_float e2_real e2_float div_real div_float.
...@@ -446,7 +454,9 @@ Qed. ...@@ -446,7 +454,9 @@ Qed.
Lemma round_abs_err_bounded (e:exp R) (nR nF1 nF:R) (E1 E2: env) (err:R) (machineEpsilon m:mType) defVars: Lemma round_abs_err_bounded (e:exp R) (nR nF1 nF:R) (E1 E2: env) (err:R) (machineEpsilon m:mType) defVars:
eval_exp E1 (toREvalVars defVars) (toREval e) nR M0 -> eval_exp E1 (toREvalVars defVars) (toREval e) nR M0 ->
eval_exp E2 defVars e nF1 m -> eval_exp E2 defVars e nF1 m ->
eval_exp (updEnv 1 nF1 emptyEnv) (fun n => if n =? 1 then Some m else defVars n) (toRExp (Downcast machineEpsilon (Var Q 1))) nF machineEpsilon-> eval_exp (updEnv 1 nF1 emptyEnv)
(updDefVars 1 m defVars)
(toRExp (Downcast machineEpsilon (Var Q 1))) nF machineEpsilon->
(Rabs (nR - nF1) <= err)%R -> (Rabs (nR - nF1) <= err)%R ->
(Rabs (nR - nF) <= err + (Rabs nF1) * Q2R (meps machineEpsilon))%R. (Rabs (nR - nF) <= err + (Rabs nF1) * Q2R (meps machineEpsilon))%R.
Proof. Proof.
......
...@@ -27,11 +27,11 @@ Fixpoint validErrorbound (e:exp Q) (typeMap:exp Q -> option mType) (absenv:analy ...@@ -27,11 +27,11 @@ Fixpoint validErrorbound (e:exp Q) (typeMap:exp Q -> option mType) (absenv:analy
else (Qleb (maxAbs intv * (meps m)) err) else (Qleb (maxAbs intv * (meps m)) err)
|Const _ n => |Const _ n =>
Qleb (maxAbs intv * (meps m)) err Qleb (maxAbs intv * (meps m)) err
|Unop Neg e => |Unop Neg e1 =>
if (validErrorbound e typeMap absenv dVars) if (validErrorbound e1 typeMap absenv dVars)
then Qeq_bool err (snd (absenv e)) then Qeq_bool err (snd (absenv e1))
else false else false
|Unop Inv e => false |Unop Inv e1 => false
|Binop b e1 e2 => |Binop b e1 e2 =>
if ((validErrorbound e1 typeMap absenv dVars) && (validErrorbound e2 typeMap absenv dVars)) if ((validErrorbound e1 typeMap absenv dVars) && (validErrorbound e2 typeMap absenv dVars))
then then
...@@ -167,7 +167,7 @@ Proof. ...@@ -167,7 +167,7 @@ Proof.
rewrite H,H5 in typing_ok; apply EquivEqBoolEq in typing_ok; subst. rewrite H,H5 in typing_ok; apply EquivEqBoolEq in typing_ok; subst.
clear H5 H3. clear H5 H3.
apply Rmult_le_compat_r. apply Rmult_le_compat_r.
{ apply inj_eps_posR. } { apply meps_posR. }
{ rewrite <- maxAbs_impl_RmaxAbs. { rewrite <- maxAbs_impl_RmaxAbs.
apply contained_leq_maxAbs. apply contained_leq_maxAbs.
unfold contained; simpl. unfold contained; simpl.
...@@ -298,7 +298,7 @@ Proof. ...@@ -298,7 +298,7 @@ Proof.
destruct intv_valid. destruct intv_valid.
eapply Rle_trans. eapply Rle_trans.
- eapply Rmult_le_compat_r. - eapply Rmult_le_compat_r.
apply inj_eps_posR. apply meps_posR.
apply RmaxAbs; eauto. apply RmaxAbs; eauto.
- rewrite Q2R_mult in error_valid. - rewrite Q2R_mult in error_valid.
rewrite <- maxAbs_impl_RmaxAbs in error_valid; auto. rewrite <- maxAbs_impl_RmaxAbs in error_valid; auto.
...@@ -316,7 +316,7 @@ Lemma validErrorboundCorrectAddition E1 E2 absenv ...@@ -316,7 +316,7 @@ Lemma validErrorboundCorrectAddition E1 E2 absenv
eval_exp E2 defVars (toRExp e1) nF1 m1 -> eval_exp E2 defVars (toRExp e1) nF1 m1 ->
eval_exp E2 defVars (toRExp e2) nF2 m2 -> eval_exp E2 defVars (toRExp e2) nF2 m2 ->
eval_exp (updEnv 2 nF2 (updEnv 1 nF1 emptyEnv)) eval_exp (updEnv 2 nF2 (updEnv 1 nF1 emptyEnv))
(fun n => if (n =? 2) then Some m2 else if (n =? 1) then Some m1 else defVars n) (updDefVars 2 m2 (updDefVars 1 m1 defVars))
(toRExp (Binop Plus (Var Q 1) (Var Q 2))) nF m -> (toRExp (Binop Plus (Var Q 1) (Var Q 2))) nF m ->
typeCheck (Binop Plus e1 e2) defVars Gamma = true -> typeCheck (Binop Plus e1 e2) defVars Gamma = true ->
validErrorbound (Binop Plus e1 e2) Gamma absenv dVars = true -> validErrorbound (Binop Plus e1 e2) Gamma absenv dVars = true ->
...@@ -353,7 +353,7 @@ Proof. ...@@ -353,7 +353,7 @@ Proof.
eapply Rle_trans. eapply Rle_trans.
apply Rplus_le_compat_l. apply Rplus_le_compat_l.
eapply Rmult_le_compat_r. eapply Rmult_le_compat_r.
apply inj_eps_posR. apply meps_posR.
Focus 2. Focus 2.
rewrite Qle_bool_iff in valid_error. rewrite Qle_bool_iff in valid_error.
apply Qle_Rle in valid_error. apply Qle_Rle in valid_error.
...@@ -400,7 +400,7 @@ Lemma validErrorboundCorrectSubtraction E1 E2 absenv ...@@ -400,7 +400,7 @@ Lemma validErrorboundCorrectSubtraction E1 E2 absenv
eval_exp E2 defVars (toRExp e1) nF1 m1-> eval_exp E2 defVars (toRExp e1) nF1 m1->
eval_exp E2 defVars (toRExp e2) nF2 m2 -> eval_exp E2 defVars (toRExp e2) nF2 m2 ->
eval_exp (updEnv 2 nF2 (updEnv 1 nF1 emptyEnv)) eval_exp (updEnv 2 nF2 (updEnv 1 nF1 emptyEnv))
(fun n => if (n =? 2) then Some m2 else if (n =? 1) then Some m1 else defVars n) (updDefVars 2 m2 (updDefVars 1 m1 defVars))
(toRExp (Binop Sub (Var Q 1) (Var Q 2))) nF m -> (toRExp (Binop Sub (Var Q 1) (Var Q 2))) nF m ->
typeCheck (Binop Sub e1 e2) defVars Gamma = true -> typeCheck (Binop Sub e1 e2) defVars Gamma = true ->
validErrorbound (Binop Sub e1 e2) Gamma absenv dVars = true -> validErrorbound (Binop Sub e1 e2) Gamma absenv dVars = true ->
...@@ -443,7 +443,7 @@ Proof. ...@@ -443,7 +443,7 @@ Proof.
eapply Rle_trans. eapply Rle_trans.
apply Rplus_le_compat_l. apply Rplus_le_compat_l.
eapply Rmult_le_compat_r. eapply Rmult_le_compat_r.
apply inj_eps_posR. apply meps_posR.
Focus 2. Focus 2.
apply valid_error. apply valid_error.
remember (subtractIntv (widenIntv (e1lo, e1hi) err1) (widenIntv (e2lo, e2hi) err2)) as iv. remember (subtractIntv (widenIntv (e1lo, e1hi) err1) (widenIntv (e2lo, e2hi) err2)) as iv.
...@@ -487,7 +487,7 @@ Lemma validErrorboundCorrectMult E1 E2 absenv ...@@ -487,7 +487,7 @@ Lemma validErrorboundCorrectMult E1 E2 absenv
eval_exp E2 defVars (toRExp e1) nF1 m1 -> eval_exp E2 defVars (toRExp e1) nF1 m1 ->
eval_exp E2 defVars (toRExp e2) nF2 m2 -> eval_exp E2 defVars (toRExp e2) nF2 m2 ->
eval_exp (updEnv 2 nF2 (updEnv 1 nF1 emptyEnv)) eval_exp (updEnv 2 nF2 (updEnv 1 nF1 emptyEnv))
(fun n => if (n =? 2) then Some m2 else if (n =? 1) then Some m1 else defVars n) (updDefVars 2 m2 (updDefVars 1 m1 defVars))
(toRExp (Binop Mult (Var Q 1) (Var Q 2))) nF m -> (toRExp (Binop Mult (Var Q 1) (Var Q 2))) nF m ->
typeCheck (Binop Mult e1 e2) defVars Gamma = true -> typeCheck (Binop Mult e1 e2) defVars Gamma = true ->
validErrorbound (Binop Mult e1 e2) Gamma absenv dVars = true -> validErrorbound (Binop Mult e1 e2) Gamma absenv dVars = true ->
...@@ -1005,7 +1005,7 @@ Proof. ...@@ -1005,7 +1005,7 @@ Proof.
destruct H4. destruct H4.
unfold RmaxAbsFun. unfold RmaxAbsFun.
apply Rmult_le_compat_r. apply Rmult_le_compat_r.
apply inj_eps_posR. apply meps_posR.
apply RmaxAbs; subst; simpl in *. apply RmaxAbs; subst; simpl in *.
+ rewrite Q2R_min4. + rewrite Q2R_min4.
repeat rewrite Q2R_mult; repeat rewrite Q2R_mult;
...@@ -1027,7 +1027,7 @@ Lemma validErrorboundCorrectDiv E1 E2 absenv ...@@ -1027,7 +1027,7 @@ Lemma validErrorboundCorrectDiv E1 E2 absenv
eval_exp E2 defVars (toRExp e1) nF1 m1 -> eval_exp E2 defVars (toRExp e1) nF1 m1 ->
eval_exp E2 defVars (toRExp e2) nF2 m2 -> eval_exp E2 defVars (toRExp e2) nF2 m2 ->
eval_exp (updEnv 2 nF2 (updEnv 1 nF1 emptyEnv)) eval_exp (updEnv 2 nF2 (updEnv 1 nF1 emptyEnv))
(fun n => if (n =? 2) then Some m2 else if (n =? 1) then Some m1 else defVars n) (updDefVars 2 m2 (updDefVars 1 m1 defVars))
(toRExp (Binop Div (Var Q 1) (Var Q 2))) nF m -> (toRExp (Binop Div (Var Q 1) (Var Q 2))) nF m ->
typeCheck (Binop Div e1 e2) defVars Gamma = true -> typeCheck (Binop Div e1 e2) defVars Gamma = true ->
validErrorbound (Binop Div e1 e2) Gamma absenv dVars = true -> validErrorbound (Binop Div e1 e2) Gamma absenv dVars = true ->
...@@ -1905,7 +1905,7 @@ Proof. ...@@ -1905,7 +1905,7 @@ Proof.
{ destruct valid_div_float. { destruct valid_div_float.
unfold RmaxAbsFun. unfold RmaxAbsFun.
apply Rmult_le_compat_r. apply Rmult_le_compat_r.
apply inj_eps_posR. apply meps_posR.
rewrite <- maxAbs_impl_RmaxAbs. rewrite <- maxAbs_impl_RmaxAbs.
unfold RmaxAbsFun. unfold RmaxAbsFun.
apply RmaxAbs; subst; simpl in *. apply RmaxAbs; subst; simpl in *.
...@@ -1952,7 +1952,9 @@ Qed. ...@@ -1952,7 +1952,9 @@ Qed.
Lemma validErrorboundCorrectRounding E1 E2 absenv (e: exp Q) (nR nF nF1: R) (err err':error) (elo ehi alo ahi: Q) dVars (m: mType) (machineEpsilon:mType) Gamma defVars: Lemma validErrorboundCorrectRounding E1 E2 absenv (e: exp Q) (nR nF nF1: R) (err err':error) (elo ehi alo ahi: Q) dVars (m: mType) (machineEpsilon:mType) Gamma defVars:
eval_exp E1 (toREvalVars defVars) (toREval (toRExp e)) nR M0 -> eval_exp E1 (toREvalVars defVars) (toREval (toRExp e)) nR M0 ->
eval_exp E2 defVars (toRExp e) nF1 m -> eval_exp E2 defVars (toRExp e) nF1 m ->
eval_exp (updEnv 1 nF1 emptyEnv) (fun n => if n =? 1 then Some m else defVars n) (toRExp (Downcast machineEpsilon (Var Q 1))) nF machineEpsilon -> eval_exp (updEnv 1 nF1 emptyEnv)
(updDefVars 1 m defVars)
(toRExp (Downcast machineEpsilon (Var Q 1))) nF machineEpsilon ->
typeCheck (Downcast machineEpsilon e) defVars Gamma = true -> typeCheck (Downcast machineEpsilon e) defVars Gamma = true ->
validErrorbound (Downcast machineEpsilon e) Gamma absenv dVars = true -> validErrorbound (Downcast machineEpsilon e) Gamma absenv dVars = true ->
(Q2R elo <= nR <= Q2R ehi)%R -> (Q2R elo <= nR <= Q2R ehi)%R ->
...@@ -1983,7 +1985,7 @@ Proof. ...@@ -1983,7 +1985,7 @@ Proof.
apply Rmult_le_compat_r. apply Rmult_le_compat_r.
* rewrite <- Q2R0_is_0. * rewrite <- Q2R0_is_0.
apply Qle_Rle. apply Qle_Rle.
apply inj_eps_pos. apply meps_pos.
* remember (widenIntv (elo, ehi) err) as iv_widen. * remember (widenIntv (elo, ehi) err) as iv_widen.
destruct iv_widen as [eloR ehiR]. destruct iv_widen as [eloR ehiR].
rewrite <- maxAbs_impl_RmaxAbs. rewrite <- maxAbs_impl_RmaxAbs.
......
...@@ -204,7 +204,11 @@ Fixpoint toREval (e:exp R) := ...@@ -204,7 +204,11 @@ Fixpoint toREval (e:exp R) :=
| Downcast _ e1 => (toREval e1) | Downcast _ e1 => (toREval e1)
end. end.
(* TODO: put to REValVars here? *) Fixpoint toREvalVars (d:nat -> option mType) (n:nat) :=
match d n with
| Some m => Some M0
| None => None
end.
(** (**
...@@ -333,20 +337,12 @@ Proof. ...@@ -333,20 +337,12 @@ Proof.
Qed. Qed.
Fixpoint toREvalVars (d:nat -> option mType) (n:nat) :=
match d n with
| Some m => Some M0
| None => None
end.
(** (**
Helping lemma. Needed in soundness proof. Helping lemma. Needed in soundness proof.
For each evaluation of using an arbitrary epsilon, we can replace it by For each evaluation of using an arbitrary epsilon, we can replace it by
evaluating the subexpressions and then binding the result values to different evaluating the subexpressions and then binding the result values to different
variables in the Environment. variables in the Environment.
**) **)
(* TODO: write updDefVars function as well *)
Lemma binary_unfolding b f1 f2 m E vF defVars: Lemma binary_unfolding b f1 f2 m E vF defVars:
eval_exp E defVars (Binop b f1 f2) vF m -> eval_exp E defVars (Binop b f1 f2) vF m ->
exists vF1 vF2 m1 m2, exists vF1 vF2 m1 m2,
...@@ -354,7 +350,7 @@ Lemma binary_unfolding b f1 f2 m E vF defVars: ...@@ -354,7 +350,7 @@ Lemma binary_unfolding b f1 f2 m E vF defVars:
eval_exp E defVars f1 vF1 m1 /\ eval_exp E defVars f1 vF1 m1 /\
eval_exp E defVars f2 vF2 m2 /\ eval_exp E defVars f2 vF2 m2 /\
eval_exp (updEnv 2 vF2 (updEnv 1 vF1 emptyEnv)) eval_exp (updEnv 2 vF2 (updEnv 1 vF1 emptyEnv))
(fun n => if (n =? 2) then Some m2 else if (n =? 1) then Some m1 else defVars n) (updDefVars 2 m2 (updDefVars 1 m1 defVars))
(Binop b (Var R 1) (Var R 2)) vF m. (Binop b (Var R 1) (Var R 2)) vF m.
Proof. Proof.
intros eval_float. intros eval_float.
......
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