diff --git a/src/frontends/lean/pp.cpp b/src/frontends/lean/pp.cpp index 15dfb6c896..1fe46146cf 100644 --- a/src/frontends/lean/pp.cpp +++ b/src/frontends/lean/pp.cpp @@ -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 { diff --git a/tests/lean/584c.lean.expected.out b/tests/lean/584c.lean.expected.out index a3d2a65447..64fbacbbcd 100644 --- a/tests/lean/584c.lean.expected.out +++ b/tests/lean/584c.lean.expected.out @@ -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 diff --git a/tests/lean/652.lean.expected.out b/tests/lean/652.lean.expected.out index d9a63a9c7a..0894bf4947 100644 --- a/tests/lean/652.lean.expected.out +++ b/tests/lean/652.lean.expected.out @@ -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 diff --git a/tests/lean/acc.lean.expected.out b/tests/lean/acc.lean.expected.out index f618989829..3a125efe08 100644 --- a/tests/lean/acc.lean.expected.out +++ b/tests/lean/acc.lean.expected.out @@ -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 diff --git a/tests/lean/bug1.lean.expected.out b/tests/lean/bug1.lean.expected.out index 8d0f42d086..1e8f3bac71 100644 --- a/tests/lean/bug1.lean.expected.out +++ b/tests/lean/bug1.lean.expected.out @@ -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 diff --git a/tests/lean/check.lean.expected.out b/tests/lean/check.lean.expected.out index 2ca220363b..da7cf850df 100644 --- a/tests/lean/check.lean.expected.out +++ b/tests/lean/check.lean.expected.out @@ -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 diff --git a/tests/lean/elab6.lean.expected.out b/tests/lean/elab6.lean.expected.out index 472e440427..ce016caf6f 100644 --- a/tests/lean/elab6.lean.expected.out +++ b/tests/lean/elab6.lean.expected.out @@ -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 diff --git a/tests/lean/elab9.lean.expected.out b/tests/lean/elab9.lean.expected.out index 7030d8d93a..8a3840f78b 100644 --- a/tests/lean/elab9.lean.expected.out +++ b/tests/lean/elab9.lean.expected.out @@ -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 diff --git a/tests/lean/let1.lean.expected.out b/tests/lean/let1.lean.expected.out index 522bf3e513..5bc36494e5 100644 --- a/tests/lean/let1.lean.expected.out +++ b/tests/lean/let1.lean.expected.out @@ -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 diff --git a/tests/lean/omit.lean.expected.out b/tests/lean/omit.lean.expected.out index d16188f6a9..db36495ce4 100644 --- a/tests/lean/omit.lean.expected.out +++ b/tests/lean/omit.lean.expected.out @@ -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 diff --git a/tests/lean/private_structure.lean.expected.out b/tests/lean/private_structure.lean.expected.out index 95a3916178..bb96d19b8b 100644 --- a/tests/lean/private_structure.lean.expected.out +++ b/tests/lean/private_structure.lean.expected.out @@ -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 diff --git a/tests/lean/run/def_brec3.lean b/tests/lean/run/def_brec3.lean index 71c6b78758..2b430a8223 100644 --- a/tests/lean/run/def_brec3.lean +++ b/tests/lean/run/def_brec3.lean @@ -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 diff --git a/tests/lean/sec_param_pp2.lean.expected.out b/tests/lean/sec_param_pp2.lean.expected.out index cecc301cf6..2bb2b4e1d8 100644 --- a/tests/lean/sec_param_pp2.lean.expected.out +++ b/tests/lean/sec_param_pp2.lean.expected.out @@ -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 diff --git a/tests/lean/var2.lean.expected.out b/tests/lean/var2.lean.expected.out index ac563cf300..fe5d06a76a 100644 --- a/tests/lean/var2.lean.expected.out +++ b/tests/lean/var2.lean.expected.out @@ -1 +1 @@ -foo : Π B, B → (Π A, A → A = B → Prop) +foo : Π B, B → Π A, A → A = B → Prop