lean4-htt/library/init/bool.lean
Leonardo de Moura 792040b1a5 feat(library/init/bool): mark bor, band and cond as inline
The idea is to get short-circuit evaluation for Boolean operators.
2016-06-05 13:03:33 -07:00

23 lines
612 B
Text

-- Copyright (c) 2014 Microsoft Corporation. All rights reserved.
-- Released under Apache 2.0 license as described in the file LICENSE.
-- Author: Leonardo de Moura
prelude
import init.datatypes init.reserved_notation
namespace bool
inline definition cond {A : Type} (b : bool) (t e : A) :=
bool.rec_on b e t
inline definition bor (a b : bool) :=
bool.rec_on a (bool.rec_on b ff tt) tt
notation a || b := bor a b
inline definition band (a b : bool) :=
bool.rec_on a ff (bool.rec_on b ff tt)
notation a && b := band a b
inline definition bnot (a : bool) :=
bool.rec_on a tt ff
end bool