fix(frontends/lean/pp): remove unnecessary parenthesis when pretty printing (A -> (Pi (b : B), C b))
This commit is contained in:
parent
230db1bc92
commit
bd99de9bf8
14 changed files with 20 additions and 18 deletions
|
|
@ -846,7 +846,8 @@ static bool is_default_arrow(expr const & e) {
|
|||
auto pretty_fn::pp_pi(expr const & e) -> result {
|
||||
if (is_default_arrow(e)) {
|
||||
result lhs = pp_child(binding_domain(e), get_arrow_prec());
|
||||
result rhs = pp_child(lift_free_vars(binding_body(e), 1), get_arrow_prec()-1);
|
||||
expr b = lift_free_vars(binding_body(e), 1);
|
||||
result rhs = is_pi(b) ? pp(b) : pp_child(b, get_arrow_prec()-1);
|
||||
format r = group(lhs.fmt() + space() + (m_unicode ? *g_arrow_n_fmt : *g_arrow_fmt) + line() + rhs.fmt());
|
||||
return result(get_arrow_prec(), get_arrow_prec()-1, r);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@ tst₁ : Π A, A → A
|
|||
tst₂ : Π {A}, A → A
|
||||
symm₂ : ∀ {A} a b, a = b → b = a
|
||||
tst₃ : Π A, A → A
|
||||
foo : ∀ {A} {a b}, a = b → (∀ c, c = b → c = a)
|
||||
foo : ∀ {A} {a b}, a = b → ∀ c, c = b → c = a
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
R : Π {b c}, Prop
|
||||
R2 : bool → bool → Prop
|
||||
R3 : bool → bool → Prop
|
||||
R4 : bool → (Π {c}, Prop)
|
||||
R4 : bool → Π {c}, Prop
|
||||
R5 : Π {b c}, Prop
|
||||
R6 : Π {b}, bool → Prop
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
acc.rec :
|
||||
Π {A} {R} {C}, (Π x, (∀ y, R y x → acc A R y) → (Π y, R y x → C y) → C x) → (Π {a}, acc A R a → C a)
|
||||
Π {A} {R} {C}, (Π x, (∀ y, R y x → acc A R y) → (Π y, R y x → C y) → C x) → Π {a}, acc A R a → C a
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
bug1.lean:9:7: error: type mismatch at definition 'and_intro1', has type
|
||||
∀ p q, p → q → (∀ c, (p → q → c) → c)
|
||||
∀ p q, p → q → ∀ c, (p → q → c) → c
|
||||
but is expected to have type
|
||||
∀ p q, p → q → a
|
||||
bug1.lean:13:7: error: type mismatch at definition 'and_intro2', has type
|
||||
∀ p q, p → q → (∀ c, (p → q → c) → c)
|
||||
∀ p q, p → q → ∀ c, (p → q → c) → c
|
||||
but is expected to have type
|
||||
∀ p q, p → q → p ∧ p
|
||||
bug1.lean:17:7: error: type mismatch at definition 'and_intro3', has type
|
||||
∀ p q, p → q → (∀ c, (p → q → c) → c)
|
||||
∀ p q, p → q → ∀ c, (p → q → c) → c
|
||||
but is expected to have type
|
||||
∀ p q, p → q → q ∧ p
|
||||
and_intro4 : ∀ p q, p → q → p ∧ q
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
and.intro : ?M_1 → ?M_2 → ?M_1 ∧ ?M_2
|
||||
or.elim : ?M_1 ∨ ?M_2 → (?M_1 → ?M_3) → (?M_2 → ?M_3) → ?M_3
|
||||
eq : ?M_1 → ?M_1 → Prop
|
||||
eq.rec : ?M_3 ?M_2 → (Π {a}, ?M_2 = a → ?M_3 a)
|
||||
eq.rec : ?M_3 ?M_2 → Π {a}, ?M_2 = a → ?M_3 a
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
H : @transitive.{1} nat R
|
||||
@F.{l_1} ?M_1 : Π ⦃a : ?M_1⦄ {b : ?M_1}, ?M_1 → (Π ⦃e : ?M_1⦄, ?M_1 → ?M_1 → ?M_1)
|
||||
@F.{l_1} ?M_1 : Π ⦃a : ?M_1⦄ {b : ?M_1}, ?M_1 → Π ⦃e : ?M_1⦄, ?M_1 → ?M_1 → ?M_1
|
||||
@F.{1} bool ?M_1 ?M_2 bool.tt : Π ⦃e : bool⦄, bool → bool → bool
|
||||
@F.{1} bool ?M_1 ?M_2 bool.tt ?M_3 bool.tt : bool → bool
|
||||
@F.{1} bool ?M_1 ?M_2 bool.tt ?M_3 bool.tt bool.tt : bool
|
||||
H : @transitive.{1} nat R
|
||||
@F.{l_1} ?M_1 : Π ⦃a : ?M_1⦄ {b : ?M_1}, ?M_1 → (Π ⦃e : ?M_1⦄, ?M_1 → ?M_1 → ?M_1)
|
||||
@F.{l_1} ?M_1 : Π ⦃a : ?M_1⦄ {b : ?M_1}, ?M_1 → Π ⦃e : ?M_1⦄, ?M_1 → ?M_1 → ?M_1
|
||||
@F.{1} bool ?M_1 ?M_2 bool.tt : Π ⦃e : bool⦄, bool → bool → bool
|
||||
@F.{1} bool ?M_1 ?M_2 bool.tt ?M_3 bool.tt : bool → bool
|
||||
@F.{1} bool ?M_1 ?M_2 bool.tt ?M_3 bool.tt bool.tt : bool
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@
|
|||
[_inst_3 : has_add A] (H : @eq A a (@add A _inst_3 (@zero A _inst_2) (@zero A _inst_2))), @add A _inst_3 a a :
|
||||
Π (A : Type) [_inst_1 : has_add A] [_inst_2 : has_zero A] (a : A),
|
||||
@eq A (@add A _inst_1 a (@zero A _inst_2)) a →
|
||||
(Π [_inst_3 : has_add A], @eq A a (@add A _inst_3 (@zero A _inst_2) (@zero A _inst_2)) → A)
|
||||
Π [_inst_3 : has_add A], @eq A a (@add A _inst_3 (@zero A _inst_2) (@zero A _inst_2)) → A
|
||||
λ (a b : nat) (H : @gt nat nat.nat_has_lt a b) [_inst_4 : has_lt nat], @lt nat _inst_4 a b :
|
||||
Π (a b : nat), @gt nat nat.nat_has_lt a b → (Π [_inst_4 : has_lt nat], Prop)
|
||||
Π (a b : nat), @gt nat nat.nat_has_lt a b → Π [_inst_4 : has_lt nat], Prop
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ let bool := Prop,
|
|||
and := λ p q, Π c, (p → q → c) → c,
|
||||
and_intro := λ p q H1 H2 c H, H H1 H2
|
||||
in and_intro :
|
||||
∀ p q, p → q → (∀ c, (p → q → c) → c)
|
||||
∀ p q, p → q → ∀ c, (p → q → c) → c
|
||||
let1.lean:19:19: error: invalid type ascription, expression has type
|
||||
∀ p q, p → q → (∀ c, (p → q → c) → c)
|
||||
∀ p q, p → q → ∀ c, (p → q → c) → c
|
||||
but is expected to have type
|
||||
∀ p q, p → q → (λ p q, ∀ c, (p → q → c) → c) q p
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
omit.lean:5:7: error: invalid omit command, 'A' has not been included
|
||||
omit.lean:7:10: error: invalid include command, 'A' has already been included
|
||||
foo : Π A, A → A → (Π B, B → B)
|
||||
foo : Π A, A → A → Π B, B → B
|
||||
tst : Π A, A → A → Type → Type
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ point.rec_on ==> private.1706149582.point.rec_on
|
|||
bla : Type₁
|
||||
point : Type₁
|
||||
point.mk : ℕ → ℕ → point
|
||||
point.rec : (Π x y, ?M_1 (point.mk x y)) → (Π n, ?M_1 n)
|
||||
point.rec : (Π x y, ?M_1 (point.mk x y)) → Π n, ?M_1 n
|
||||
point.rec_on : Π n, (Π x y, ?M_1 (point.mk x y)) → ?M_1 n
|
||||
point.cases_on : Π n, (Π x y, ?M_1 (point.mk x y)) → ?M_1 n
|
||||
point.induction_on : ∀ n, (∀ x y, ?M_1 (point.mk x y)) → ?M_1 n
|
||||
|
|
|
|||
|
|
@ -18,3 +18,4 @@ rfl
|
|||
|
||||
example (n : nat) (b1 b2 : bool) (v1 v2 : bv n) : map2 f (cons n b1 v1) (cons n b2 v2) = cons n (f b1 b2) (map2 f v1 v2) :=
|
||||
rfl
|
||||
print map2
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
id2 : (A → B → A) → A
|
||||
id2 : (A → B → A) → A
|
||||
id2 : ?M_1 → (A → ?M_1 → A) → A
|
||||
id2 : ?M_1 → (Π {B}, B → (?M_1 → B → ?M_1) → ?M_1)
|
||||
id2 : ?M_1 → Π {B}, B → (?M_1 → B → ?M_1) → ?M_1
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
foo : Π B, B → (Π A, A → A = B → Prop)
|
||||
foo : Π B, B → Π A, A → A = B → Prop
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue