Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More interesting example for cyclic list #125

Merged
merged 2 commits into from
Oct 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion example_typed_store.v
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,33 @@
over.
by rewrite crungetnew // -(bindskipf (_ >>= _)) crunnewget // crunskip.
Qed.

Definition tl (T : ml_type) (param : coq_type (ml_rlist T))
: M (coq_type (ml_rlist T)) :=
match param with
| Nil => Ret (Nil (coq_type T) T)
| Cons _ t => cget t
end.

Lemma hd_tl_tl_is_true :
crun (do l <- cycle ml_bool true false; do l1 <- tl _ l; do l2 <- tl _ l1;
Ret (hd ml_bool false l2)) = Some true.
Proof.
rewrite bindA -cnewchk.
under eq_bind => r1.
under eq_bind do rewrite !bindA.
under eq_bind do under eq_bind do rewrite !(bindA,bindretf) /=.
under cchknewE do rewrite -bindA cputgetC //.
rewrite cnewget /=.
under eq_bind do under eq_bind do rewrite cputget /=.
rewrite -bindA.
over.
rewrite cnewchk -bindA crunret // -bindA_uncurry /= crungetput // bindA.
under eq_bind do rewrite !bindA.
under eq_bind do under eq_bind do rewrite bindretf /=.
by rewrite crungetnew // -(bindskipf (_ >>= _)) crunnewget // crunskip.
Qed.

End cyclic.

Section factorial.
Expand Down Expand Up @@ -549,7 +576,7 @@
End fact_for_int63.

Section eval.
Require Import typed_store_model.

Check warning on line 579 in example_typed_store.v

View workflow job for this annotation

GitHub Actions / build (mathcomp/mathcomp:1.16.0-coq-8.16)

Use of “Require” inside a section is fragile. It is not recommended

Check warning on line 579 in example_typed_store.v

View workflow job for this annotation

GitHub Actions / build (mathcomp/mathcomp:1.16.0-coq-8.16)

Use of “Require” inside a module is fragile. It is not recommended

Check warning on line 579 in example_typed_store.v

View workflow job for this annotation

GitHub Actions / build (mathcomp/mathcomp:1.16.0-coq-8.17)

Use of “Require” inside a section is fragile. It is not recommended

Check warning on line 579 in example_typed_store.v

View workflow job for this annotation

GitHub Actions / build (mathcomp/mathcomp:1.16.0-coq-8.17)

Use of “Require” inside a module is fragile. It is not recommended

Check warning on line 579 in example_typed_store.v

View workflow job for this annotation

GitHub Actions / build (mathcomp/mathcomp:1.17.0-coq-8.16)

Use of “Require” inside a section is fragile. It is not recommended

Check warning on line 579 in example_typed_store.v

View workflow job for this annotation

GitHub Actions / build (mathcomp/mathcomp:1.17.0-coq-8.16)

Use of “Require” inside a module is fragile. It is not recommended

Check warning on line 579 in example_typed_store.v

View workflow job for this annotation

GitHub Actions / build (mathcomp/mathcomp:1.17.0-coq-8.17)

Use of “Require” inside a section is fragile. It is not recommended

Check warning on line 579 in example_typed_store.v

View workflow job for this annotation

GitHub Actions / build (mathcomp/mathcomp:1.17.0-coq-8.17)

Use of “Require” inside a module is fragile. It is not recommended

Definition M := [the typedStoreMonad ml_type monad_model.locT_nat of
acto ml_type].
Expand All @@ -562,7 +589,7 @@

Local Open Scope do_notation.
Local Notation mkloc := (mkloc (locT:=monad_model.locT_nat)).
Local Notation coq_type := (coq_type _).
Local Notation coq_type := (coq_type M).

Definition incr (l : loc ml_int) : M int :=
do x <- cget l; do _ <- cput l (Uint63.succ x); Ret (Uint63.succ x).
Expand Down
Loading