@@ -277,18 +277,25 @@ is-minimal-element-suc :
277
277
(m : ℕ) (pm : P (suc m))
278
278
(is-lower-bound-m : is-lower-bound (λ x → P (suc x)) m) →
279
279
¬ (P 0) → is-lower-bound P (suc m)
280
- is-minimal-element-suc P d m pm is-lower-bound-m neg-p0 0 p0 =
281
- 𝟘-nondep-elim (neg-p0 p0)
282
- is-minimal-element-suc
283
- P d 0 pm is-lower-bound-m neg-p0 (suc n) psuccn = leq-zero n
284
- is-minimal-element-suc
285
- P d (suc m) pm is-lower-bound-m neg-p0 (suc n) psuccn =
286
- is-minimal-element-suc (λ x → P (suc x)) (λ x → d (suc x)) m pm
287
- (λ m → is-lower-bound-m (suc m))
288
- (is-lower-bound-m 0)
289
- (n)
290
- (psuccn)
280
+ is-minimal-element-suc P d m pm is-lower-bound-m neg-p0 0 p0 = 𝟘-nondep-elim (neg-p0 p0)
281
+ -- In the previous clause, 𝟘-nondep-elim is superfluous, because neg-p0 p0 : ∅ already.
282
+ is-minimal-element-suc P d 0 pm is-lower-bound-m neg-p0 (suc n) psuccn = ⋆
283
+ is-minimal-element-suc P d (suc m) pm is-lower-bound-m neg-p0 (suc n) psuccn = h
284
+ where
285
+ h : suc m ≤₁ n
286
+ h = is-minimal-element-suc (λ x → P (suc x))
287
+ (λ x → d (suc x)) m pm
288
+ (λ m → is-lower-bound-m (suc m))
289
+ (is-lower-bound-m 0)
290
+ (n)
291
+ (psuccn)
292
+ -- alternative solution
293
+ h' : suc m ≤₁ n
294
+ h' = is-lower-bound-m n psuccn
291
295
```
296
+ The lemma states that for a decidable type family ` P ` , if ` m ` is a lower bound
297
+ for ` P ∘ suc ` , and ` P 0 ` is false, then ` m + 1 ` is a lower bound for ` P ` .
298
+ Note that the assumptions ` d ` and ` pm ` are not used.
292
299
293
300
### Exercise 10 (🌶)
294
301
@@ -304,7 +311,18 @@ well-ordering-principle-suc :
304
311
minimal-element (λ m → P (suc m)) → minimal-element P
305
312
well-ordering-principle-suc P d n p (inl p0) _ = 0 , (p0 , (λ m q → leq-zero m))
306
313
well-ordering-principle-suc P d n p (inr neg-p0) (m , (pm , is-min-m)) = (suc m) , (pm , is-minimal-element-suc P d m pm is-min-m neg-p0)
314
+ where
315
+ h : is-lower-bound P (suc m)
316
+ h = is-minimal-element-suc P d m pm is-min-m neg-p0
317
+
318
+ -- alternative solution
319
+ h' : is-lower-bound P (suc m)
320
+ h' zero q = 𝟘-nondep-elim (neg-p0 q)
321
+ h' (suc k) q = is-min-m k q
307
322
```
323
+ This lemma states that for a decidable type family ` P ` , if ` P ∘ suc ` is true for some ` n ` ,
324
+ and ` P 0 ` is decidable, then minimal elements of ` P ∘ suc ` yield minimal elements of ` P ` .
325
+ Note that ` d ` and ` p ` are not used.
308
326
309
327
### Exercise 11 (🌶)
310
328
@@ -315,7 +333,7 @@ well-ordering-principle P d 0 p = 0 , (p , (λ m q → leq-zero m))
315
333
well-ordering-principle P d (suc n) p = well-ordering-principle-suc P d n p (d 0) (well-ordering-principle (λ m → P (suc m)) (λ m → d (suc m)) n p)
316
334
```
317
335
318
- ### Exercise 12 (🌶 )
336
+ ### Exercise 12 (⋆⋆⋆ )
319
337
320
338
Prove that the well-ordering principle returns 0 if ` P 0 ` holds.
321
339
0 commit comments