Sets the default value to `pp.fieldNotation.generalized` to `true`. Updates tests, and fixes some minor flaws in the implementation of the generalized field notation pretty printer. Now generalized field notation won't be used for any function that has a `motive` argument. This is intended to prevent recursors from pretty printing using it as (1) recursors are more like control flow structures than actual functions and (2) generalized field notation tends to cause elaboration problems for recursors. Note: be sure functions that have an `@[app_unexpander]` use `@[pp_nodot]` if applicable. For example, `List.toArray` needs `@[pp_nodot]` to ensure the unexpander prints it using `#[...]` notation.
30 lines
1.2 KiB
Text
30 lines
1.2 KiB
Text
protected def Nat.add : Nat → Nat → Nat :=
|
||
fun x x_1 =>
|
||
Nat.brecOn x_1
|
||
(fun x f x_2 =>
|
||
(match x_2, x with
|
||
| a, Nat.zero => fun x => a
|
||
| a, b.succ => fun x => (x.fst.fst a).succ)
|
||
f)
|
||
x
|
||
protected def Nat.add : Nat → Nat → Nat :=
|
||
fun x x_1 =>
|
||
Nat.brecOn (motive := fun x => Nat → Nat) x_1
|
||
(fun x f x_2 =>
|
||
(match (motive := Nat → (x : Nat) → Nat.below (motive := fun x => Nat → Nat) x → Nat) x_2, x with
|
||
| a, Nat.zero => fun x => a
|
||
| a, b.succ => fun x => (x.fst.fst a).succ)
|
||
f)
|
||
x
|
||
theorem ex.{u} : ∀ {α β : Sort u} (h : α = β) (a : α), HEq (cast h a) a :=
|
||
fun x x_1 x_2 x_3 =>
|
||
match x, x_1, x_2, x_3 with
|
||
| α, .(α), Eq.refl α, a => HEq.refl a
|
||
theorem ex.{u} : ∀ {α β : Sort u} (h : α = β) (a : α), HEq (cast h a) a :=
|
||
fun x x_1 x_2 x_3 =>
|
||
match (motive := ∀ (x x_4 : Sort u) (x_5 : x = x_4) (x_6 : x), HEq (cast x_5 x_6) x_6) x, x_1, x_2, x_3 with
|
||
| α, .(α), Eq.refl α, a => HEq.refl a
|
||
def fact : Nat → Nat :=
|
||
fun n => Nat.recOn n 1 fun n acc => (n + 1) * acc
|
||
def fact : Nat → Nat :=
|
||
fun n => Nat.recOn (motive := fun x => Nat) n 1 fun n acc => (n + 1) * acc
|