From f3222ba206013c2486dfd122b6452c67bdff1cac Mon Sep 17 00:00:00 2001 From: Robbert Krebbers <mail@robbertkrebbers.nl> Date: Fri, 28 Oct 2016 10:15:39 +0200 Subject: [PATCH] Turn short-circuit && and || into definitions. Otherwise, some ifs are being pretty printed as || or &&. --- heap_lang/notation.v | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/heap_lang/notation.v b/heap_lang/notation.v index 600cca0a3..88a8d50b9 100644 --- a/heap_lang/notation.v +++ b/heap_lang/notation.v @@ -85,8 +85,11 @@ Notation "e1 ;; e2" := (LamV BAnon e2%E e1%E) (at level 100, e2 at level 200, format "e1 ;; e2") : val_scope. (* Shortcircuit Boolean connectives *) -Notation "e1 && e2" := (If e1%E e2%E (Lit (LitBool false))) : expr_scope. -Notation "e1 || e2" := (If e1%E (Lit (LitBool true)) e2%E) : expr_scope. +Definition AND (e1 e2 : expr) : expr := if: e1 then e2 else #false. +Notation "e1 && e2" := (AND e1%E e2%E) : expr_scope. + +Definition OR (e1 e2 : expr) : expr := if: e1 then #true else e2. +Notation "e1 || e2" := (OR e1%E e2%E) : expr_scope. (** Notations for option *) Notation NONE := (InjL #()). -- GitLab