Skip to content

Commit e8ff0c1

Browse files
authored
Move factorial from Cubical.Data.Fin.LehmerCode to Cubical.Data.Nat.Properties (#1184)
* Update LehmerCode.agda * Update Properties.agda add `factorial` here * Update LehmerCode.agda made it export `factorial` so nothing else in the library that depends on `factorial` being exported breaks * Removed dependency on LehmerCode exporting `factorial` * Removed dependency on LehmerCode exporting `factorial` * Removed dependency on LehmerCode exporting `factorial` * Remove the public export of `factorial` from LehmerCode.agda
1 parent 3d5bb7d commit e8ff0c1

File tree

5 files changed

+8
-10
lines changed

5 files changed

+8
-10
lines changed

Cubical/Data/Fin/LehmerCode.agda

-4
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,6 @@ encode = equivFun lehmerEquiv
191191
decode : LehmerCode n Fin n ≃ Fin n
192192
decode = invEq lehmerEquiv
193193

194-
-- Use the one in Cubical.Data.Nat.Properties instead
195-
factorial :
196-
factorial = _!
197-
198194
lehmerFinEquiv : LehmerCode n ≃ Fin (n !)
199195
lehmerFinEquiv {zero} = isContr→Equiv isContrLehmerZero isContrFin1
200196
lehmerFinEquiv {suc n} = _ ≃⟨ invEquiv lehmerSucEquiv ⟩

Cubical/Data/FinSet/Cardinality.agda

+1-1
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ module _
379379
module _
380380
(X : FinSet ℓ ) where
381381

382-
cardAut : card (_ , isFinSetAut X) ≡ LehmerCode.factorial (card X)
382+
cardAut : card (_ , isFinSetAut X) ≡ (card X !)
383383
cardAut = refl
384384

385385
module _

Cubical/Data/FinSet/Constructors.agda

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ module _
168168
(X : FinSet ℓ) where
169169

170170
isFinSetAut : isFinSet (X .fst ≃ X .fst)
171-
isFinSetAut = LehmerCode.factorial (card X) ,
171+
isFinSetAut = card X ! ,
172172
Prop.map (λ p isFinOrd≃ (X .fst) (card X , p) .snd) (X .snd .snd)
173173

174174
isFinSetTypeAut : isFinSet (X .fst ≡ X .fst)

Cubical/Data/Nat/Properties.agda

+5-3
Original file line numberDiff line numberDiff line change
@@ -266,12 +266,14 @@ n∸n (suc n) = n∸n n
266266
∸-distribʳ zero (suc n) k = sym (zero∸ (k + n · k))
267267
∸-distribʳ (suc m) (suc n) k = ∸-distribʳ m n k ∙ sym (∸-cancelˡ k (m · k) (n · k))
268268

269-
269+
infix 6 _!
270+
infix 7 _choose_
270271

271272
-- factorial:
272-
_! :
273+
_! factorial :
273274
zero ! = 1
274-
suc n ! = (suc n) · (n !)
275+
suc n ! = suc n · (n !)
276+
factorial = _!
275277

276278
--binomial coefficient:
277279
_choose_ :

Cubical/Data/SumFin/Properties.agda

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ isProp→Fin≤1 (suc (suc n)) p = ⊥.rec (fzero≠fone (p fzero (fsuc fzero)))
264264

265265
-- automorphisms of SumFin
266266

267-
SumFin≃≃ : (n : ℕ) (Fin n ≃ Fin n) ≃ Fin (LehmerCode.factorial n)
267+
SumFin≃≃ : (n : ℕ) (Fin n ≃ Fin n) ≃ Fin (n !)
268268
SumFin≃≃ _ =
269269
equivComp (SumFin≃Fin _) (SumFin≃Fin _)
270270
⋆ LehmerCode.lehmerEquiv

0 commit comments

Comments
 (0)