Commit 028a1353 authored by Joachim Bard's avatar Joachim Bard

more work on subdivchecker

parent d9364172
...@@ -133,46 +133,54 @@ Definition checkDimensionStep x (ivAcc: result (option intv)) P (* (ivNew: optio ...@@ -133,46 +133,54 @@ Definition checkDimensionStep x (ivAcc: result (option intv)) P (* (ivNew: optio
Definition checkDimension x iv Ps := Definition checkDimension x iv Ps :=
match fold_left (checkDimensionStep x) Ps (Succes None) with match fold_left (checkDimensionStep x) Ps (Succes None) with
| Succes (Some ivU) => isSupersetIntv iv ivU | Succes (Some ivU) => if isSupersetIntv iv ivU then Succes true else Fail _ "var not covered"
| _ => false
(*
| Succes None => Fail _ "no subdivisions given" | Succes None => Fail _ "no subdivisions given"
| Fail _ msg | FailDet msg _ => Fail _ msg | Fail _ msg | FailDet msg _ => Fail _ msg
*)
end. end.
Definition checkAllDimensionsStep Ps b (p: expr Q * intv) := Definition checkAllDimensionsStep Ps b (p: expr Q * intv) :=
match p with match p with
| (Var _ x, iv) => b && checkDimension x iv Ps | (Var _ x, iv) => resultBind b (fun _ => checkDimension x iv Ps) (* b && checkDimension x iv Ps *)
| _ => b | _ => b
end. end.
Definition checkAllDimensions P Ps := Definition checkAllDimensions P Ps :=
fold_left (checkAllDimensionsStep Ps) P true. fold_left (checkAllDimensionsStep Ps) P (Succes false).
Lemma checkAllDimensionsStep_fail_fp Ps P s :
fold_left (checkAllDimensionsStep Ps) P (Fail bool s) = Fail bool s.
Proof.
induction P as [|p P]; auto.
destruct p as [e iv]. destruct e; auto.
Qed.
Lemma checkAllDimensionsStep_faildet_fp Ps P s b :
fold_left (checkAllDimensionsStep Ps) P (FailDet s b) = FailDet s b.
Proof.
induction P as [|p P]; auto.
destruct p as [e iv]. destruct e; auto.
Qed.
Lemma in_subdivs_intv (Ps: list precondIntv) E (P: precondIntv) : Lemma in_subdivs_intv (Ps: list precondIntv) E (P: precondIntv) :
checkAllDimensions (FloverMap.elements P) Ps = true -> checkAllDimensions (FloverMap.elements P) Ps = Succes true ->
P_intv_sound E P -> P_intv_sound E P ->
exists P', In P' Ps /\ P_intv_sound E P'. exists P', In P' Ps /\ P_intv_sound E P'.
Proof. Proof.
intros chk H. intros chk H.
unfold P_intv_sound in H. unfold P_intv_sound in H.
induction (FloverMap.elements P). induction (FloverMap.elements P).
- admit. - cbn in chk. discriminate chk.
- cbn in chk. - cbn in chk.
assert (checkAllDimensionsStep Ps true a = true) as Heq by admit. destruct (checkAllDimensionsStep Ps (Succes false) a) eqn:Heq;
rewrite Heq in chk. try (rewrite ?checkAllDimensionsStep_fail_fp, ?checkAllDimensionsStep_faildet_fp in chk;
apply IHl; auto. discriminate chk).
intros x iv. destruct b.
intros ?. apply H. now right. + destruct a as [e iv].
(* destruct e; try discriminate Heq.
assert (a = (Var Q x, iv) \/ a <> (Var Q x, iv)) as CA by admit.
destruct CA as [? | Hneq].
+ subst.
cbn in Heq. cbn in Heq.
intros ?. apply H. now right. admit. (* this might not work *)
+ intros ?. apply H. now right. + apply IHl; auto.
*) intros x iv inl. apply H. now right.
Abort. Abort.
(* TODO: needs more assumptions, i.e. checker for precond *) (* TODO: needs more assumptions, i.e. checker for precond *)
......
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