It have to keep it as a private definition for now. We currently only support duplicate theorems in different modules. Splitters are generated on demand, and are also used to write code.
37 lines
733 B
Text
37 lines
733 B
Text
import Lean
|
|
syntax (name := test) "test%" ident : command
|
|
|
|
open Lean.Elab
|
|
open Lean.Elab.Command
|
|
|
|
@[command_elab test] def elabTest : CommandElab := fun stx => do
|
|
let id ← liftCoreM <| realizeGlobalConstNoOverloadWithInfo stx[1]
|
|
liftTermElabM do
|
|
IO.println (repr (← Lean.Meta.Match.getEquationsFor id))
|
|
return ()
|
|
|
|
def f (x : List Nat) : Nat :=
|
|
match x with
|
|
| [] => 1
|
|
| [a] => 2
|
|
| _ => 3
|
|
|
|
|
|
def g (x : Unit) (y : Bool) : Unit :=
|
|
match x, y with
|
|
| _, true => ()
|
|
| x, _ => x
|
|
|
|
set_option trace.Meta.Match.matchEqs true
|
|
test% f.match_1
|
|
#check f.match_1.splitter
|
|
|
|
def g.match_1.splitter := 4
|
|
|
|
test% g.match_1
|
|
#check g.match_1.eq_1
|
|
#check g.match_1.eq_2
|
|
#check g.match_1.splitter
|
|
|
|
|
|
def bla.splitter := 5 -- ok
|