Skip to content

Commit 17cc4b4

Browse files
committed
added NoSmallestCounterExample principles for Stable predicates
1 parent 8dec2ee commit 17cc4b4

File tree

1 file changed

+48
-23
lines changed

1 file changed

+48
-23
lines changed

src/Induction/NoInfiniteDescent.agda

Lines changed: 48 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ open import Level using (Level)
1919
open import Relation.Binary.Core using (Rel)
2020
open import Relation.Binary.Construct.Closure.Transitive
2121
open import Relation.Binary.PropositionalEquality.Core
22-
open import Relation.Nullary.Negation.Core using (¬_)
22+
open import Relation.Nullary.Negation.Core as Negation using (¬_)
2323
open import Relation.Unary using (Pred; _∩_; _⇒_; Universal; IUniversal)
2424

2525
private
@@ -99,43 +99,43 @@ module InfiniteDescent (_<_ : Rel A r) (P : Pred A ℓ) where
9999

100100
module _ {_<_ : Rel A r} (P : Pred A ℓ) where
101101

102-
open InfiniteDescent _<_ P public
102+
open InfiniteDescent _<_ P public
103103

104-
module Corollaries (descent : Acc⇒Descent) where
104+
module Corollaries (descent : Acc⇒Descent) where
105105

106-
private
106+
private
107107

108-
P∩Acc : Pred A _
109-
P∩Acc = P ∩ (Acc _<_)
108+
P∩Acc : Pred A _
109+
P∩Acc = P ∩ (Acc _<_)
110110

111-
module ID∩ = InfiniteDescent _<_ P∩Acc
111+
module ID∩ = InfiniteDescent _<_ P∩Acc
112112

113-
descent∩ : ID∩.Descent
114-
descent∩ (px , acc[x]) =
115-
let y , y<x , py = descent acc[x] px
116-
in y , y<x , py , acc-inverse acc[x] y<x
113+
descent∩ : ID∩.Descent
114+
descent∩ (px , acc[x]) =
115+
let y , y<x , py = descent acc[x] px
116+
in y , y<x , py , acc-inverse acc[x] y<x
117117

118-
module Lemmas∩ = ID∩.Lemmas descent∩
118+
module Lemmas∩ = ID∩.Lemmas descent∩
119119

120-
acc⇒infiniteDescent : Acc⇒InfiniteDescent
121-
acc⇒infiniteDescent acc[x] px =
122-
let f , Π[[P∩Acc]∘f] , sequence[f] = Lemmas∩.acc⇒infiniteDescent acc[x] (px , acc[x])
123-
in f , proj₁ ∘ Π[[P∩Acc]∘f] , sequence[f]
120+
acc⇒infiniteDescent : Acc⇒InfiniteDescent
121+
acc⇒infiniteDescent acc[x] px =
122+
let f , Π[[P∩Acc]∘f] , sequence[f] = Lemmas∩.acc⇒infiniteDescent acc[x] (px , acc[x])
123+
in f , proj₁ ∘ Π[[P∩Acc]∘f] , sequence[f]
124124

125-
wf⇒infiniteDescent : WellFounded _<_ InfiniteDescent
126-
wf⇒infiniteDescent wf = acc⇒infiniteDescent (wf _)
125+
wf⇒infiniteDescent : WellFounded _<_ InfiniteDescent
126+
wf⇒infiniteDescent wf = acc⇒infiniteDescent (wf _)
127127

128-
acc⇒noInfiniteDescent : ∀[ Acc _<_ ⇒ ¬_ ∘ P ]
129-
acc⇒noInfiniteDescent acc[x] px = Lemmas∩.acc⇒noInfiniteDescent acc[x] (px , acc[x])
128+
acc⇒noInfiniteDescent : ∀[ Acc _<_ ⇒ ¬_ ∘ P ]
129+
acc⇒noInfiniteDescent acc[x] px = Lemmas∩.acc⇒noInfiniteDescent acc[x] (px , acc[x])
130130

131-
wf⇒noInfiniteDescent : WellFounded _<_ ∀[ ¬_ ∘ P ]
132-
wf⇒noInfiniteDescent wf = acc⇒noInfiniteDescent (wf _)
131+
wf⇒noInfiniteDescent : WellFounded _<_ ∀[ ¬_ ∘ P ]
132+
wf⇒noInfiniteDescent wf = acc⇒noInfiniteDescent (wf _)
133133

134134

135135
------------------------------------------------------------------------
136136
-- Further corollaries: assume _<⁺_ descent only for Acc _<⁺_ elements
137137

138-
module _ {_<_ : Rel A r} (P : Pred A ℓ) where
138+
module FurtherCorollaries {_<_ : Rel A r} (P : Pred A ℓ) where
139139

140140
private
141141

@@ -196,7 +196,32 @@ module _ {_<_ : Rel A r} (P : Pred A ℓ) where
196196
wf⇒noInfiniteDescent⁺ = Corollaries⁺.wf⇒noInfiniteDescent ∘ (wellFounded _)
197197

198198

199+
------------------------------------------------------------------------
200+
-- Finally: the (classical) 'no smallest counterexample' principle itself
201+
202+
-- these belong in Relation.Unary
203+
204+
CounterExample : Pred A ℓ Pred A ℓ
205+
CounterExample P = ¬_ ∘ P
206+
207+
Stable : Pred A ℓ Set _
208+
Stable P = {x} Negation.Stable (P x)
209+
210+
module _ {_<_ : Rel A r} {P : Pred A ℓ} (stable : Stable P) where
211+
212+
open FurtherCorollaries {_<_ = _<_} (CounterExample P)
213+
using (acc⇒noInfiniteDescent⁺; wf⇒noInfiniteDescent⁺)
214+
renaming (Acc⇒Descent⁺ to NoSmallestCounterExample)
215+
216+
acc⇒noSmallestCounterExample : NoSmallestCounterExample ∀[ Acc _<_ ⇒ P ]
217+
acc⇒noSmallestCounterExample noSmallest = stable ∘ (acc⇒noInfiniteDescent⁺ noSmallest)
218+
219+
wf⇒noSmallestCounterExample : WellFounded _<_ NoSmallestCounterExample ∀[ P ]
220+
wf⇒noSmallestCounterExample wf noSmallest = stable (wf⇒noInfiniteDescent⁺ noSmallest wf)
221+
199222
------------------------------------------------------------------------
200223
-- Exports
201224

202225
open Corollaries public
226+
open FurtherCorollaries public
227+

0 commit comments

Comments
 (0)