| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Properties of showing natural numbers |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
|
| 9 |
open import Data.Digit.Properties using (toDigits-injective; showDigit-injective) |
| 10 |
import Data.List.Properties as Listₚ |
| 11 |
open import Data.Nat.Base using (ℕ) |
| 12 |
open import Data.Nat.Properties using (_≤?_) |
| 13 |
open import Data.Nat.Show using (charsInBase) |
| 14 |
open import Function.Base using (_∘_) |
| 15 |
open import Relation.Nullary.Decidable.Core using (True) |
| 16 |
open import Relation.Binary.PropositionalEquality.Core using (_≡_) |
| 17 |
|
| 18 |
module Data.Nat.Show.Properties where |
| 19 |
|
| 20 |
module _ (base : ℕ) {base≥2 : True (2 ≤? base)} {base≤16 : True (base ≤? 16)} where |
| 21 |
|
| 22 |
private |
| 23 |
charsInBase-base = charsInBase base {base≥2} {base≤16} |
| 24 |
toDigits-injective-base = toDigits-injective base {base≥2} {base≥2} |
| 25 |
showDigit-injective-base = showDigit-injective base {base≤16} {base≤16} |
| 26 |
|
| 27 |
charsInBase-injective : ∀ n m → charsInBase-base n ≡ charsInBase-base m → n ≡ m |
| 28 |
charsInBase-injective n m = toDigits-injective-base _ _ |
| 29 |
∘ Listₚ.reverse-injective |
| 30 |
∘ Listₚ.map-injective (showDigit-injective-base _ _) |