diff --git a/library/logic/core/prop.lean b/library/logic/core/prop.lean index f582d5189b..0201454329 100644 --- a/library/logic/core/prop.lean +++ b/library/logic/core/prop.lean @@ -2,10 +2,7 @@ -- Released under Apache 2.0 license as described in the file LICENSE. -- Authors: Leonardo de Moura, Jeremy Avigad -import general_notation - -definition Prop [reducible] := Type.{0} - +import general_notation type -- implication -- ----------- diff --git a/library/type.lean b/library/type.lean index bdbc8fc664..6762fe490a 100644 --- a/library/type.lean +++ b/library/type.lean @@ -2,6 +2,9 @@ -- Released under Apache 2.0 license as described in the file LICENSE. -- Authors: Leonardo de Moura -definition Type₁ [reducible] := Type.{1} -definition Type₂ [reducible] := Type.{2} -definition Type₃ [reducible] := Type.{3} +notation `Prop`:max := Type.{0} +notation `Type₁`:max := Type.{1} +notation `Type₂`:max := Type.{2} +notation `Type₃`:max := Type.{3} +notation `Type'`:max := Type.{_+1} +notation `Type₊`:max := Type.{_+1} diff --git a/src/emacs/lean-input.el b/src/emacs/lean-input.el index d855237b58..d56ece0b56 100644 --- a/src/emacs/lean-input.el +++ b/src/emacs/lean-input.el @@ -252,6 +252,12 @@ order for the change to take effect." ("inn" . ("∉")) ("nin" . ("∌")) + ;; Types + + ("T1" . ("Type₁")) + ("T2" . ("Type₂")) + ("T+" . ("Type₊")) + ;; Intersections, unions etc. ("intersection" . ,(lean-input-to-string-list "∩⋂∧⋀⋏⨇⊓⨅⋒∏ ⊼ ⨉")) @@ -421,7 +427,7 @@ order for the change to take effect." ;; Big/small, black/white. ("t" . ,(lean-input-to-string-list "▸▹►▻◂◃◄◅▴▵▾▿◢◿◣◺◤◸◥◹")) - ("T" . ,(lean-input-to-string-list "◀◁▶▷▲△▼▽◬◭◮")) + ("Tr" . ,(lean-input-to-string-list "◀◁▶▷▲△▼▽◬◭◮")) ("tb" . ,(lean-input-to-string-list "◂▸▴▾◄►◢◣◤◥")) ("tw" . ,(lean-input-to-string-list "◃▹▵▿◅▻◿◺◸◹")) diff --git a/src/frontends/lean/builtin_exprs.cpp b/src/frontends/lean/builtin_exprs.cpp index b3c2bbc3eb..3e26994a5b 100644 --- a/src/frontends/lean/builtin_exprs.cpp +++ b/src/frontends/lean/builtin_exprs.cpp @@ -36,10 +36,6 @@ static expr parse_Type(parser & p, unsigned, expr const *, pos_info const & pos) } } -static expr parse_Type_prime(parser & p, unsigned, expr const *, pos_info const & pos) { - return p.save_pos(mk_sort(mk_succ(mk_level_placeholder())), pos); -} - static expr parse_let(parser & p, pos_info const & pos); static expr parse_let_body(parser & p, pos_info const & pos) { if (p.curr_is_token(get_comma_tk())) { @@ -407,7 +403,6 @@ parse_table init_nud_table() { r = r.add({transition("fun", Binders), transition(",", mk_scoped_expr_action(x0))}, x0); r = r.add({transition("Pi", Binders), transition(",", mk_scoped_expr_action(x0, 0, false))}, x0); r = r.add({transition("Type", mk_ext_action(parse_Type))}, x0); - r = r.add({transition("Type'", mk_ext_action(parse_Type_prime))}, x0); r = r.add({transition("let", mk_ext_action(parse_let_expr))}, x0); r = r.add({transition("calc", mk_ext_action(parse_calc_expr))}, x0); r = r.add({transition("#", mk_ext_action(parse_overwrite_notation))}, x0); diff --git a/src/frontends/lean/token_table.cpp b/src/frontends/lean/token_table.cpp index 008c66f78a..289051addb 100644 --- a/src/frontends/lean/token_table.cpp +++ b/src/frontends/lean/token_table.cpp @@ -72,7 +72,7 @@ void init_token_table(token_table & t) { {{"fun", 0}, {"Pi", 0}, {"let", 0}, {"in", 0}, {"have", 0}, {"show", 0}, {"obtain", 0}, {"by", 0}, {"then", 0}, {"from", 0}, {"(", g_max_prec}, {")", 0}, {"{", g_max_prec}, {"}", 0}, {"_", g_max_prec}, {"[", g_max_prec}, {"]", 0}, {"⦃", g_max_prec}, {"⦄", 0}, {".{", 0}, {"Type", g_max_prec}, - {"Type'", g_max_prec}, {"using", 0}, {"|", 0}, {"!", g_max_prec}, {"with", 0}, {"...", 0}, {",", 0}, + {"using", 0}, {"|", 0}, {"!", g_max_prec}, {"with", 0}, {"...", 0}, {",", 0}, {".", 0}, {":", 0}, {"::", 0}, {"calc", 0}, {":=", 0}, {"--", 0}, {"#", 0}, {"(*", 0}, {"/-", 0}, {"begin", g_max_prec}, {"proof", g_max_prec}, {"qed", 0}, {"@", g_max_prec}, {"including", 0}, {"sorry", g_max_prec}, {"+", g_plus_prec}, {g_cup, g_cup_prec}, {"->", g_arrow_prec}, diff --git a/tests/lean/prodtst.lean b/tests/lean/prodtst.lean new file mode 100644 index 0000000000..2da0c56af9 --- /dev/null +++ b/tests/lean/prodtst.lean @@ -0,0 +1,7 @@ +import type + +inductive prod (A B : Type₊) := +mk : A → B → prod A B + +set_option pp.universes true +check @prod diff --git a/tests/lean/prodtst.lean.expected.out b/tests/lean/prodtst.lean.expected.out new file mode 100644 index 0000000000..f563850f2b --- /dev/null +++ b/tests/lean/prodtst.lean.expected.out @@ -0,0 +1 @@ +prod.{l_1 l_2} : Type.{succ l_1} → Type.{succ l_2} → Type.{max (succ l_1) (succ l_2)}