lean4-htt/tests/elab/derivingNonempty.lean
Garmelon 08eb78a5b2
chore: switch to new test/bench suite (#12590)
This PR sets up the new integrated test/bench suite. It then migrates
all benchmarks and some related tests to the new suite. There's also
some documentation and some linting.

For now, a lot of the old tests are left alone so this PR doesn't become
even larger than it already is. Eventually, all tests should be migrated
to the new suite though so there isn't a confusing mix of two systems.
2026-02-25 13:51:53 +00:00

65 lines
1.2 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

module
inductive Foo (α : Type u) (β : Type v) where
| mk₁ : α → Foo α β
| mk₂ : List β → Foo α β
deriving instance Nonempty for Foo
def ex1 [Nonempty α] : Nonempty (Foo α β) :=
inferInstance
inductive Bla (α : Type u) (β : Type v) where
| mk₁ : α → Bla α β
| mk₂ : β → Bla α β
deriving instance Nonempty for Bla
def ex2 [Nonempty α] : Nonempty (Bla α β) :=
inferInstance
structure Point (α : Type) where
x : α
y : α
deriving Nonempty
def ex3 [Nonempty α] : Nonempty (Point α) :=
inferInstance
inductive Lst (α : Type) where
| nil
| cons : α → Lst α → Lst α
deriving Nonempty
def ex4 : Nonempty (Lst α) :=
inferInstance
mutual
inductive FooLst (α : Type) where
| nil
| cons : Boo α → FooLst α → FooLst α
deriving Nonempty
inductive Boo (α : Type) where
| node : FooLst α → Boo α
deriving Nonempty
end
def ex5 : Nonempty (Boo α) :=
inferInstance
/-! Public structures with private fields should yield public opaque instances. -/
public structure PrivField where
private a : Nat
deriving Nonempty
/--
info: theorem instNonemptyPrivField : Nonempty PrivField :=
<not imported>
-/
#guard_msgs in
#with_exporting
#print instNonemptyPrivField