Files
lean4/tests/elab/struct2.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

64 lines
1.5 KiB
Lean4
Raw Permalink 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.
universe u v w
structure A (α : Type u) :=
(f : (β : Type u) α β α)
set_option pp.all true
structure B (α : Type u) extends A α :=
(x : Nat)
(f := fun β a b => a)
#check B.f._default
#check { x := 10 : B Nat}
namespace New
structure A (α : Type u) where
f : (β : Type u) α β α
structure B (α : Type u) extends A α where
x : Nat
f := fun β a b => a
#check B.f._default
#check { x := 10 : B Nat }
structure Data where
index? : Option Nat := none
lowlink? : Option Nat := none
onStack : Bool := false
structure State (α : Type) where
stack : List α := []
nextIndex : Nat := 0
data : Array Data := #[]
sccs : List (List α) := []
inductive Format where
| nil : Format
| line : Format
| text : String Format
| nest (indent : Int) : Format Format
| append : Format Format Format
| group : Format Format
class MonadControl (m : Type u Type v) (n : Type u Type w) where
stM : Type u Type u
liftWith {α} : (({β : Type u} n β m (stM β)) m α) n α
restoreM {α} : m (stM α) n α
instance : MonadControl m (ReaderT ρ m) where
stM := id
liftWith f := fun ctx => f fun x => x ctx
restoreM x := fun ctx => x
instance [Monad m] : MonadControl m (StateT σ m) where
stM α := α × σ
liftWith f := do let s get; liftM (f (fun x => x.run s))
restoreM x := do let (a, s) liftM x; set s; pure a
end New