BoehmStructure
Todd Waugh Ambridge, January 2024 # Structural properties of ternary Boehm encodings{-# OPTIONS --without-K --safe #-} open import Integers.Addition renaming (_+_ to _â€+_) open import Notation.Order open import Integers.Order open import Integers.Type open import MLTT.Spartan open import Naturals.Addition renaming (_+_ to _â+_) open import TWA.Thesis.Chapter5.Integers module TWA.Thesis.Chapter5.BoehmStructure where## downLeft, downMid and downRightdownLeft downMid downRight : †â †downLeft a = a â€+ a downMid a = succ†(downLeft a) downRight a = succ†(downMid a)## downLeft and downRight propertiespred-downMid : (a : â€) â pred†(downMid a) ïŒ downLeft a pred-downMid a = predsucc†_ pred-downRight : (a : â€) â pred†(downRight a) ïŒ downMid a pred-downRight a = predsucc†_ pred-pred-downRight : (a : â€) â pred†(pred†(downRight a)) ïŒ downLeft a pred-pred-downRight a = ap pred†(predsucc†_) â predsucc†_ downLeft-monotone' : (a b : â€) â ((n , _) : a â€â€ b) â downLeft a +pos (n â+ n) ïŒ downLeft b downLeft-monotone' a b (n , refl) = ap ((a â€+ a) â€+_) (distributivity-pos-addition n n â»Âč) â â€+-rearrangement (a â€+ a) (pos n) (pos n) â»Âč â ap (λ - â (- +pos n) +pos n) (â€+-comm a a) â ap (_+pos n) (â€+-assoc a a (pos n) â ap (a â€+_) (â€+-comm a (pos n)) â â€+-assoc a (pos n) a â»Âč) â â€+-assoc (a +pos n) a (pos n) â€â€<-trans : (a b c : â€) â a â€â€ b â b <†c â a <†c â€â€<-trans a b c (m , refl) (n , refl) = m â+ n , (ap (succ†a â€+_) (distributivity-pos-addition m n â»Âč) â â€+-assoc (succ†a) (pos m) (pos n) â»Âč â ap (_+pos n) (â€-left-succ-pos a m)) downLeft<<downRight : (a b : â€) â a <†b â downLeft a <†downRight b downLeft<<downRight a b (n , refl) = (succ (succ (succ (n â+ n)))) , ap (succ†â succâ€) (ap succ†(ap (_+pos (n â+ n)) (â€-left-succ a a â»Âč) â ap ((succ†a â€+ a) â€+_) (distributivity-pos-addition n n â»Âč) â â€+-rearrangement (succ†a â€+ a) (pos n) (pos n) â»Âč â ap (λ - â (- +pos n) +pos n) (â€+-comm (succ†a) a) â ap (_+pos n) (â€+-assoc a (succ†a) (pos n) â ap (a â€+_) (â€+-comm (succ†a) (pos n)) â â€+-assoc a (pos n) (succ†a) â»Âč) â â€+-assoc (a +pos n) (succ†a) (pos n)) â â€-left-succ (a +pos n) (succ†a +pos n) â»Âč â ap (_â€+ (succ†a +pos n)) (â€-left-succ-pos a n â»Âč)) downLeft<downRight : (a : â€) (n : â) â rec a downLeft (succ n) <†rec a downRight (succ n) downLeft<downRight a zero = 1 , refl downLeft<downRight a (succ n) = downLeft<<downRight _ _ (downLeft<downRight a n) downLeftâ€downRight : (a : â€) (n : â) â rec a downLeft n â€â€ rec a downRight n downLeftâ€downRight a 0 = zero , refl downLeftâ€downRight a (succ n) = <-is-†_ _ (downLeft<downRight a n) downLeft-â€-succ : (a : â€) â downLeft a â€â€ downLeft (succ†a) downLeft-â€-succ a = 2 , (ap succ†(â€-left-succ a a â»Âč) â â€-right-succ (succ†a) a â»Âč) downLeft-monotone : (a b : â€) â a â€â€ b â downLeft a â€â€ downLeft b downLeft-monotone = â€-succ-to-monotone downLeft downLeft-â€-succ downLeftâż-monotone : (a b : â€) (n : â) â a â€â€ b â rec a downLeft (succ n) â€â€ rec b downLeft (succ n) downLeftâż-monotone a b 0 aâ€b = downLeft-monotone a b aâ€b downLeftâż-monotone a b (succ n) aâ€b = downLeft-monotone _ _ (downLeftâż-monotone a b n aâ€b) downRight-â€-succ : (a : â€) â downRight a â€â€ downRight (succ†a) downRight-â€-succ a = 2 , ap (succ†â succâ€) (prâ (downLeft-â€-succ a)) downRight-monotone : (a b : â€) â a â€â€ b â downRight a â€â€ downRight b downRight-monotone = â€-succ-to-monotone downRight downRight-â€-succ downRightâż-monotone : (a b : â€) (n : â) â a â€â€ b â rec a downRight (succ n) â€â€ rec b downRight (succ n) downRightâż-monotone a b 0 aâ€b = downRight-monotone a b aâ€b downRightâż-monotone a b (succ n) aâ€b = downRight-monotone _ _ (downRightâż-monotone a b n aâ€b) downLeftâ€<downRight : (a b : â€) â a â€â€ b â downLeft a <†downRight b downLeftâ€<downRight a b aâ€b = â€â€<-trans _ _ _ (downLeft-monotone _ _ aâ€b) (downLeft<downRight b 0) downLeftâ downMid : (a b : â€) â a ïŒ b â downLeft a â downMid b downLeftâ downMid a a refl = â€-less-not-equal (downLeft a) (downMid a) (0 , refl) downLeftâ downRight : (a b : â€) â a ïŒ b â downLeft a â downRight b downLeftâ downRight a a refl = â€-less-not-equal (downLeft a) (downRight a) (1 , refl) downMidâ downRight : (a b : â€) â a ïŒ b â downMid a â downRight b downMidâ downRight a a refl = â€-less-not-equal (downMid a) (downRight a) (0 , refl) downRightïŒdownLeft : (a : â€) â downRight a ïŒ downLeft (succ†a) downRightïŒdownLeft a = ap succ†(â€-left-succ a a â»Âč â â€+-comm (succ†a) a) â â€-left-succ a (succ†a) â»Âč## below and below'_below_ : †â †â đ€â Ì a below b = downLeft b †a †downRight b downLeft-below : (a : â€) â downLeft a below a downLeft-below a = (0 , refl) , (2 , refl) downMid-below : (a : â€) â downMid a below a downMid-below a = (1 , refl) , (1 , refl) downRight-below : (a : â€) â downRight a below a downRight-below a = (2 , refl) , (0 , refl) _below'_ : †â †â đ€â Ì a below' b = (a ïŒ downLeft b) + (a ïŒ downMid b) + (a ïŒ downRight b) below'-implies-below : (a b : â€) â a below' b â a below b below'-implies-below .(downLeft b) b (inl refl ) = downLeft-below b below'-implies-below .(downMid b) b (inr (inl refl)) = downMid-below b below'-implies-below .(downRight b) b (inr (inr refl)) = downRight-below b below-implies-below' : (a b : â€) â a below b â a below' b below-implies-below' a b ((0 , e) , _) = inl (e â»Âč) below-implies-below' a b ((1 , e) , _) = (inr â inl) (e â»Âč) below-implies-below' a b ((2 , e) , _) = (inr â inr) (e â»Âč) below-implies-below' a b ((succ (succ (succ _)) , _) , (0 , f)) = (inr â inr) f below-implies-below' a b ((succ (succ (succ _)) , _) , (1 , f)) = (inr â inl) (succâ€-lc f) below-implies-below' a b ((succ (succ (succ _)) , _) , (2 , f)) = inl (succâ€-lc (succâ€-lc f)) below-implies-below' a b ((succ (succ (succ n)) , e) , (succ (succ (succ m)) , f)) = đ-elim (kâ 2 kïŒ2) where k : â k = (succ (succ (succ (succ (succ (succ (n â+ m))))))) η : downLeft b +pos k ïŒ downRight b η = ap ((succ†^ 6) â downLeft b â€+_) (distributivity-pos-addition n m â»Âč) â ap (succ†^ 6) (â€+-assoc (downLeft b) (pos n) (pos m) â»Âč) â ap (succ†^ 5) (â€-left-succ-pos (downLeft b +pos n) m â»Âč) â ap (succ†^ 4) (â€-left-succ-pos (succ†(downLeft b +pos n)) m â»Âč) â ap (succ†^ 3) (â€-left-succ-pos ((succ†^ 2) (downLeft b +pos n)) m â»Âč) â ap ((succ†^ 3) â (_+pos m)) e â f ζ : downLeft b +pos 2 ïŒ downRight b ζ = refl kïŒ2 : k ïŒ 2 kïŒ2 = pos-lc (â€+-lc (pos k) (pos 2) (downLeft b) (η â ζ â»Âč)) kâ 2 : k â 2 kâ 2 = λ ()## upLeft and upRightupRight : †â †upRight x = sign x (num x /2) upLeft : †â †upLeft x = upRight (pred†x)## upLeft and upRight propertiesupRight-suc : (a : â€) â upRight (succ†(succ†a)) ïŒ succ†(upRight a) upRight-suc (pos zero) = refl upRight-suc (pos (succ zero)) = refl upRight-suc (pos (succ (succ x))) = refl upRight-suc (negsucc zero) = refl upRight-suc (negsucc (succ zero)) = refl upRight-suc (negsucc (succ (succ x))) = refl upRight-pred : (a : â€) â upRight (pred†(pred†a)) ïŒ pred†(upRight a) upRight-pred (pos 0) = refl upRight-pred (pos 1) = refl upRight-pred (pos (succ (succ x))) = refl upRight-pred (negsucc 0) = refl upRight-pred (negsucc 1) = refl upRight-pred (negsucc (succ (succ x))) = refl upLeft-suc : (a : â€) â upLeft (succ†(succ†a)) ïŒ succ†(upLeft a) upLeft-suc (pos zero) = refl upLeft-suc (pos (succ zero)) = refl upLeft-suc (pos (succ (succ x))) = refl upLeft-suc (negsucc zero) = refl upLeft-suc (negsucc (succ zero)) = refl upLeft-suc (negsucc (succ (succ x))) = refl upLeft-pred : (a : â€) â upLeft (pred†(pred†a)) ïŒ pred†(upLeft a) upLeft-pred = upRight-pred â pred†upRight-succ-pos : (a : â) â upRight (pos a) â€â€ upRight (succ†(pos a)) upRight-succ-pos 0 = 0 , refl upRight-succ-pos 1 = 1 , refl upRight-succ-pos (succ (succ a)) = m , (â€-left-succ-pos (pos (a /2)) m â ap succ†(prâ IH)) where IH = upRight-succ-pos a m = prâ IH upRight-succ-negsucc : (a : â) â upRight (negsucc a) â€â€ upRight (succ†(negsucc a)) upRight-succ-negsucc 0 = 1 , refl upRight-succ-negsucc 1 = 0 , refl upRight-succ-negsucc (succ (succ a)) = m , (â€-left-pred-pos (negsucc (a /2)) m â ap pred†(prâ IH) â upRight-pred _ â»Âč â ap (upRight â predâ€) (predsucc†_)) where IH = upRight-succ-negsucc a m = prâ IH upRight-â€-succ : (a : â€) â upRight a â€â€ upRight (succ†a) upRight-â€-succ = â€-elim (λ a â upRight a â€â€ upRight (succ†a)) upRight-succ-pos upRight-succ-negsucc upRight-monotone : (a b : â€) â a â€â€ b â upRight a â€â€ upRight b upRight-monotone = â€-succ-to-monotone upRight upRight-â€-succ upLeft-monotone : (a b : â€) â a â€â€ b â upLeft a â€â€ upLeft b upLeft-monotone a b (n , refl) = upRight-monotone _ _ (n , â€-left-pred-pos a n) upRightâ€upLeft-succ : (a : â€) â upRight a ïŒ upLeft (succ†a) upRightâ€upLeft-succ a = ap upRight (predsucc†_ â»Âč) upRightâ€upLeft : (a b : â€) â a <†b â upRight a â€â€ upLeft b upRightâ€upLeft a b (n , refl) = transport (_â€â€ upLeft (succ†a +pos n)) (upRightâ€upLeft-succ a â»Âč) (upLeft-monotone _ _ (n , refl)) upRight-<-succ-succ : (a : â€) â upRight a <†upRight (succ†(succ†a)) upRight-<-succ-succ a = transport (upRight a <â€_) (upRight-suc a â»Âč) (0 , refl) upRight-<<' : (a b : â€) (n : â) â (a +pos succ n) ïŒ pred†b â upRight a <†upRight b upRight-<<' a b zero e = transport (λ - â upRight a <†upRight -) (ap succ†e â succpred†_) (upRight-<-succ-succ a) upRight-<<' a b (succ n) e = transport (λ - â upRight a <†upRight -) (ap succ†e â succpred†_) (â€â€-trans _ _ _ (upRight-<-succ-succ a) (upRight-monotone _ _ (succ n , ap succ†(â€-left-succ-pos (succ†a) n â ap succ†(â€-left-succ-pos a n))))) upRight-<< : (a b : â€) â a <†pred†b â upRight a <†upRight b upRight-<< a b (n , e) = upRight-<<' a b n (â€-left-succ-pos a n â»Âč â e) upLeft-<< : (a b : â€) â a <†b â upLeft a <†upRight b upLeft-<< a b (n , refl) = upRight-<< (pred†a) b (n , (ap (_+pos n) (succpred†_) â predsucc†_ â»Âč â ap pred†(â€-left-succ-pos a n â»Âč)))## above and above'_above_ : †â †â đ€â Ì b above a = upLeft a â€â€ b â€â€ upRight a _above'_ : †â †â đ€â Ì a above' b = (a ïŒ upLeft b) + (a ïŒ upRight b) upLeft-ïŒ-+-pos : (a : â) â (upLeft (pos a) ïŒ upRight (pos a)) + (succ†(upLeft (pos a)) ïŒ upRight (pos a)) upLeft-ïŒ-+-pos 0 = inr refl upLeft-ïŒ-+-pos 1 = inl refl upLeft-ïŒ-+-pos (succ (succ a)) = Cases (upLeft-ïŒ-+-pos a) (λ l â inl (upLeft-suc (pos a) â ap succ†l)) (λ r â inr (ap succ†(upLeft-suc (pos a) â r))) upLeft-ïŒ-+-negsucc : (a : â) â (upLeft (negsucc a) ïŒ upRight (negsucc a)) + (succ†(upLeft (negsucc a)) ïŒ upRight (negsucc a)) upLeft-ïŒ-+-negsucc 0 = inl refl upLeft-ïŒ-+-negsucc 1 = inr refl upLeft-ïŒ-+-negsucc (succ (succ a)) = Cases (upLeft-ïŒ-+-negsucc a) (λ l â inl (upLeft-pred (negsucc a) â ap pred†l)) (λ r â inr (predsucc†_ â»Âč â ap pred†r)) upLeft-ïŒ-+ : (a : â€) â (upLeft a ïŒ upRight a) + (succ†(upLeft a) ïŒ upRight a) upLeft-ïŒ-+ = â€-elim _ upLeft-ïŒ-+-pos upLeft-ïŒ-+-negsucc upLeftâ€upRight : (a : â€) â upLeft a â€â€ upRight a upLeftâ€upRight a = upRight-monotone _ _ (1 , succpred†_) upLeft-upRight-mono : (a b : â€) â a â€â€ b â upLeft a â€â€ upRight b upLeft-upRight-mono a b aâ€b = â€â€-trans _ _ _ (upLeft-monotone _ _ aâ€b) (upLeftâ€upRight b) upLeftâ€upRightâż : (a : â€) (n : â) â rec a upLeft n â€â€ rec a upRight n upLeftâ€upRightâż a 0 = â€â€-refl a upLeftâ€upRightâż a 1 = upLeftâ€upRight a upLeftâ€upRightâż a (succ (succ n)) = upLeft-upRight-mono _ _ (upLeftâ€upRightâż a (succ n)) upLeft-above : (a : â€) â upLeft a above a upLeft-above a = â€â€-refl _ , upLeftâ€upRight a upRight-above : (a : â€) â upRight a above a upRight-above a = upLeftâ€upRight a , â€â€-refl _ above'-implies-above : (a b : â€) â a above' b â a above b above'-implies-above .(upLeft b) b (inl refl) = upLeft-above b above'-implies-above .(upRight b) b (inr refl) = upRight-above b above-implies-above' : (a b : â€) â a above b â a above' b above-implies-above' a b (lâ€a , aâ€r) = Cases (â€â€-split (upLeft b) a lâ€a) (λ l<a â Cases (â€â€-split a (upRight b) aâ€r) (λ a<r â đ-elim (Cases (upLeft-ïŒ-+ b) (λ e â â€-less-not-bigger-or-equal (upLeft b) a l<a (transport (a â€â€_) (e â»Âč) aâ€r)) (λ e â â€-less-not-bigger-or-equal a (upRight b) a<r (transport (_â€â€ a) e l<a)))) inr) (inl â _â»Âč)## Relationship between below and aboveupRight-downLeft-pos : (b : â) â pos b ïŒ upRight (downLeft (pos b)) upRight-downLeft-pos 0 = refl upRight-downLeft-pos (succ b) = ap succ†(upRight-downLeft-pos b) â upRight-suc (downLeft (pos b)) â»Âč â ap (upRight â succâ€) (â€-left-succ-pos (pos b) b â»Âč) upRight-downLeft-negsucc : (b : â) â negsucc b ïŒ upRight (downLeft (negsucc b)) upRight-downLeft-negsucc 0 = refl upRight-downLeft-negsucc (succ b) = ap pred†(upRight-downLeft-negsucc b) â upRight-pred (downLeft (negsucc b)) â»Âč â ap (upRight â predâ€) (â€-left-pred-negsucc (negsucc b) b â»Âč) upRight-downMid-pos : (b : â) â pos b ïŒ upRight (downMid (pos b)) upRight-downMid-pos 0 = refl upRight-downMid-pos (succ b) = ap succ†(upRight-downMid-pos b) â upRight-suc (downMid (pos b)) â»Âč â ap (upRight â succ†â succâ€) (â€-left-succ-pos (pos b) b â»Âč) upRight-downMid-negsucc : (b : â) â negsucc b ïŒ upRight (downMid (negsucc b)) upRight-downMid-negsucc 0 = refl upRight-downMid-negsucc (succ b) = ap pred†(upRight-downMid-negsucc b) â upRight-pred (downMid (negsucc b)) â»Âč â ap (upRight â predâ€) (predsucc†_) â ap upRight (â€-left-pred-negsucc (negsucc b) b â»Âč) â ap upRight (succpred†_ â»Âč) upRight-downLeft : (a : â€) â a ïŒ upRight (downLeft a) upRight-downLeft = â€-elim _ upRight-downLeft-pos upRight-downLeft-negsucc upRight-downMid : (a : â€) â a ïŒ upRight (downMid a) upRight-downMid = â€-elim _ upRight-downMid-pos upRight-downMid-negsucc upRight-downRight : (a : â€) â succ†a ïŒ upRight (downRight a) upRight-downRight a = ap succ†(upRight-downLeft a) â upRight-suc (downLeft a) â»Âč upLeft-downLeft : (a : â€) â succ†(upLeft (downLeft a)) ïŒ a upLeft-downLeft a = upRight-suc (pred†(downLeft a)) â»Âč â ap (upRight â succâ€) (succpred†_) â upRight-downMid a â»Âč upLeft-downMid : (a : â€) â upLeft (downMid a) ïŒ a upLeft-downMid a = ap upRight (pred-downMid a) â upRight-downLeft a â»Âč upLeft-downRight : (a : â€) â upLeft (downRight a) ïŒ a upLeft-downRight a = ap upRight (pred-downRight a) â upRight-downMid a â»Âč below-implies-above-dL : (b : â€) â b above (downLeft b) below-implies-above-dL b = (1 , upLeft-downLeft b) , (0 , upRight-downLeft b) below-implies-above-dM : (b : â€) â b above (downMid b) below-implies-above-dM b = (0 , upLeft-downMid b) , (0 , upRight-downMid b) below-implies-above-dR : (b : â€) â b above (downRight b) below-implies-above-dR b = (0 , upLeft-downRight b) , (1 , upRight-downRight b) below'-implies-above : (a b : â€) â a below' b â b above a below'-implies-above .(downLeft b) b (inl refl) = below-implies-above-dL b below'-implies-above .(downMid b) b (inr (inl refl)) = below-implies-above-dM b below'-implies-above .(downRight b) b (inr (inr refl)) = below-implies-above-dR b dL-transform : (a : â€) â downLeft (succ†a) ïŒ (succ†^ 2) (downLeft a) dL-transform a = â€-left-succ a (succ†a) â ap succ†(â€-right-succ a a) dL-transform-pred : (a : â€) â downLeft (pred†a) ïŒ (pred†^ 2) (downLeft a) dL-transform-pred a = â€-left-pred a (pred†a) â ap pred†(â€-right-pred a a) dR-transform : (a : â€) â downRight (succ†a) ïŒ (succ†^ 2) (downRight a) dR-transform a = ap (succ†^ 2) (dL-transform a) dR-transform-pred : (a b : â€) â downRight (pred†a) ïŒ (pred†^ 2) (downRight a) dR-transform-pred a b = ap (succ†^ 2) (dL-transform-pred a) â ap succ†(succpred†_) â succpred†_ â predsucc†_ â»Âč â ap pred†(predsucc†_ â»Âč) downLeft-upRight : (b : â€) â downLeft (upRight b) â€â€ b downLeft-upRight = â€-elim _ downLeft-upRight-pos downLeft-upRight-negsucc where downLeft-upRight-pos : (b : â) â downLeft (upRight (pos b)) â€â€ pos b downLeft-upRight-pos 0 = 0 , refl downLeft-upRight-pos 1 = 1 , refl downLeft-upRight-pos (succ (succ b)) = transport (_â€â€ succ†(succ†(pos b))) ((ap downLeft (upRight-suc (pos b)) â dL-transform (upRight (pos b))) â»Âč) (â€â€-succâż-inj _ _ 2 (downLeft-upRight-pos b)) downLeft-upRight-negsucc : (b : â) â downLeft (upRight (negsucc b)) â€â€ negsucc b downLeft-upRight-negsucc 0 = 1 , refl downLeft-upRight-negsucc 1 = 0 , refl downLeft-upRight-negsucc (succ (succ b)) = transport (_â€â€ pred†(pred†(negsucc b))) ((ap downLeft (upRight-pred (negsucc b)) â dL-transform-pred (upRight (negsucc b))) â»Âč) (â€â€-predâż-inj _ _ 2 (downLeft-upRight-negsucc b)) downLeft-upLeft : (b : â€) â downLeft (upLeft b) â€â€ b downLeft-upLeft b = â€â€-trans _ _ _ (downLeft-monotone _ _ (upLeftâ€upRight b)) (downLeft-upRight b) downRight-upLeft-pos : (b : â) â pos b â€â€ downRight (upLeft (pos b)) downRight-upLeft-pos 0 = 0 , refl downRight-upLeft-pos 1 = 1 , refl downRight-upLeft-pos (succ (succ b)) = transport ((succ†^ 2) (pos b) â€â€_) ((ap downRight (upLeft-suc (pos b)) â dR-transform (upLeft (pos b))) â»Âč) (â€â€-succâż-inj _ _ 2 (downRight-upLeft-pos b)) downRight-upLeft-negsucc : (b : â) â negsucc b â€â€ downRight (upLeft (negsucc b)) downRight-upLeft-negsucc 0 = 1 , refl downRight-upLeft-negsucc 1 = 0 , refl downRight-upLeft-negsucc (succ (succ b)) = transport ((pred†^ 2) (negsucc b) â€â€_) ((ap downRight (upLeft-pred (negsucc b)) â dR-transform-pred (upLeft (negsucc b)) (pos b)) â»Âč) (â€â€-predâż-inj _ _ 2 (downRight-upLeft-negsucc b)) downRight-upLeft : (b : â€) â b â€â€ downRight (upLeft b) downRight-upLeft = â€-elim _ downRight-upLeft-pos downRight-upLeft-negsucc downRight-upRight : (b : â€) â b â€â€ downRight (upRight b) downRight-upRight b = â€â€-trans _ _ _ (downRight-upLeft b) (downRight-monotone _ _ (upLeftâ€upRight b)) above-upRight : (b : â€) â b below (upRight b) above-upRight b = downLeft-upRight b , downRight-upRight b above-upLeft : (b : â€) â b below (upLeft b) above-upLeft b = downLeft-upLeft b , downRight-upLeft b above'-implies-below : (a b : â€) â a above' b â b below a above'-implies-below .(upLeft b) b (inl refl) = above-upLeft b above'-implies-below .(upRight b) b (inr refl) = above-upRight b above-implies-below : (a b : â€) â a above b â b below a above-implies-below a b = above'-implies-below a b â above-implies-above' a b below-implies-above : (a b : â€) â a below b â b above a below-implies-above a b = below'-implies-above a b â below-implies-below' a b above-downLeft : (a : â€) â a above (downLeft a) above-downLeft a = below-implies-above (downLeft a) a (downLeft-below a) above-downMid : (a : â€) â a above (downMid a) above-downMid a = below-implies-above (downMid a) a (downMid-below a) above-downRight : (a : â€) â a above (downRight a) above-downRight a = below-implies-above (downRight a) a (downRight-below a)