@@ -236,16 +236,36 @@ end⟩
236
236
/-- A recursion principle for `pfun.fix`. -/
237
237
@[elab_as_eliminator] def fix_induction
238
238
{f : α →. β ⊕ α} {b : β} {C : α → Sort *} {a : α} (h : b ∈ f.fix a)
239
- (H : ∀ a, b ∈ f.fix a →
240
- (∀ a', b ∈ f.fix a' → sum.inr a' ∈ f a → C a') → C a) : C a :=
239
+ (H : ∀ a' , b ∈ f.fix a' →
240
+ (∀ a'' , b ∈ f.fix a'' → sum.inr a'' ∈ f a' → C a'' ) → C a' ) : C a :=
241
241
begin
242
242
replace h := part.mem_assert_iff.1 h,
243
243
have := h.snd, revert this ,
244
244
induction h.fst with a ha IH, intro h₂,
245
245
refine H a (part.mem_assert_iff.2 ⟨⟨_, ha⟩, h₂⟩)
246
- (λ a' ha' fa', _),
247
- have := (part.mem_assert_iff.1 ha').snd,
248
- exact IH _ fa' ⟨ha _ fa', this ⟩ this
246
+ (λ a'' ha'' fa'', _),
247
+ have := (part.mem_assert_iff.1 ha'').snd,
248
+ exact IH _ fa'' ⟨ha _ fa'', this ⟩ this ,
249
+ end
250
+
251
+ /--
252
+ Another induction lemma for `b ∈ f.fix a` which allows one to prove a predicate `P` holds for
253
+ `a` given that `f a` inherits `P` from `a` and `P` holds for preimages of `b`.
254
+ -/
255
+ @[elab_as_eliminator]
256
+ def fix_induction'
257
+ (f : α →. β ⊕ α) (b : β) {C : α → Sort *} {a : α} (h : b ∈ f.fix a)
258
+ (hbase : ∀ a_final : α, sum.inl b ∈ f a_final → C a_final)
259
+ (hind : ∀ a₀ a₁ : α, b ∈ f.fix a₁ → sum.inr a₁ ∈ f a₀ → C a₁ → C a₀) : C a :=
260
+ begin
261
+ refine fix_induction h (λ a' h ih, _),
262
+ cases e : (f a').get (dom_of_mem_fix h) with b' a''; replace e : _ ∈ f a' := ⟨_, e⟩,
263
+ { have : b' = b,
264
+ { obtain h'' | ⟨a, h'', _⟩ := mem_fix_iff.1 h; cases part.mem_unique e h'', refl },
265
+ subst this , exact hbase _ e },
266
+ { have : b ∈ f.fix a'',
267
+ { obtain h'' | ⟨a, h'', e'⟩ := mem_fix_iff.1 h; cases part.mem_unique e h'', exact e' },
268
+ refine hind _ _ this e (ih _ this e) },
249
269
end
250
270
251
271
variables (f : α →. β)
0 commit comments