lean4-htt/tests/lean/run/974.lean
Kyle Miller d39b0415f0
feat: enable pp.fieldNotation.generalized globally (#3744)
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.
2024-03-23 02:38:09 +00:00

39 lines
1.3 KiB
Text

inductive Formula : Nat → Type u where
| bot : Formula n
| imp (f₁ f₂ : Formula n ) : Formula n
| all (f : Formula (n+1)) : Formula n
def Formula.count_quantifiers : {n:Nat} → Formula n → Nat
| _, imp f₁ f₂ => f₁.count_quantifiers + f₂.count_quantifiers
| _, all f => f.count_quantifiers + 1
| _, _ => 0
attribute [simp] Formula.count_quantifiers
/--
info: Formula.count_quantifiers.eq_1.{u_1} :
∀ (x : Nat) (f₁ f₂ : Formula x), (f₁.imp f₂).count_quantifiers = f₁.count_quantifiers + f₂.count_quantifiers
-/
#guard_msgs in
#check Formula.count_quantifiers.eq_1
/--
info: Formula.count_quantifiers.eq_2.{u_1} :
∀ (x : Nat) (f : Formula (x + 1)), f.all.count_quantifiers = f.count_quantifiers + 1
-/
#guard_msgs in
#check Formula.count_quantifiers.eq_2
/--
info: Formula.count_quantifiers.eq_3.{u_1} :
∀ (x : Nat) (x_1 : Formula x),
(∀ (f₁ f₂ : Formula x), x_1 = f₁.imp f₂ → False) →
(∀ (f : Formula (x + 1)), x_1 = f.all → False) → x_1.count_quantifiers = 0
-/
#guard_msgs in
#check Formula.count_quantifiers.eq_3
@[simp] def Formula.count_quantifiers2 : Formula n → Nat
| imp f₁ f₂ => f₁.count_quantifiers2 + f₂.count_quantifiers2
| all f => f.count_quantifiers2 + 1
| _ => 0