8
8
9
9
module Data.Nat.Induction where
10
10
11
- open import Function
12
11
open import Data.Nat.Base
13
12
open import Data.Nat.Properties using (<⇒<′)
14
13
open import Data.Product
15
- open import Data.Unit.Polymorphic
14
+ open import Data.Unit.Polymorphic.Base
15
+ open import Function.Base
16
16
open import Induction
17
17
open import Induction.WellFounded as WF
18
18
open import Level using (Level)
19
- open import Relation.Binary.PropositionalEquality
20
- open import Relation.Unary
21
19
22
20
private
23
21
variable
@@ -35,11 +33,11 @@ Rec : ∀ ℓ → RecStruct ℕ ℓ ℓ
35
33
Rec ℓ P zero = ⊤
36
34
Rec ℓ P (suc n) = P n
37
35
38
- recBuilder : ∀ {ℓ} → RecursorBuilder (Rec ℓ)
36
+ recBuilder : RecursorBuilder (Rec ℓ)
39
37
recBuilder P f zero = _
40
38
recBuilder P f (suc n) = f n (recBuilder P f n)
41
39
42
- rec : ∀ {ℓ} → Recursor (Rec ℓ)
40
+ rec : Recursor (Rec ℓ)
43
41
rec = build recBuilder
44
42
45
43
------------------------------------------------------------------------
@@ -49,18 +47,18 @@ CRec : ∀ ℓ → RecStruct ℕ ℓ ℓ
49
47
CRec ℓ P zero = ⊤
50
48
CRec ℓ P (suc n) = P n × CRec ℓ P n
51
49
52
- cRecBuilder : ∀ {ℓ} → RecursorBuilder (CRec ℓ)
50
+ cRecBuilder : RecursorBuilder (CRec ℓ)
53
51
cRecBuilder P f zero = _
54
52
cRecBuilder P f (suc n) = f n ih , ih
55
53
where ih = cRecBuilder P f n
56
54
57
- cRec : ∀ {ℓ} → Recursor (CRec ℓ)
55
+ cRec : Recursor (CRec ℓ)
58
56
cRec = build cRecBuilder
59
57
60
58
------------------------------------------------------------------------
61
59
-- Complete induction based on _<′_
62
60
63
- <′-Rec : ∀ {ℓ} → RecStruct ℕ ℓ ℓ
61
+ <′-Rec : RecStruct ℕ ℓ ℓ
64
62
<′-Rec = WfRec _<′_
65
63
66
64
-- mutual definition
@@ -73,7 +71,7 @@ cRec = build cRecBuilder
73
71
<′-wellFounded′ (suc n) n <′-base = <′-wellFounded n
74
72
<′-wellFounded′ (suc n) m (<′-step m<n) = <′-wellFounded′ n m m<n
75
73
76
- module _ {ℓ} where
74
+ module _ {ℓ : Level } where
77
75
open WF.All <′-wellFounded ℓ public
78
76
renaming ( wfRecBuilder to <′-recBuilder
79
77
; wfRec to <′-rec
@@ -83,7 +81,7 @@ module _ {ℓ} where
83
81
------------------------------------------------------------------------
84
82
-- Complete induction based on _<_
85
83
86
- <-Rec : ∀ {ℓ} → RecStruct ℕ ℓ ℓ
84
+ <-Rec : RecStruct ℕ ℓ ℓ
87
85
<-Rec = WfRec _<_
88
86
89
87
<-wellFounded : WellFounded _<_
@@ -105,7 +103,7 @@ module _ {ℓ} where
105
103
<-wellFounded-skip (suc k) zero = <-wellFounded 0
106
104
<-wellFounded-skip (suc k) (suc n) = acc (λ m _ → <-wellFounded-skip k m)
107
105
108
- module _ {ℓ} where
106
+ module _ {ℓ : Level } where
109
107
open WF.All <-wellFounded ℓ public
110
108
renaming ( wfRecBuilder to <-recBuilder
111
109
; wfRec to <-rec
0 commit comments