@@ -65,7 +65,7 @@ open WF public using (Acc; acc)
65
65
induct {suc j} (acc rs) (tri< (s≤s i≤j) _ _) _ = Pᵢ⇒Pᵢ₊₁ j P[1+j]
66
66
where
67
67
toℕj≡toℕinjJ = sym $ toℕ-inject₁ j
68
- P[1+j] = induct (rs _ (s≤s (subst (ℕ._≤ toℕ j) toℕj≡toℕinjJ ≤-refl)))
68
+ P[1+j] = induct (rs (s≤s (subst (ℕ._≤ toℕ j) toℕj≡toℕinjJ ≤-refl)))
69
69
(<-cmp i $ inject₁ j) (subst (toℕ i ℕ.≤_) toℕj≡toℕinjJ i≤j)
70
70
71
71
<-weakInduction : (P : Pred (Fin (suc n)) ℓ) →
@@ -80,8 +80,7 @@ open WF public using (Acc; acc)
80
80
81
81
private
82
82
acc-map : ∀ {x : Fin n} → Acc ℕ._<_ (n ∸ toℕ x) → Acc _>_ x
83
- acc-map {n} (acc rs) = acc λ y y>x →
84
- acc-map (rs (n ∸ toℕ y) (ℕ.∸-monoʳ-< y>x (toℕ≤n y)))
83
+ acc-map (acc rs) = acc λ y>x → acc-map (rs (ℕ.∸-monoʳ-< y>x (toℕ≤n _)))
85
84
86
85
>-wellFounded : WellFounded {A = Fin n} _>_
87
86
>-wellFounded {n} x = acc-map (ℕ.<-wellFounded (n ∸ toℕ x))
@@ -96,7 +95,7 @@ private
96
95
induct {i} (acc rec) with n ℕ.≟ toℕ i
97
96
... | yes n≡i = subst P (toℕ-injective (trans (toℕ-fromℕ n) n≡i)) Pₙ
98
97
... | no n≢i = subst P (inject₁-lower₁ i n≢i) (Pᵢ₊₁⇒Pᵢ _ Pᵢ₊₁)
99
- where Pᵢ₊₁ = induct (rec _ (ℕ.≤-reflexive (cong suc (sym (toℕ-lower₁ i n≢i)))))
98
+ where Pᵢ₊₁ = induct (rec (ℕ.≤-reflexive (cong suc (sym (toℕ-lower₁ i n≢i)))))
100
99
101
100
------------------------------------------------------------------------
102
101
-- Well-foundedness of other (strict) partial orders on Fin
@@ -112,20 +111,20 @@ module _ {_≈_ : Rel (Fin n) ℓ} where
112
111
113
112
spo-wellFounded : ∀ {r} {_⊏_ : Rel (Fin n) r} →
114
113
IsStrictPartialOrder _≈_ _⊏_ → WellFounded _⊏_
115
- spo-wellFounded {_} {_⊏_} isSPO i = go n i pigeon where
114
+ spo-wellFounded {_} {_⊏_} isSPO i = go n pigeon where
116
115
117
116
module ⊏ = IsStrictPartialOrder isSPO
118
117
119
- go : ∀ m i →
120
- (( xs : Vec (Fin n) m) → Linked (flip _⊏_) (i ∷ xs) → WellFounded _⊏_) →
118
+ go : ∀ m {i} →
119
+ ({ xs : Vec (Fin n) m} → Linked (flip _⊏_) (i ∷ xs) → WellFounded _⊏_) →
121
120
Acc _⊏_ i
122
- go zero i k = k [] [ -] i
123
- go (suc m) i k = acc $ λ j j ⊏i → go m j ( λ xs i∷xs↑ → k (j ∷ xs) (j ⊏i ∷ i∷xs↑) )
121
+ go zero k = k [-] _
122
+ go (suc m) k = acc λ j⊏i → go m λ i∷xs↑ → k (j⊏i ∷ i∷xs↑)
124
123
125
- pigeon : ( xs : Vec (Fin n) n) → Linked (flip _⊏_) (i ∷ xs) → WellFounded _⊏_
126
- pigeon xs i∷xs↑ =
124
+ pigeon : { xs : Vec (Fin n) n} → Linked (flip _⊏_) (i ∷ xs) → WellFounded _⊏_
125
+ pigeon {xs} i∷xs↑ =
127
126
let (i₁ , i₂ , i₁<i₂ , xs[i₁]≡xs[i₂]) = pigeonhole (n<1+n n) (Vec.lookup (i ∷ xs)) in
128
- let xs[i₁]⊏xs[i₂] = Linkedₚ.lookup⁺ (Ord.transitive _⊏_ ⊏.trans) {xs = i ∷ xs} i∷xs↑ i₁<i₂ in
127
+ let xs[i₁]⊏xs[i₂] = Linkedₚ.lookup⁺ (Ord.transitive _⊏_ ⊏.trans) i∷xs↑ i₁<i₂ in
129
128
let xs[i₁]⊏xs[i₁] = ⊏.<-respʳ-≈ (⊏.Eq.reflexive xs[i₁]≡xs[i₂]) xs[i₁]⊏xs[i₂] in
130
129
contradiction xs[i₁]⊏xs[i₁] (⊏.irrefl ⊏.Eq.refl)
131
130
0 commit comments