From bfbc24d860f350d43d95b70493aafa06063f33cb Mon Sep 17 00:00:00 2001
From: Robbert Krebbers <mail@robbertkrebbers.nl>
Date: Fri, 12 Feb 2016 01:32:39 +0100
Subject: [PATCH] Put Lit notations in global scope.

---
 heap_lang/notation.v | 11 +++++++----
 heap_lang/tests.v    |  8 +++-----
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/heap_lang/notation.v b/heap_lang/notation.v
index 7a266d155..fb7efc5da 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 8c1e941a0..f99b3a4a6 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 //=.
-- 
GitLab