Add unicode name for the types: Nat, Int and Real

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2013-09-04 09:03:41 -07:00
parent d41160f8a5
commit be7fa0932a
7 changed files with 42 additions and 34 deletions

View file

@ -11,11 +11,19 @@ Author: Leonardo de Moura
#include "environment.h"
namespace lean {
class num_type_value : public type_value {
name m_unicode;
public:
num_type_value(name const & n, name const & u):type_value(n), m_unicode(u) {}
virtual ~num_type_value() {}
virtual name get_unicode_name() const { return m_unicode; }
};
// =======================================
// Natural numbers
class nat_type_value : public type_value {
class nat_type_value : public num_type_value {
public:
nat_type_value():type_value("Nat") {}
nat_type_value():num_type_value("Nat", "\u2115") /* */ {}
};
expr const Nat = mk_value(*(new nat_type_value()));
expr mk_nat_type() { return Nat; }
@ -99,9 +107,9 @@ MK_CONSTANT(nat_id_fn, name({"Nat", "id"}));
// =======================================
// Integers
class int_type_value : public type_value {
class int_type_value : public num_type_value {
public:
int_type_value():type_value("Int") {}
int_type_value():num_type_value("Int", "\u2124") /* */ {}
};
expr const Int = mk_value(*(new int_type_value()));
expr mk_int_type() { return Int; }
@ -199,9 +207,9 @@ MK_CONSTANT(int_gt_fn, name({"Int", "gt"}));
// =======================================
// Reals
class real_type_value : public type_value {
class real_type_value : public num_type_value {
public:
real_type_value():type_value("Real") {}
real_type_value():num_type_value("Real", "\u211D") /* */ {}
};
expr const Real = mk_value(*(new real_type_value()));
expr mk_real_type() { return Real; }

View file

@ -1,11 +1,11 @@
Set: pp::colors
Set: pp::unicode
Nat
Nat
Int
-10
5
Int
Assumed: x
Assumed: n
Assumed: m

View file

@ -6,7 +6,7 @@
2
Assumed: y
if Int (0 ≤ -3 + y) (-3 + y) (-1 * (-3 + y))
if (0 ≤ -3 + y) (-3 + y) (-1 * (-3 + y))
| x + y | > x
Set: lean::pp::notation
Int::gt (Int::abs (Int::add x y)) x

View file

@ -1,30 +1,30 @@
Set: pp::colors
Set: pp::unicode
Assumed: f
∀ a : Int, (f a a) > 0
∀ a b : Int, (f a b) > 0
∀ a : , (f a a) > 0
∀ a b : , (f a b) > 0
Assumed: g
∀ (a : Int) (b : Real), (g a b) > 0
∀ a b : Int, (g a (f a b)) > 0
∀ (a : ) (b : ), (g a b) > 0
∀ a b : , (g a (f a b)) > 0
Set: lean::pp::coercion
∀ a b : Int, (g a (int_to_real (f a b))) > (nat_to_int 0)
λ a : Nat, a + 1
∀ a b : , (g a (int_to_real (f a b))) > (nat_to_int 0)
λ a : , a + 1
Error (line: 10, pos: 18) ambiguous overloads
Candidates:
Real::add : Real → Real → Real
Int::add : Int → Int → Int
Nat::add : Nat → Nat → Nat
Real::add :
Int::add :
Nat::add :
Arguments:
a : lift:0:2 ?M0
b : lift:0:1 ?M2
λ a b c : Int, a + c + b
λ a b c : , a + c + b
Error (line: 17, pos: 19) ambiguous overloads
Candidates:
Real::add : Real → Real → Real
Int::add : Int → Int → Int
Nat::add : Nat → Nat → Nat
Real::add :
Int::add :
Nat::add :
Arguments:
a : lift:0:2 ?M0
b : lift:0:1 ?M2
Assumed: x
λ a b : Int, a + x + b
λ a b : , a + x + b

View file

@ -2,11 +2,11 @@
Set: pp::unicode
Error (line: 1, pos: 10) application type mismatch, none of the overloads can be used
Candidates:
Real::add : Real → Real → Real
Int::add : Int → Int → Int
Nat::add : Nat → Nat → Nat
Real::add :
Int::add :
Nat::add :
Arguments:
1 : Nat
1 :
: Bool
Assumed: R
Assumed: T

View file

@ -1,7 +1,7 @@
Set: pp::colors
Set: pp::unicode
Int → Int → Int
Assumed: f
f 0
Int → Int
Int

View file

@ -3,5 +3,5 @@
Π (A : Type) (a : A), A
Assumed: g
Defined: f
f Nat 10
f Int (- 10)
f 10
f (- 10)