Skip to content
Snippets Groups Projects
Commit bfbc24d8 authored by Robbert Krebbers's avatar Robbert Krebbers
Browse files

Put Lit notations in global scope.

parent cee0b0d8
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,8 @@ Require Export heap_lang.derived.
Delimit Scope lang_scope with L.
Bind Scope lang_scope with expr val.
(* What about Arguments for hoare triples?. *)
Arguments wp {_ _} _ _%L _.
Coercion LitInt : Z >-> base_lit.
......@@ -16,10 +18,11 @@ Coercion of_val : val >-> expr.
first. *)
(* We have overlapping notation for values and expressions, with the expressions
coming first. This way, parsing as a value will be preferred. If an expression
was needed, the coercion of_val will be called. *)
(* What about Arguments for hoare triples?. *)
Notation "' l" := (Lit l) (at level 8, format "' l") : lang_scope.
Notation "' l" := (LitV l) (at level 8, format "' l") : lang_scope.
was needed, the coercion of_val will be called. The notations for literals
are not put in any scope so as to avoid lots of annoying %L scopes while
pretty printing. *)
Notation "' l" := (Lit l%Z) (at level 8, format "' l").
Notation "' l" := (LitV l%Z) (at level 8, format "' l").
Notation "! e" := (Load e%L) (at level 10, right associativity) : lang_scope.
Notation "'ref' e" := (Alloc e%L)
(at level 30, right associativity) : lang_scope.
......
......@@ -62,13 +62,12 @@ Module LiftingTests.
λ: "x", if "x" '0 then -FindPred (-"x" + '2) '0 else FindPred "x" '0.
Lemma FindPred_spec n1 n2 E Q :
( (n1 < n2) Q (LitV (n2 - 1))) wp E (FindPred 'n2 'n1)%L Q.
( (n1 < n2) Q '(n2 - 1)) wp E (FindPred 'n2 'n1)%L Q.
Proof.
(* FIXME there are some annoying scopes shown here: %Z, %L. *)
revert n1; apply löb_all_1=>n1.
rewrite (comm uPred_and ( _)%I) assoc; apply const_elim_r=>?.
(* first need to do the rec to get a later *)
rewrite -(wp_bindi (AppLCtx _)).
rewrite -(wp_bindi (AppLCtx _)) /=.
rewrite -wp_rec' // =>-/=; rewrite -wp_value' //=.
(* FIXME: ssr rewrite fails with "Error: _pattern_value_ is used in conclusion." *)
rewrite ->(later_intro (Q _)).
......@@ -106,8 +105,7 @@ Module LiftingTests.
Qed.
Goal E,
True wp (Σ:=Σ) E (let: "x" := Pred '42 in Pred "x")
(λ v, v = ('40)%L).
True wp (Σ:=Σ) E (let: "x" := Pred '42 in Pred "x") (λ v, v = '40).
Proof.
intros E.
rewrite -(wp_bindi (LetCtx _ _)) -Pred_spec //= -wp_let //=.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment