lean2/library/standard/num.lean
Leonardo de Moura 105c29b51e refactor(library/standard): use new coding style, rename bool.b0 and bool.b1 to bool.ff and bool.tt
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-28 19:59:38 -07:00

23 lines
No EOL
822 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
import logic
namespace num
-- pos_num and num are two auxiliary datatypes used when parsing numerals such as 13, 0, 26.
-- The parser will generate the terms (pos (bit1 (bit1 (bit0 one)))), zero, and (pos (bit0 (bit1 (bit1 one)))).
-- This representation can be coerced in whatever we want (e.g., naturals, integers, reals, etc).
inductive pos_num : Type :=
| one : pos_num
| bit1 : pos_num → pos_num
| bit0 : pos_num → pos_num
inductive num : Type :=
| zero : num
| pos : pos_num → num
theorem inhabited_pos_num [instance] : inhabited pos_num :=
inhabited_intro one
theorem inhabited_num [instance] : inhabited num :=
inhabited_intro zero
end