Add unicode name for the types: Nat, Int and Real
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
d41160f8a5
commit
be7fa0932a
7 changed files with 42 additions and 34 deletions
|
@ -11,11 +11,19 @@ Author: Leonardo de Moura
|
||||||
#include "environment.h"
|
#include "environment.h"
|
||||||
|
|
||||||
namespace lean {
|
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
|
// Natural numbers
|
||||||
class nat_type_value : public type_value {
|
class nat_type_value : public num_type_value {
|
||||||
public:
|
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 const Nat = mk_value(*(new nat_type_value()));
|
||||||
expr mk_nat_type() { return Nat; }
|
expr mk_nat_type() { return Nat; }
|
||||||
|
@ -99,9 +107,9 @@ MK_CONSTANT(nat_id_fn, name({"Nat", "id"}));
|
||||||
|
|
||||||
// =======================================
|
// =======================================
|
||||||
// Integers
|
// Integers
|
||||||
class int_type_value : public type_value {
|
class int_type_value : public num_type_value {
|
||||||
public:
|
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 const Int = mk_value(*(new int_type_value()));
|
||||||
expr mk_int_type() { return Int; }
|
expr mk_int_type() { return Int; }
|
||||||
|
@ -199,9 +207,9 @@ MK_CONSTANT(int_gt_fn, name({"Int", "gt"}));
|
||||||
|
|
||||||
// =======================================
|
// =======================================
|
||||||
// Reals
|
// Reals
|
||||||
class real_type_value : public type_value {
|
class real_type_value : public num_type_value {
|
||||||
public:
|
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 const Real = mk_value(*(new real_type_value()));
|
||||||
expr mk_real_type() { return Real; }
|
expr mk_real_type() { return Real; }
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
Set: pp::colors
|
Set: pp::colors
|
||||||
Set: pp::unicode
|
Set: pp::unicode
|
||||||
Nat
|
ℕ
|
||||||
Nat
|
ℕ
|
||||||
Int
|
ℤ
|
||||||
-10
|
-10
|
||||||
5
|
5
|
||||||
Int
|
ℤ
|
||||||
Assumed: x
|
Assumed: x
|
||||||
Assumed: n
|
Assumed: n
|
||||||
Assumed: m
|
Assumed: m
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
2
|
2
|
||||||
⊤
|
⊤
|
||||||
Assumed: y
|
Assumed: y
|
||||||
if Int (0 ≤ -3 + y) (-3 + y) (-1 * (-3 + y))
|
if ℤ (0 ≤ -3 + y) (-3 + y) (-1 * (-3 + y))
|
||||||
| x + y | > x
|
| x + y | > x
|
||||||
Set: lean::pp::notation
|
Set: lean::pp::notation
|
||||||
Int::gt (Int::abs (Int::add x y)) x
|
Int::gt (Int::abs (Int::add x y)) x
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
Set: pp::colors
|
Set: pp::colors
|
||||||
Set: pp::unicode
|
Set: pp::unicode
|
||||||
Assumed: f
|
Assumed: f
|
||||||
∀ a : Int, (f a a) > 0
|
∀ a : ℤ, (f a a) > 0
|
||||||
∀ a b : Int, (f a b) > 0
|
∀ a b : ℤ, (f a b) > 0
|
||||||
Assumed: g
|
Assumed: g
|
||||||
∀ (a : Int) (b : Real), (g a b) > 0
|
∀ (a : ℤ) (b : ℝ), (g a b) > 0
|
||||||
∀ a b : Int, (g a (f a b)) > 0
|
∀ a b : ℤ, (g a (f a b)) > 0
|
||||||
Set: lean::pp::coercion
|
Set: lean::pp::coercion
|
||||||
∀ a b : Int, (g a (int_to_real (f a b))) > (nat_to_int 0)
|
∀ a b : ℤ, (g a (int_to_real (f a b))) > (nat_to_int 0)
|
||||||
λ a : Nat, a + 1
|
λ a : ℕ, a + 1
|
||||||
Error (line: 10, pos: 18) ambiguous overloads
|
Error (line: 10, pos: 18) ambiguous overloads
|
||||||
Candidates:
|
Candidates:
|
||||||
Real::add : Real → Real → Real
|
Real::add : ℝ → ℝ → ℝ
|
||||||
Int::add : Int → Int → Int
|
Int::add : ℤ → ℤ → ℤ
|
||||||
Nat::add : Nat → Nat → Nat
|
Nat::add : ℕ → ℕ → ℕ
|
||||||
Arguments:
|
Arguments:
|
||||||
a : lift:0:2 ?M0
|
a : lift:0:2 ?M0
|
||||||
b : lift:0:1 ?M2
|
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
|
Error (line: 17, pos: 19) ambiguous overloads
|
||||||
Candidates:
|
Candidates:
|
||||||
Real::add : Real → Real → Real
|
Real::add : ℝ → ℝ → ℝ
|
||||||
Int::add : Int → Int → Int
|
Int::add : ℤ → ℤ → ℤ
|
||||||
Nat::add : Nat → Nat → Nat
|
Nat::add : ℕ → ℕ → ℕ
|
||||||
Arguments:
|
Arguments:
|
||||||
a : lift:0:2 ?M0
|
a : lift:0:2 ?M0
|
||||||
b : lift:0:1 ?M2
|
b : lift:0:1 ?M2
|
||||||
Assumed: x
|
Assumed: x
|
||||||
λ a b : Int, a + x + b
|
λ a b : ℤ, a + x + b
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
Set: pp::unicode
|
Set: pp::unicode
|
||||||
Error (line: 1, pos: 10) application type mismatch, none of the overloads can be used
|
Error (line: 1, pos: 10) application type mismatch, none of the overloads can be used
|
||||||
Candidates:
|
Candidates:
|
||||||
Real::add : Real → Real → Real
|
Real::add : ℝ → ℝ → ℝ
|
||||||
Int::add : Int → Int → Int
|
Int::add : ℤ → ℤ → ℤ
|
||||||
Nat::add : Nat → Nat → Nat
|
Nat::add : ℕ → ℕ → ℕ
|
||||||
Arguments:
|
Arguments:
|
||||||
1 : Nat
|
1 : ℕ
|
||||||
⊤ : Bool
|
⊤ : Bool
|
||||||
Assumed: R
|
Assumed: R
|
||||||
Assumed: T
|
Assumed: T
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Set: pp::colors
|
Set: pp::colors
|
||||||
Set: pp::unicode
|
Set: pp::unicode
|
||||||
Int → Int → Int
|
ℤ → ℤ → ℤ
|
||||||
Assumed: f
|
Assumed: f
|
||||||
f 0
|
f 0
|
||||||
Int → Int
|
ℤ → ℤ
|
||||||
Int
|
ℤ
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
Π (A : Type) (a : A), A
|
Π (A : Type) (a : A), A
|
||||||
Assumed: g
|
Assumed: g
|
||||||
Defined: f
|
Defined: f
|
||||||
f Nat 10
|
f ℕ 10
|
||||||
f Int (- 10)
|
f ℤ (- 10)
|
||||||
|
|
Loading…
Add table
Reference in a new issue