lean4-htt/tests/lean/run/4320.lean
Joachim Breitner d2853ecbc4 feat: FunInd: omit unused parameters (#6330)
This PR removes unnecessary parameters from the funcion induction
principles. This is a breaking change; broken code can typically be adjusted
simply by passing fewer parameters.

Part 1, before stage0 update.

Closes #6320
2024-12-07 04:19:21 +01:00

23 lines
840 B
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.

inductive Many (α : Type u) where
| none : Many α
| more : α → (Unit → Many α) → Many α
def many_map {α β : Type} (f : α → β) : Many α → Many β
| .none => .none
| .more x xs => Many.more (f x) (fun () => many_map f <| xs ())
/--
info: many_map.induct {α : Type} (motive : Many α → Prop) (case1 : motive Many.none)
(case2 : ∀ (x : α) (xs : Unit → Many α), motive (xs ()) → motive (Many.more x xs)) (a✝ : Many α) : motive a✝
-/
#guard_msgs in
#check many_map.induct
-- Unrelated, but for fun, show that we get the identical theorem from well-founded recursion
def many_map' {α β : Type} (f : α → β) : Many α → Many β
| .none => .none
| .more x xs => Many.more (f x) (fun () => many_map' f <| xs ())
termination_by m => m
example : @many_map.induct = @many_map'.induct := rfl