Conjunction and Disjunction are right associative. Add notation for implication. Use Isabelle precendence levels.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
abab4b667a
commit
4560527058
3 changed files with 7 additions and 5 deletions
|
@ -12,8 +12,9 @@ namespace lean {
|
|||
\brief Initialize builtin notation.
|
||||
*/
|
||||
void init_builtin_notation(frontend & f) {
|
||||
f.add_infixl("\u2227", 13, const_name(mk_and_fn()));
|
||||
f.add_infixl("\u2228", 14, const_name(mk_or_fn()));
|
||||
f.add_prefix("\u00ac", 3, const_name(mk_not_fn()));
|
||||
f.add_prefix("\u00ac", 40, const_name(mk_not_fn()));
|
||||
f.add_infixr("\u2227", 35, const_name(mk_and_fn()));
|
||||
f.add_infixr("\u2228", 30, const_name(mk_or_fn()));
|
||||
f.add_infixr("\u21D2", 25, const_name(mk_implies_fn()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ Author: Leonardo de Moura
|
|||
*/
|
||||
#pragma once
|
||||
namespace lean {
|
||||
constexpr unsigned g_eq_precedence = 50;
|
||||
class frontend;
|
||||
void init_builtin_notation(frontend & fe);
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ Author: Leonardo de Moura
|
|||
#include "expr_formatter.h"
|
||||
#include "occurs.h"
|
||||
#include "instantiate.h"
|
||||
#include "builtin_notation.h"
|
||||
#include "options.h"
|
||||
|
||||
#ifndef LEAN_DEFAULT_PP_MAX_DEPTH
|
||||
|
@ -40,7 +41,6 @@ Author: Leonardo de Moura
|
|||
|
||||
namespace lean {
|
||||
static format g_Type_fmt = highlight_builtin(format("Type"));
|
||||
static unsigned g_eq_prec = 20;
|
||||
static format g_eq_fmt = format("=");
|
||||
static char const * g_eq_sym = "eq";
|
||||
static unsigned g_eq_sz = strlen(g_eq_sym);
|
||||
|
@ -466,7 +466,7 @@ class pp_fn {
|
|||
return pp(e, depth + 1);
|
||||
} else {
|
||||
operator_info op_child = get_operator(e);
|
||||
if (op_child && g_eq_prec < op_child.get_precedence())
|
||||
if (op_child && g_eq_precedence < op_child.get_precedence())
|
||||
return pp(e, depth + 1);
|
||||
else
|
||||
return pp_child_with_paren(e, depth);
|
||||
|
|
Loading…
Reference in a new issue