An important part of the interface of a function is the parameter names, for making used of named arguments. This PR makes the parameter names print in a reliable way. The parameters of the type now appear as hygienic names if they cannot be used as named arguments. Modifies the heuristic for how parameters are chosen to appear before or after the colon. The rule is now that parameters start appearing after the colon at the first non-dependent non-instance-implicit parameter that has a name unusable as a named argument. This is a refinement of #2846. Fixes the issue where consecutive hygienic names pretty print without a space separating them, so we now have `(x✝ y✝ : Nat)` rather than `(x✝y✝ : Nat)`. Breaking change: `Lean.PrettyPrinter.Formatter.pushToken` now takes an additional boolean `ident` argument, which should be `true` for identifiers. Used to insert discretionary space between consecutive identifiers. Closes #5810
25 lines
876 B
Text
25 lines
876 B
Text
set_option autoImplicit false
|
|
|
|
def ackermann : Nat → Nat → Nat
|
|
| 0, m => m + 1
|
|
| n+1, 0 => ackermann n 1
|
|
| n+1, m+1 => ackermann n (ackermann (n + 1) m)
|
|
|
|
/--
|
|
info: ackermann.induct (motive : Nat → Nat → Prop) (case1 : ∀ (m : Nat), motive 0 m)
|
|
(case2 : ∀ (n : Nat), motive n 1 → motive n.succ 0)
|
|
(case3 : ∀ (n m : Nat), motive (n + 1) m → motive n (ackermann (n + 1) m) → motive n.succ m.succ) (a✝ a✝¹ : Nat) :
|
|
motive a✝ a✝¹
|
|
-/
|
|
#guard_msgs in
|
|
#check ackermann.induct
|
|
|
|
inductive Tree | node : List Tree → Tree
|
|
def Tree.rev : Tree → Tree | node ts => .node (ts.attach.map (fun ⟨t, _ht⟩ => t.rev) |>.reverse)
|
|
|
|
/--
|
|
info: Tree.rev.induct (motive : Tree → Prop)
|
|
(case1 : ∀ (ts : List Tree), (∀ (t : Tree), t ∈ ts → motive t) → motive (Tree.node ts)) (a✝ : Tree) : motive a✝
|
|
-/
|
|
#guard_msgs in
|
|
#check Tree.rev.induct
|