úÎWOMȃ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚Safe0Nat natural numbers.Better than GHC's built-in  for some use cases.ƒ displaying a structure of .explicitShow 0"Z"explicitShow 2 "S (S Z)"„ displaying a structure of .Fold .cata [] ('x' :) 2"xx"Convert  to … toNatural 00 toNatural 22toNatural $ S $ S $ Z2Convert … to  fromNatural 44explicitShow (fromNatural 4)"S (S (S (S Z)))" is printed as ….To see explicit structure, use  or     None %&,/DOQRT'Multiplication.'reflect (snat :: SNat (Mult Nat2 Nat3))6( Addition.'reflect (snat :: SNat (Plus Nat1 Nat2))3)Convert from GHC †.:kind! FromGHC 7FromGHC 7 :: Nat%= 'S ('S ('S ('S ('S ('S ('S 'Z))))))*Convert to GHC †.:kind! ToGHC Nat5ToGHC Nat5 :: GHC.Nat= 5+$The induction will be fully inlined.See test/Inspection.hs.-Type family used to implement ‡ from Data.Type.Equality module..Convenience class to get 0.0 Singleton of .3Reflect type-level  to the term level.4As 3 but with any ˆ.5Reify .reify nat3 reflect36Convert 0 to .snatToNat (snat :: SNat Nat1)17Convert 0 to …!snatToNatural (snat :: SNat Nat0)0!snatToNatural (snat :: SNat Nat2)28&Decide equality of type-level numbers.(eqNat :: Maybe (Nat3 :~: Plus Nat1 Nat2) Just Refl(eqNat :: Maybe (Nat3 :~: Mult Nat2 Nat2)Nothing9 Induction on ', functor form. Useful for computation.8induction1 (Tagged 0) $ retagMap (+2) :: Tagged Nat3 IntTagged 6: Induction on ..Useful in proofs or with GADTs, see source of >.;See +.<Unfold n steps of a general recursion.Note: Always  benchmark". This function may give you both badK properties: a lot of code (increased binary size), and worse performance. For known n <# will unfold recursion, for example < (‰ :: ‰ #) f = f (f (f (fix f))) =  0 + n = n>  n + 0 = n?  0 * n = 0@  n * 0 = nA  1 * n = nB  n * 1 = nAŠ‹ŒŽ‘’“” !"#$%&'()*•–—˜™š+,-›œ./0123456789 zero caseinduction step: zero caseinduction step; zero caseinduction step<=>?@ABžŸCDEFG8  !"#$%&'()*+,-./0123456789:;<=>?@AB801267./5348-:9+,;<('*) &%$#"! =>?@AB0Š‹ŒŽ‘’“” !"#$%&'()*•–—˜™š+,-›œ./0123456789:;<=>?@ABžŸCDEFGNone %&,/0DTaJFinite Numbers up to n.MMultiplicative inverse. Works for J n where n3 is coprime with an argument, i.e. in general when n is prime.$map inverse universe :: [Fin N.Nat5] [0,1,3,2,4];zipWith (*) universe (map inverse universe) :: [Fin N.Nat5] [0,1,1,1,1]Adaptation of Khttps://en.wikipedia.org/wiki/Extended_Euclidean_algorithm#Modular_integerspseudo-code in WikipediaNƒ displaying a structure of J.explicitShow (0 :: Fin N.Nat1)"Z"explicitShow (2 :: Fin N.Nat3) "S (S Z)"O„ displaying a structure of J.PFold J.Q Convert to Nat.R Convert from Nat.$fromNat N.nat1 :: Maybe (Fin N.Nat2)Just 1$fromNat N.nat1 :: Maybe (Fin N.Nat1)NothingS Convert to …. Convert from any ¡ ˆ.T All values. [minBound .. maxBound] won't work for J &.universe :: [Fin N.Nat3][0,1,2]ULike T but ¢."universe1 :: NonEmpty (Fin N.Nat3) 0 :| [1,2]VT! which will be fully inlined, if n is known at compile time.inlineUniverse :: [Fin N.Nat3][0,1,2]W(inlineUniverse1 :: NonEmpty (Fin N.Nat3) 0 :| [1,2]XJ & is inhabited.YCounting to one is boring.boring0h£ works only on J n where n is prime.jOperations module n.3map fromInteger [0, 1, 2, 3, 4, -5] :: [Fin N.Nat3] [0,1,2,0,1,1]fromInteger 42 :: Fin N.Nat0*** Exception: divide by zero...signum (Z :: Fin N.Nat1)0signum (3 :: Fin N.Nat4)12 + 3 :: Fin N.Nat412 * 3 :: Fin N.Nat42kJ is printed as ….To see explicit structure, use N or O2¤¥¦§¨©ª«¬­®¯°±²JKLMNOPQRS TUVWXYZ[\]^_`abcdefghijkJLKMNOPQRSTUVWXYZ[\]^_`abcJKLPNOQRSMTVUWXYZ[\]^_`abc&¤¥¦§¨©ª«¬­®¯°±²JKLMNOPQRS TUVWXYZ[\]^_`abcdefghijkNone*+,69:;<=?DQRT n'Constraint for the class that computes v.o'Constraint for the class that computes u.pCompute the size from the type.qGeneric enumerations. Examples:from ()0 to 0 :: ()() to 0 :: BoolFalsemap to F.universe :: [Bool] [False,True]Qmap (to . (+1) . from) [LT, EQ, GT] :: [Ordering] -- Num Fin is modulo arithmetic [EQ,GT,LT]rThe size of an enumeration.sConverts a value to its index.t*Converts from index to the original value.uGeneric version of s.vGeneric version of t.³ ~ 3€´ ~ 2() ~ 1‚Void ~ 0µ¶n·¸¹oºpqrstuvwxyz{|}~€‚ nopqrstuv qrssttuovnpµ¶n·¸¹oºpqrssttuvwxyz{|}~€‚»      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQR  S  TUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†…‡ˆ‰Š‹ŒŽ‘’’““”••–——˜™™š››œžŸ ¡Š¢£¤¥¦§§¨©©ª««¬­­®¯¯°Š‹±Š‹²³´µ¶·¸¹fin-0-B8G1uzOurLF8PB8lXwtW3ZData.FinData.Nat Data.Type.Nat Data.Fin.Enum GHC.TypeLitsNatbaseGHC.Real toIntegerZS explicitShowexplicitShowsPreccata toNatural fromNaturalnat0nat1nat2nat3nat4nat5nat6nat7nat8nat9 $fHashableNat $fNFDataNat $fEnumNat $fIntegralNat $fRealNat$fNumNat $fShowNat$fEqNat$fOrdNat $fDataNatNat9Nat8Nat7Nat6Nat5Nat4Nat3Nat2Nat1Nat0MultPlusFromGHCToGHCInlineInductioninlineInduction1EqNatSNatIsnatSNatSZSSreflect reflectToNumreify snatToNat snatToNaturaleqNat induction1 inductioninlineInduction unfoldedFixproofPlusZeroNproofPlusNZeroproofMultZeroNproofMultNZero proofMultOneN proofMultNOne$fInlineInductionS$fInlineInductionZ$fTestEqualityNatSNat$fSNatIS$fSNatIZ $fShowTagged $fShowSNatFininversetoNatfromNatuniverse universe1inlineUniverseinlineUniverse1absurdboringfin0fin1fin2fin3fin4fin5fin6fin7fin8fin9 $fHashableFin $fNFDataFin $fBoundedFin $fEnumFin $fIntegralFin $fRealFin$fNumFin $fShowFin$fOrdFin$fEqFinGToGFrom GEnumSizeEnumEnumSizefromtogfromgto $fGToRepU1 $fGToRepV1 $fGToRepM1 $fGToRep:+: $fGFromRepU1 $fGFromRepV1 $fGFromRepM1 $fGFromRep:+:$fEnumOrdering $fEnumBool$fEnum() $fEnumVoidGHC.Showshow showsPrec GHC.NaturalNaturalghc-prim GHC.TypesData.Type.Equality==GHC.NumNum Data.ProxyProxyTagged ProofMultNOnegetProofMultNOneProofMultNZerogetProofMultNZeroProofPlusNZerogetProofPlusNZeroFixgetFixConst'unConst'NatEqgetNatEqunTaggedretagMap unsafeFromNum GHC.ClassesOrdData.List.NonEmptyNonEmptyquot Universe1 getUniverse1Universe getUniverse UnsafeFromNumappUnsafeFromNumNatToFin appNatToFinMaxBound getMaxBoundOrderingBoolGToRepgtoRepGFromRepgfromRep gfromSkip EnumSizeRep