Reshuffle in preparation to break the dependency on N's implementation (#75)

This commit is contained in:
Patrick Stevens
2019-11-17 10:01:39 +00:00
committed by GitHub
parent ff6ef4f1a1
commit c55dd5f63e
53 changed files with 2493 additions and 2388 deletions

View File

@@ -3,10 +3,13 @@
open import LogicalFormulae
open import Functions
open import Lists.Lists
open import Numbers.Naturals.Semiring
open import Numbers.Naturals.Naturals
open import Numbers.Naturals.Order
open import Groups.Definition
open import Numbers.BinaryNaturals.Definition
open import Semirings.Definition
open import Orders
module Numbers.BinaryNaturals.Addition where
@@ -39,7 +42,7 @@ _+B_ : BinNat → BinNat → BinNat
refine b pr with canonical b
refine b pr | x :: bl = ::Inj pr
t : NToBinNat (0 +N binNatToN (zero :: b)) zero :: b
t with orderIsTotal 0 (binNatToN b)
t with TotalOrder.totality TotalOrder 0 (binNatToN b)
t | inl (inl pos) = transitivity (doubleIsBitShift (binNatToN b) pos) (applyEquality (zero ::_) (transitivity (binToBin b) (equalityCommutative (refine b prB))))
t | inl (inr ())
... | inr eq with binNatToNZero b (equalityCommutative eq)
@@ -61,9 +64,9 @@ _+B_ : BinNat → BinNat → BinNat
+BIsInherited' : (a b : BinNat) a +Binherit b canonical (a +B b)
+BinheritLemma a b prA prB with orderIsTotal 0 (binNatToN a +N binNatToN b)
+BinheritLemma a b prA prB with TotalOrder.totality TotalOrder 0 (binNatToN a +N binNatToN b)
+BinheritLemma a b prA prB | inl (inl x) rewrite doubleIsBitShift (binNatToN a +N binNatToN b) x = applyEquality (one ::_) (+BIsInherited a b prA prB)
+BinheritLemma a b prA prB | inr x with sumZeroImpliesOperandsZero (binNatToN a) (equalityCommutative x)
+BinheritLemma a b prA prB | inr x with sumZeroImpliesSummandsZero (equalityCommutative x)
+BinheritLemma a b prA prB | inr x | fst ,, snd = ans2
where
bad : b []
@@ -75,10 +78,10 @@ _+B_ : BinNat → BinNat → BinNat
+BIsInherited [] b _ prB = +BIsInherited[] b prB
+BIsInherited (x :: a) [] prA _ = transitivity (applyEquality NToBinNat (Semiring.commutative Semiring (binNatToN (x :: a)) 0)) (transitivity (binToBin (x :: a)) (equalityCommutative prA))
+BIsInherited (zero :: as) (zero :: b) prA prB with orderIsTotal 0 (binNatToN as +N binNatToN b)
+BIsInherited (zero :: as) (zero :: b) prA prB with TotalOrder.totality TotalOrder 0 (binNatToN as +N binNatToN b)
... | inl (inl 0<) rewrite Semiring.commutative Semiring (binNatToN as) 0 | Semiring.commutative Semiring (binNatToN b) 0 | Semiring.+Associative Semiring (binNatToN as +N binNatToN as) (binNatToN b) (binNatToN b) | equalityCommutative (Semiring.+Associative Semiring (binNatToN as) (binNatToN as) (binNatToN b)) | Semiring.commutative Semiring (binNatToN as) (binNatToN b) | Semiring.+Associative Semiring (binNatToN as) (binNatToN b) (binNatToN as) | equalityCommutative (Semiring.+Associative Semiring (binNatToN as +N binNatToN b) (binNatToN as) (binNatToN b)) | Semiring.commutative Semiring 0 ((binNatToN as +N binNatToN b) +N (binNatToN as +N binNatToN b)) | equalityCommutative (Semiring.+Associative Semiring (binNatToN as +N binNatToN b) (binNatToN as +N binNatToN b) 0) = transitivity (doubleIsBitShift (binNatToN as +N binNatToN b) (identityOfIndiscernablesRight _<N_ 0< (Semiring.commutative Semiring (binNatToN b) _))) (applyEquality (zero ::_) (+BIsInherited as b (canonicalDescends as prA) (canonicalDescends b prB)))
+BIsInherited (zero :: as) (zero :: b) prA prB | inl (inr ())
... | inr p with sumZeroImpliesOperandsZero (binNatToN as) (equalityCommutative p)
... | inr p with sumZeroImpliesSummandsZero {binNatToN as} (equalityCommutative p)
+BIsInherited (zero :: as) (zero :: b) prA prB | inr p | as=0 ,, b=0 rewrite as=0 | b=0 = exFalso ans
where
bad : (b : BinNat) (pr : b canonical b) (pr2 : binNatToN b 0) b []
@@ -142,7 +145,7 @@ _+B_ : BinNat → BinNat → BinNat
where
ans : NToBinNat (2 *N (binNatToN as +N binNatToN bs)) canonical (zero :: (as +B bs))
ans with inspect (binNatToN as +N binNatToN bs)
ans | zero with x with sumZeroImpliesOperandsZero (binNatToN as) x
ans | zero with x with sumZeroImpliesSummandsZero {binNatToN as} x
... | as=0 ,, bs=0 rewrite as=0 | bs=0 = foo
where
u : canonical (as +Binherit bs) []
@@ -162,7 +165,7 @@ _+B_ : BinNat → BinNat → BinNat
where
ans2 : incr (NToBinNat (2 *N (binNatToN as +N binNatToN bs))) one :: canonical (as +B bs)
ans2 with inspect (binNatToN as +N binNatToN bs)
ans2 | zero with x with sumZeroImpliesOperandsZero (binNatToN as) x
ans2 | zero with x with sumZeroImpliesSummandsZero {binNatToN as} x
ans2 | zero with x | as=0 ,, bs=0 rewrite as=0 | bs=0 = applyEquality (one ::_) (transitivity t (+BIsInherited' as bs))
where
t : [] as +Binherit bs
@@ -172,7 +175,7 @@ _+B_ : BinNat → BinNat → BinNat
where
ans : incr (NToBinNat (2 *N (binNatToN as +N binNatToN bs))) one :: canonical (as +B bs)
ans with inspect (binNatToN as +N binNatToN bs)
ans | zero with x with sumZeroImpliesOperandsZero (binNatToN as) x
ans | zero with x with sumZeroImpliesSummandsZero {binNatToN as} x
... | as=0 ,, bs=0 rewrite as=0 | bs=0 = applyEquality (one ::_) (transitivity t (+BIsInherited' as bs))
where
t : [] NToBinNat (binNatToN as +N binNatToN bs)
@@ -182,7 +185,7 @@ _+B_ : BinNat → BinNat → BinNat
where
ans : incr (incr (NToBinNat (2 *N (binNatToN as +N binNatToN bs)))) canonical (zero :: incr (as +B bs))
ans with inspect (binNatToN as +N binNatToN bs)
... | zero with x with sumZeroImpliesOperandsZero (binNatToN as) x
... | zero with x with sumZeroImpliesSummandsZero {binNatToN as} x
ans | zero with x | as=0 ,, bs=0 rewrite as=0 | bs=0 = bar
where
u' : canonical (as +Binherit bs) []

View File

@@ -3,7 +3,8 @@
open import LogicalFormulae
open import Functions
open import Lists.Lists
open import Numbers.Naturals.Naturals
open import Numbers.Naturals.Semiring
open import Numbers.Naturals.Order
open import Numbers.Naturals.Definition
open import Groups.Definition
open import Semirings.Definition
@@ -98,7 +99,7 @@ module Numbers.BinaryNaturals.Definition where
canonicalAscends' {i} a pr = canonicalAscends {i} a (t a pr)
where
t : (a : BinNat) (canonical a [] False) 0 <N binNatToN a
t a pr with orderIsTotal 0 (binNatToN a)
t a pr with TotalOrder.totality TotalOrder 0 (binNatToN a)
t a pr | inl (inl x) = x
t a pr | inr x = exFalso (pr (binNatToNZero a (equalityCommutative x)))

View File

@@ -3,6 +3,7 @@
open import LogicalFormulae
open import Functions
open import Lists.Lists
open import Numbers.Naturals.Semiring
open import Numbers.Naturals.Naturals
open import Groups.Definition
open import Numbers.BinaryNaturals.Definition
@@ -77,7 +78,7 @@ module Numbers.BinaryNaturals.Multiplication where
t : binNatToN (as *B (zero :: bs)) +N binNatToN bs 0
t = transitivity (equalityCommutative (nToN _)) (applyEquality binNatToN x)
u : (binNatToN (as *B (zero :: bs)) 0) && (binNatToN bs 0)
u = sumZeroImpliesOperandsZero _ t
u = sumZeroImpliesSummandsZero t
v : canonical bs []
v with u
... | fst ,, snd = binNatToNZero bs snd

View File

@@ -4,7 +4,9 @@ open import WellFoundedInduction
open import LogicalFormulae
open import Functions
open import Lists.Lists
open import Numbers.Naturals.Naturals
open import Numbers.Naturals.Order
open import Numbers.Naturals.Order.Lemmas
open import Numbers.Naturals.Semiring
open import Groups.Definition
open import Numbers.BinaryNaturals.Definition
open import Orders
@@ -27,7 +29,7 @@ module Numbers.BinaryNaturals.Order where
badCompare'' ()
_<BInherited_ : BinNat BinNat Compare
a <BInherited b with orderIsTotal (binNatToN a) (binNatToN b)
a <BInherited b with TotalOrder.totality TotalOrder (binNatToN a) (binNatToN b)
(a <BInherited b) | inl (inl x) = FirstLess
(a <BInherited b) | inl (inr x) = FirstGreater
(a <BInherited b) | inr x = Equal
@@ -283,24 +285,24 @@ module Numbers.BinaryNaturals.Order where
chopFirstBit m n {one} FirstGreater = refl
chopDouble : (a b : BinNat) (i : Bit) (i :: a) <BInherited (i :: b) a <BInherited b
chopDouble a b i with orderIsTotal (binNatToN a) (binNatToN b)
chopDouble a b zero | inl (inl a<b) with orderIsTotal (2 *N binNatToN a) (2 *N binNatToN b)
chopDouble a b i with TotalOrder.totality TotalOrder (binNatToN a) (binNatToN b)
chopDouble a b zero | inl (inl a<b) with TotalOrder.totality TotalOrder (2 *N binNatToN a) (2 *N binNatToN b)
chopDouble a b zero | inl (inl a<b) | inl (inl x) = refl
chopDouble a b zero | inl (inl a<b) | inl (inr b<a) = exFalso (PartialOrder.irreflexive (TotalOrder.order TotalOrder) (PartialOrder.<Transitive (TotalOrder.order TotalOrder) b<a (lessRespectsMultiplicationLeft (binNatToN a) (binNatToN b) 2 a<b (le 1 refl))))
chopDouble a b zero | inl (inl a<b) | inr a=b rewrite productCancelsLeft 2 (binNatToN a) (binNatToN b) (le 1 refl) a=b = exFalso (PartialOrder.irreflexive (TotalOrder.order TotalOrder) a<b)
chopDouble a b one | inl (inl a<b) with orderIsTotal (2 *N binNatToN a) (2 *N binNatToN b)
chopDouble a b one | inl (inl a<b) with TotalOrder.totality TotalOrder (2 *N binNatToN a) (2 *N binNatToN b)
chopDouble a b one | inl (inl a<b) | inl (inl 2a<2b) = refl
chopDouble a b one | inl (inl a<b) | inl (inr 2b<2a) = exFalso (PartialOrder.irreflexive (TotalOrder.order TotalOrder) (PartialOrder.<Transitive (TotalOrder.order TotalOrder) a<b (cancelInequalityLeft {2} 2b<2a)))
chopDouble a b one | inl (inl a<b) | inr 2a=2b rewrite productCancelsLeft 2 (binNatToN a) (binNatToN b) (le 1 refl) 2a=2b = exFalso (PartialOrder.irreflexive (TotalOrder.order TotalOrder) a<b)
chopDouble a b zero | inl (inr b<a) with orderIsTotal (2 *N binNatToN a) (2 *N binNatToN b)
chopDouble a b zero | inl (inr b<a) with TotalOrder.totality TotalOrder (2 *N binNatToN a) (2 *N binNatToN b)
chopDouble a b zero | inl (inr b<a) | inl (inl 2a<2b) = exFalso (PartialOrder.irreflexive (TotalOrder.order TotalOrder) (PartialOrder.<Transitive (TotalOrder.order TotalOrder) b<a (cancelInequalityLeft {2} {binNatToN a} {binNatToN b} 2a<2b)))
chopDouble a b zero | inl (inr b<a) | inl (inr 2b<2a) = refl
chopDouble a b zero | inl (inr b<a) | inr 2a=2b rewrite productCancelsLeft 2 (binNatToN a) (binNatToN b) (le 1 refl) 2a=2b = exFalso (PartialOrder.irreflexive (TotalOrder.order TotalOrder) b<a)
chopDouble a b one | inl (inr b<a) with orderIsTotal (2 *N binNatToN a) (2 *N binNatToN b)
chopDouble a b one | inl (inr b<a) with TotalOrder.totality TotalOrder (2 *N binNatToN a) (2 *N binNatToN b)
chopDouble a b one | inl (inr b<a) | inl (inl 2a<2b) = exFalso (PartialOrder.irreflexive (TotalOrder.order TotalOrder) (PartialOrder.<Transitive (TotalOrder.order TotalOrder) b<a (cancelInequalityLeft {2} 2a<2b)))
chopDouble a b one | inl (inr b<a) | inl (inr x) = refl
chopDouble a b one | inl (inr b<a) | inr 2a=2b rewrite productCancelsLeft 2 (binNatToN a) (binNatToN b) (le 1 refl) 2a=2b = exFalso (PartialOrder.irreflexive (TotalOrder.order TotalOrder) b<a)
chopDouble a b i | inr x with orderIsTotal (binNatToN (i :: a)) (binNatToN (i :: b))
chopDouble a b i | inr x with TotalOrder.totality TotalOrder (binNatToN (i :: a)) (binNatToN (i :: b))
chopDouble a b zero | inr a=b | inl (inl a<b) rewrite a=b = exFalso (PartialOrder.irreflexive (TotalOrder.order TotalOrder) a<b)
chopDouble a b one | inr a=b | inl (inl a<b) rewrite a=b = exFalso (PartialOrder.irreflexive (TotalOrder.order TotalOrder) a<b)
chopDouble a b zero | inr a=b | inl (inr b<a) rewrite a=b = exFalso (PartialOrder.irreflexive (TotalOrder.order TotalOrder) b<a)
@@ -311,23 +313,23 @@ module Numbers.BinaryNaturals.Order where
succNotLess {succ n} (le x proof) = succNotLess {n} (le x (succInjective (transitivity (applyEquality succ (transitivity (Semiring.commutative Semiring (succ x) (succ n)) (transitivity (applyEquality succ (transitivity (Semiring.commutative Semiring n (succ x)) (applyEquality succ (Semiring.commutative Semiring x n)))) (Semiring.commutative Semiring (succ (succ n)) x)))) proof)))
<BIsInherited : (a b : BinNat) a <BInherited b a <B b
<BIsInherited [] b with orderIsTotal 0 (binNatToN b)
<BIsInherited [] b with TotalOrder.totality TotalOrder 0 (binNatToN b)
<BIsInherited [] b | inl (inl x) with inspect (binNatToN b)
<BIsInherited [] b | inl (inl x) | 0 with pr rewrite binNatToNZero b pr | pr = exFalso (PartialOrder.irreflexive (TotalOrder.order TotalOrder) x)
<BIsInherited [] b | inl (inl x) | (succ bl) with pr rewrite pr = equalityCommutative (zeroLess b λ p zeroNotSucc bl b p pr)
<BIsInherited [] b | inr 0=b rewrite canonicalSecond [] b Equal | binNatToNZero b (equalityCommutative 0=b) = refl
<BIsInherited (a :: as) [] with orderIsTotal (binNatToN (a :: as)) 0
<BIsInherited (a :: as) [] with TotalOrder.totality TotalOrder (binNatToN (a :: as)) 0
<BIsInherited (a :: as) [] | inl (inr x) with inspect (binNatToN (a :: as))
<BIsInherited (a :: as) [] | inl (inr x) | zero with pr rewrite binNatToNZero (a :: as) pr | pr = exFalso (PartialOrder.irreflexive (TotalOrder.order TotalOrder) x)
<BIsInherited (a :: as) [] | inl (inr x) | succ y with pr rewrite pr = equalityCommutative (zeroLess' (a :: as) λ i zeroNotSucc y (a :: as) i pr)
<BIsInherited (a :: as) [] | inr x rewrite canonicalFirst (a :: as) [] Equal | binNatToNZero (a :: as) x = refl
<BIsInherited (zero :: a) (zero :: b) = transitivity (chopDouble a b zero) (<BIsInherited a b)
<BIsInherited (zero :: a) (one :: b) with orderIsTotal (binNatToN (zero :: a)) (binNatToN (one :: b))
<BIsInherited (zero :: a) (one :: b) | inl (inl 2a<2b+1) with orderIsTotal (binNatToN a) (binNatToN b)
<BIsInherited (zero :: a) (one :: b) with TotalOrder.totality TotalOrder (binNatToN (zero :: a)) (binNatToN (one :: b))
<BIsInherited (zero :: a) (one :: b) | inl (inl 2a<2b+1) with TotalOrder.totality TotalOrder (binNatToN a) (binNatToN b)
<BIsInherited (zero :: a) (one :: b) | inl (inl 2a<2b+1) | inl (inl a<b) = equalityCommutative (equalToFirstLess FirstLess a b (equalityCommutative indHyp))
where
t : a <BInherited b FirstLess
t with orderIsTotal (binNatToN a) (binNatToN b)
t with TotalOrder.totality TotalOrder (binNatToN a) (binNatToN b)
t | inl (inl x) = refl
t | inl (inr x) = exFalso (PartialOrder.irreflexive (TotalOrder.order TotalOrder) (PartialOrder.<Transitive (TotalOrder.order TotalOrder) x a<b))
t | inr x rewrite x = exFalso (PartialOrder.irreflexive (TotalOrder.order TotalOrder) a<b)
@@ -335,12 +337,12 @@ module Numbers.BinaryNaturals.Order where
indHyp = transitivity (equalityCommutative t) (<BIsInherited a b)
<BIsInherited (zero :: a) (one :: b) | inl (inl 2a<2b+1) | inl (inr b<a) = exFalso (noIntegersBetweenXAndSuccX {2 *N binNatToN a} (2 *N binNatToN b) (lessRespectsMultiplicationLeft (binNatToN b) (binNatToN a) 2 b<a (le 1 refl)) 2a<2b+1)
<BIsInherited (zero :: a) (one :: b) | inl (inl 2a<2b+1) | inr a=b rewrite a=b | canonicalFirst a b FirstLess | canonicalSecond (canonical a) b FirstLess | transitivity (equalityCommutative (binToBin a)) (transitivity (applyEquality NToBinNat a=b) (binToBin b)) = equalityCommutative (lemma1 (canonical b))
<BIsInherited (zero :: a) (one :: b) | inl (inr 2b+1<2a) with orderIsTotal (binNatToN a) (binNatToN b)
<BIsInherited (zero :: a) (one :: b) | inl (inr 2b+1<2a) with TotalOrder.totality TotalOrder (binNatToN a) (binNatToN b)
<BIsInherited (zero :: a) (one :: b) | inl (inr 2b+1<2a) | inl (inl a<b) = exFalso (PartialOrder.irreflexive (TotalOrder.order TotalOrder) (PartialOrder.<Transitive (TotalOrder.order TotalOrder) 2b+1<2a (PartialOrder.<Transitive (TotalOrder.order TotalOrder) (lessRespectsMultiplicationLeft (binNatToN a) (binNatToN b) 2 a<b (le 1 refl)) (le zero refl))))
<BIsInherited (zero :: a) (one :: b) | inl (inr 2b+1<2a) | inl (inr b<a) = equalityCommutative (equalToFirstGreater FirstLess a b (equalityCommutative indHyp))
where
t : a <BInherited b FirstGreater
t with orderIsTotal (binNatToN a) (binNatToN b)
t with TotalOrder.totality TotalOrder (binNatToN a) (binNatToN b)
t | inl (inl x) = exFalso (PartialOrder.irreflexive (TotalOrder.order TotalOrder) (PartialOrder.<Transitive (TotalOrder.order TotalOrder) x b<a))
t | inl (inr x) = refl
t | inr x rewrite x = exFalso (PartialOrder.irreflexive (TotalOrder.order TotalOrder) b<a)
@@ -348,12 +350,12 @@ module Numbers.BinaryNaturals.Order where
indHyp = transitivity (equalityCommutative t) (<BIsInherited a b)
<BIsInherited (zero :: a) (one :: b) | inl (inr 2b+1<2a) | inr a=b rewrite a=b = exFalso (succNotLess 2b+1<2a)
<BIsInherited (zero :: a) (one :: b) | inr 2a=2b+1 = exFalso (parity (binNatToN b) (binNatToN a) (equalityCommutative 2a=2b+1))
<BIsInherited (one :: a) (zero :: b) with orderIsTotal (binNatToN (one :: a)) (binNatToN (zero :: b))
<BIsInherited (one :: a) (zero :: b) | inl (inl 2a+1<2b) with orderIsTotal (binNatToN a) (binNatToN b)
<BIsInherited (one :: a) (zero :: b) with TotalOrder.totality TotalOrder (binNatToN (one :: a)) (binNatToN (zero :: b))
<BIsInherited (one :: a) (zero :: b) | inl (inl 2a+1<2b) with TotalOrder.totality TotalOrder (binNatToN a) (binNatToN b)
<BIsInherited (one :: a) (zero :: b) | inl (inl 2a+1<2b) | inl (inl a<b) = equalityCommutative (equalToFirstLess FirstGreater a b (equalityCommutative indHyp))
where
t : a <BInherited b FirstLess
t with orderIsTotal (binNatToN a) (binNatToN b)
t with TotalOrder.totality TotalOrder (binNatToN a) (binNatToN b)
t | inl (inr x) = exFalso (PartialOrder.irreflexive (TotalOrder.order TotalOrder) (PartialOrder.<Transitive (TotalOrder.order TotalOrder) x a<b))
t | inl (inl x) = refl
t | inr x rewrite x = exFalso (PartialOrder.irreflexive (TotalOrder.order TotalOrder) a<b)
@@ -361,12 +363,12 @@ module Numbers.BinaryNaturals.Order where
indHyp = transitivity (equalityCommutative t) (<BIsInherited a b)
<BIsInherited (one :: a) (zero :: b) | inl (inl 2a+1<2b) | inl (inr b<a) = exFalso (PartialOrder.irreflexive (TotalOrder.order TotalOrder) (PartialOrder.<Transitive (TotalOrder.order TotalOrder) 2a+1<2b (PartialOrder.<Transitive (TotalOrder.order TotalOrder) (lessRespectsMultiplicationLeft (binNatToN b) (binNatToN a) 2 b<a (le 1 refl)) (le zero refl))))
<BIsInherited (one :: a) (zero :: b) | inl (inl 2a+1<2b) | inr a=b rewrite a=b = exFalso (succNotLess 2a+1<2b)
<BIsInherited (one :: a) (zero :: b) | inl (inr 2b<2a+1) with orderIsTotal (binNatToN a) (binNatToN b)
<BIsInherited (one :: a) (zero :: b) | inl (inr 2b<2a+1) with TotalOrder.totality TotalOrder (binNatToN a) (binNatToN b)
<BIsInherited (one :: a) (zero :: b) | inl (inr 2b<2a+1) | inl (inl a<b) = exFalso (noIntegersBetweenXAndSuccX {2 *N binNatToN b} (2 *N binNatToN a) (lessRespectsMultiplicationLeft (binNatToN a) (binNatToN b) 2 a<b (le 1 refl)) 2b<2a+1)
<BIsInherited (one :: a) (zero :: b) | inl (inr 2b<2a+1) | inl (inr b<a) = equalityCommutative (equalToFirstGreater FirstGreater a b (equalityCommutative indHyp))
where
t : a <BInherited b FirstGreater
t with orderIsTotal (binNatToN a) (binNatToN b)
t with TotalOrder.totality TotalOrder (binNatToN a) (binNatToN b)
t | inl (inl x) = exFalso (PartialOrder.irreflexive (TotalOrder.order TotalOrder) (PartialOrder.<Transitive (TotalOrder.order TotalOrder) x b<a))
t | inl (inr x) = refl
t | inr x rewrite x = exFalso (PartialOrder.irreflexive (TotalOrder.order TotalOrder) b<a)

View File

@@ -2,6 +2,7 @@
open import LogicalFormulae
open import Lists.Lists
open import Numbers.Naturals.Semiring
open import Numbers.Naturals.Naturals
open import Numbers.Naturals.Order
open import Numbers.BinaryNaturals.Definition