see #371 This commit does not implement all features discussed in this issue. It has implemented it as a macro expansion. Thus, the following is accepted ```lean inductive StrOrNum where | S (s : String) | I (i : Int) def StrOrNum.asString (x : StrOrNum) := match x with | I a | S a => toString a ``` It may confuse the Lean LSP server. The `a` on `toString` shows the information for the first alternative after expansion (i.e., `a` is an `Int`). After expansion, we have ``` def StrOrNum.asString (x : StrOrNum) := match x with | I a => toString a | S a => toString a ```
9 lines
178 B
Text
9 lines
178 B
Text
--
|
|
|
|
def fib : Nat → Nat
|
|
| 0 | 1 => 1
|
|
| n+2 => fib n + fib (n+1)
|
|
|
|
example : fib 0 = 1 := rfl
|
|
example : fib 1 = 1 := rfl
|
|
example (n : Nat) : fib (n+2) = fib n + fib (n+1) := rfl
|