|
| 1 | +{-- |
| 2 | +Defines the structure group of a heap, |
| 3 | +proves that a group is equivalently a pointed heap. |
| 4 | +TODO: A heap is equivalently a group equipped with a torsor |
| 5 | +--} |
| 6 | + |
| 7 | +module Cubical.Algebra.Heap.Properties where |
| 8 | + |
| 9 | +open import Cubical.Foundations.Prelude |
| 10 | +open import Cubical.Foundations.Equiv |
| 11 | +open import Cubical.Foundations.Function |
| 12 | +open import Cubical.Foundations.Isomorphism |
| 13 | +open import Cubical.Foundations.Univalence |
| 14 | +open import Cubical.Foundations.Structure |
| 15 | + |
| 16 | +open import Cubical.HITs.PropositionalTruncation as PT |
| 17 | + |
| 18 | +open import Cubical.Algebra.Group |
| 19 | +open import Cubical.Algebra.Group.Morphisms |
| 20 | +open import Cubical.Algebra.Group.MorphismProperties |
| 21 | +open import Cubical.Algebra.Group.GroupPath |
| 22 | + |
| 23 | +open import Cubical.Algebra.Heap.Base |
| 24 | + |
| 25 | +private variable |
| 26 | + ℓ : Level |
| 27 | + |
| 28 | +module _ (G : Group ℓ) where |
| 29 | + open HeapStr |
| 30 | + open IsHeap |
| 31 | + open GroupStr (snd G) renaming (is-set to G-is-set) |
| 32 | + |
| 33 | + GroupHasHeapStr : HeapStr ⟨ G ⟩ |
| 34 | + GroupHasHeapStr .[_,_,_] a b c = a · inv b · c |
| 35 | + GroupHasHeapStr .isHeap .is-set = G-is-set |
| 36 | + GroupHasHeapStr .isHeap .assoc a b c d e = ·Assoc a (inv b) (c · inv d · e) ∙∙ ·Assoc (a · inv b) c (inv d · e) ∙∙ congL _·_ (sym (·Assoc a (inv b) c)) |
| 37 | + GroupHasHeapStr .isHeap .idl a b = ·GroupAutomorphismL G a .Iso.rightInv b |
| 38 | + GroupHasHeapStr .isHeap .idr a b = congR _·_ (·InvL b) ∙ ·IdR a |
| 39 | + GroupHasHeapStr .isHeap .inhab = ∣ 1g ∣₁ |
| 40 | + |
| 41 | + GroupHeap : Heap ℓ |
| 42 | + GroupHeap = ⟨ G ⟩ , GroupHasHeapStr |
| 43 | + |
| 44 | +module HeapTheory (H : Heap ℓ) where |
| 45 | + open HeapStr (snd H) public |
| 46 | + |
| 47 | + wriggle : ∀ a b c d → [ [ a , b , c ] , d , [ d , c , b ] ] ≡ a |
| 48 | + wriggle a b c d = |
| 49 | + [ [ a , b , c ] , d , [ d , c , b ] ] ≡⟨ assoc [ a , b , c ] d d c b ⟩ |
| 50 | + [ [ [ a , b , c ] , d , d ] , c , b ] ≡⟨ cong [_, c , b ] (idr [ a , b , c ] d) ⟩ |
| 51 | + [ [ a , b , c ] , c , b ] ≡⟨ sym (assoc a b c c b) ⟩ |
| 52 | + [ a , b , [ c , c , b ] ] ≡⟨ cong [ a , b ,_] (idl c b) ⟩ |
| 53 | + [ a , b , b ] ≡⟨ idr a b ⟩ |
| 54 | + a ∎ |
| 55 | + |
| 56 | + assocl : ∀ a b c d e → [ a , [ d , c , b ] , e ] ≡ [ [ a , b , c ] , d , e ] |
| 57 | + assocl a b c d e = |
| 58 | + [ a , [ d , c , b ] , e ] ≡⟨ cong [_, [ d , c , b ] , e ] (sym (wriggle a b c d)) ⟩ |
| 59 | + [ [ [ a , b , c ] , d , [ d , c , b ] ] , [ d , c , b ] , e ] ≡⟨ sym (assoc [ a , b , c ] d [ d , c , b ] [ d , c , b ] e) ⟩ |
| 60 | + [ [ a , b , c ] , d , [ [ d , c , b ] , [ d , c , b ] , e ] ] ≡⟨ cong [ [ a , b , c ] , d ,_] (idl [ d , c , b ] e) ⟩ |
| 61 | + [ [ a , b , c ] , d , e ] ∎ |
| 62 | + |
| 63 | + assocr : ∀ a b c d e → [ a , [ d , c , b ] , e ] ≡ [ a , b , [ c , d , e ] ] |
| 64 | + assocr a b c d e = |
| 65 | + [ a , [ d , c , b ] , e ] ≡⟨ assocl a b c d e ⟩ |
| 66 | + [ [ a , b , c ] , d , e ] ≡⟨ sym (assoc a b c d e) ⟩ |
| 67 | + [ a , b , [ c , d , e ] ] ∎ |
| 68 | + |
| 69 | + idlr : ∀ a b c → [ a , [ b , c , a ] , b ] ≡ c |
| 70 | + idlr a b c = |
| 71 | + [ a , [ b , c , a ] , b ] ≡⟨ assocr a a c b b ⟩ |
| 72 | + [ a , a , [ c , b , b ] ] ≡⟨ idl a [ c , b , b ] ⟩ |
| 73 | + [ c , b , b ] ≡⟨ idr c b ⟩ |
| 74 | + c ∎ |
| 75 | + |
| 76 | +StructureGroup : Heap ℓ → Group ℓ |
| 77 | +StructureGroup H = toldYaSo inhab module StructureGroup where |
| 78 | + open GroupStr hiding (is-set) |
| 79 | + open HeapTheory H |
| 80 | + |
| 81 | + fromPoint : ⟨ H ⟩ → Group _ |
| 82 | + fromPoint e .fst = ⟨ H ⟩ |
| 83 | + fromPoint e .snd .1g = e |
| 84 | + fromPoint e .snd ._·_ a b = [ a , e , b ] |
| 85 | + fromPoint e .snd .inv a = [ e , a , e ] |
| 86 | + fromPoint e .snd .isGroup = makeIsGroup is-set |
| 87 | + (λ x y z → assoc x e y e z) |
| 88 | + (λ x → idr x e) -- is that a maybeJosiah reference |
| 89 | + (λ x → idl e x) |
| 90 | + (λ x → assoc x e e x e ∙∙ cong [_, x , e ] (idr x e) ∙∙ idl x e) |
| 91 | + (λ x → sym (assoc e x e e x) ∙∙ cong [ e , x ,_] (idl e x) ∙∙ idr e x) |
| 92 | + |
| 93 | + φ : ∀ e e' → GroupHom (fromPoint e) (fromPoint e') |
| 94 | + φ e e' .fst x = [ e' , e , x ] |
| 95 | + φ e e' .snd = makeIsGroupHom λ x y → |
| 96 | + [ e' , e , [ x , e , y ] ] ≡⟨ assoc e' e x e y ⟩ |
| 97 | + [ [ e' , e , x ] , e , y ] ≡⟨ cong [ [ e' , e , x ] ,_, y ] (sym (idr e e')) ⟩ |
| 98 | + [ [ e' , e , x ] , [ e , e' , e' ] , y ] ≡⟨ assocr [ e' , e , x ] e' e' e y ⟩ |
| 99 | + [ [ e' , e , x ] , e' , [ e' , e , y ] ] ∎ |
| 100 | + |
| 101 | + φ-coh : ∀ e e' e'' x → φ e' e'' .fst (φ e e' .fst x) ≡ φ e e'' .fst x |
| 102 | + φ-coh e e' e'' x = |
| 103 | + [ e'' , e' , [ e' , e , x ] ] ≡⟨ sym (assocr e'' e' e' e x) ⟩ |
| 104 | + [ e'' , [ e , e' , e' ] , x ] ≡⟨ cong [ e'' ,_, x ] (idr e e') ⟩ |
| 105 | + [ e'' , e , x ] ∎ |
| 106 | + |
| 107 | + φ-eqv : ∀ e e' → isEquiv (φ e e' .fst) |
| 108 | + φ-eqv e e' = isoToIsEquiv (iso (φ e e' .fst) (φ e' e .fst) (lemma e e') (lemma e' e)) where |
| 109 | + |
| 110 | + lemma : ∀ e e' x → φ e e' .fst (φ e' e .fst x) ≡ x |
| 111 | + lemma e e' x = φ-coh e' e e' x ∙ idl e' x |
| 112 | + |
| 113 | + toldYaSo : ∥ ⟨ H ⟩ ∥₁ → Group _ |
| 114 | + toldYaSo = PropTrunc→Group fromPoint (λ e e' → (φ e e' .fst , φ-eqv e e') , φ e e' .snd) φ-coh |
| 115 | + |
| 116 | +StructureGroupOfGroupHeap : (G : Group ℓ) → GroupEquiv (StructureGroup (GroupHeap G)) G |
| 117 | +StructureGroupOfGroupHeap G = idEquiv _ , makeIsGroupHom λ x y → congR _·_ $ congL _·_ inv1g ∙ ·IdL y |
| 118 | + where open GroupStr (G .snd); open GroupTheory G |
| 119 | + |
| 120 | +GroupHeapOfStructureGroup : (H : Heap ℓ) → ∥ HeapEquiv (GroupHeap (StructureGroup H)) H ∥₁ -- unnatural isomorphism |
| 121 | +GroupHeapOfStructureGroup H = go inhab module GroupHeapOfStructureGroup where |
| 122 | + open HeapTheory H |
| 123 | + |
| 124 | + fromPoint : (e : ⟨ H ⟩) → HeapEquiv (GroupHeap (StructureGroup.fromPoint H e)) H |
| 125 | + fromPoint e = idEquiv _ , makeIsHeapHom λ a b c → |
| 126 | + [ a , e , [ [ e , b , e ] , e , c ] ] ≡⟨ cong [ a , e ,_] (sym (assoc e b e e c)) ⟩ |
| 127 | + [ a , e , [ e , b , [ e , e , c ] ] ] ≡⟨ cong [ a , e ,_] (cong [ e , b ,_] (idl e c)) ⟩ |
| 128 | + [ a , e , [ e , b , c ] ] ≡⟨ assoc a e e b c ⟩ |
| 129 | + [ [ a , e , e ] , b , c ] ≡⟨ cong [_, b , c ] (idr a e) ⟩ |
| 130 | + [ a , b , c ] ∎ |
| 131 | + |
| 132 | + go : (p : ∥ ⟨ H ⟩ ∥₁) → ∥ HeapEquiv (GroupHeap (StructureGroup.toldYaSo H p)) H ∥₁ |
| 133 | + go = PT.elim (λ _ → isPropPropTrunc) λ e → ∣ fromPoint e ∣₁ |
| 134 | + |
| 135 | +PointedHeap : ∀ ℓ → Type (ℓ-suc ℓ) |
| 136 | +PointedHeap ℓ = Σ[ H ∈ Heap ℓ ] ⟨ H ⟩ |
| 137 | + |
| 138 | +PointedHeap≡ : {(H , e) (H' , e') : PointedHeap ℓ} (eqv : HeapEquiv H H') (p : eqv .fst .fst e ≡ e') → (H , e) ≡ (H' , e') |
| 139 | +PointedHeap≡ eqv p = cong₂ _,_ (uaHeap eqv) (ua-gluePath _ p) |
| 140 | + |
| 141 | +GroupsArePointedHeaps : Group ℓ ≃ PointedHeap ℓ |
| 142 | +GroupsArePointedHeaps {ℓ} = isoToEquiv asIso module GroupsArePointedHeaps where |
| 143 | + open Iso |
| 144 | + |
| 145 | + asIso : Iso (Group ℓ) (PointedHeap ℓ) |
| 146 | + asIso .fun G = GroupHeap G , G .snd .GroupStr.1g |
| 147 | + asIso .inv (H , e) = StructureGroup.fromPoint H e |
| 148 | + asIso .rightInv (H , e) = PointedHeap≡ (GroupHeapOfStructureGroup.fromPoint H e) refl |
| 149 | + asIso .leftInv G = uaGroup (StructureGroupOfGroupHeap G) |
0 commit comments