diff --git a/heap_lang/notation.v b/heap_lang/notation.v index 7a266d155016d2e4a21fd079b8b0d4de1957f25a..fb7efc5da7459b83ee18e8513c2827bf67c22be5 100644 --- a/heap_lang/notation.v +++ b/heap_lang/notation.v @@ -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. diff --git a/heap_lang/tests.v b/heap_lang/tests.v index 8c1e941a01e9b958ff3df42c55f5370840e1c695..f99b3a4a611391d1aea96988edb4722e005f016b 100644 --- a/heap_lang/tests.v +++ b/heap_lang/tests.v @@ -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 //=.