You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
inductiveEventuallyNone {α : Type} (f : α → Option α) : α → Prop where
| base (h : (f a).isNone) : EventuallyNone f a
| cons {a'} (h : (f a) = some a') : EventuallyNone f a' → EventuallyNone f a
variable {α β : Type}
/- fail to show termination -/defList.unfold (a : α) (f : α → Option α) (h : ∀ a, EventuallyNone f a) : List α :=
match f a with
| none => []
| some a' => a' :: List.unfold a' f h
section/- examples of `EventuallyNone` -/defprev : Nat → Option Nat
| 0 => none
| n + 1 => some n
theoremprev_eventually_none (n : Nat) : EventuallyNone prev n := by
induction n
case zero =>
apply EventuallyNone.base
rfl
case succ n ih =>
apply EventuallyNone.cons
rfl
exact ih
end
Lean では停止保証ができないので定義が難しい。
Haskell では遅延評価なので問題なかった。
これを 帰納的述語の例にできるかも?
The text was updated successfully, but these errors were encountered: