-
Notifications
You must be signed in to change notification settings - Fork 91
Free magmas #1459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
djspacewhale
wants to merge
89
commits into
UniMath:master
Choose a base branch
from
djspacewhale:Free-magmas
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,290
−47
Draft
Free magmas #1459
Changes from 45 commits
Commits
Show all changes
89 commits
Select commit
Hold shift + click to select a range
37236bc
changed apostrophes to breves in incidence algebras file
djspacewhale ddca8ef
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale a92bed5
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale bf40188
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale 1d9d150
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale 3b712f0
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale 238428f
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale ed86083
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale 518c706
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale 0c7d365
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale 0f3059a
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale 3498aa5
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale d58569f
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale cf3a842
Merge branch 'master' of https://github.com/djspacewhale/agda-unimath…
djspacewhale 7e45233
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale 9b17cfe
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale 60d1878
punctuation
djspacewhale 70672b7
added nodes of full binary trees
djspacewhale 96931db
the combinator of full binary trees, and of labeled full binary trees
djspacewhale 4d66fdd
labeled full binary trees
djspacewhale fb02671
the free magma on one generator (the hard direction is left!)
djspacewhale 6c210aa
formatting
djspacewhale 2448542
why can I not just apply f-preserves to the goal in htpy?...
djspacewhale cbdd7cc
formatting
djspacewhale 81ab2d7
commented out one attempt. could still work, but may be useful to fac…
djspacewhale 98ab6fe
pre-commit, with goals commented out, and pruned imports
djspacewhale c3d619e
for some reason, the termination checker really dislikes the recursiv…
djspacewhale 89eec76
formatting
djspacewhale 976e849
reopened goal
djspacewhale 37f3ab0
so odd...
djspacewhale 6411034
the free magma on one generator! its universal property is only prove…
djspacewhale 8c77862
pre-commit hooks
djspacewhale 7f824d3
formatting, removing free magma on a general type (for now, hopefully)
djspacewhale d218fe6
link to the free magma on one generator subarticle in the nLab
djspacewhale d932f1c
changed `M` to `type-Magma M` in Idea
djspacewhale a42eaf6
whoops
djspacewhale 221cb10
deleted incomplete "free magmas on a type" file; termination checker …
djspacewhale 927b88f
pre-commit hooks
djspacewhale e4dc26e
Merge branch 'master' into Free-magmas
djspacewhale 901aa87
pruned unnecessary import
djspacewhale f2561a0
introducing free magmas on types (with terminating flags, and again o…
djspacewhale f48e783
pre-commit hooks
djspacewhale 10801b6
Merge branch 'master' into Free-magmas
djspacewhale db5840d
s
djspacewhale 84df00c
"
djspacewhale 6d2b937
weights of full binary trees
djspacewhale d38c33c
the magma of a wild monoid
djspacewhale ddf6ba1
flattenings of labeled full binary trees to lists
djspacewhale 5502c97
Merge branch 'master' into Free-magmas
djspacewhale 34cd215
Merge branch 'Free-magmas' of https://github.com/djspacewhale/agda-un…
djspacewhale b372e5c
Apply suggestions from code review
djspacewhale 9a8d5b2
workinonit
djspacewhale d434b64
Merge branch 'Free-magmas' of https://github.com/djspacewhale/agda-un…
djspacewhale 91e551f
removed "abstract nonsense" quip
djspacewhale c02a011
adding helper modules for the proof
djspacewhale def5e23
the univerrsal property of the free magma on one generator!!
djspacewhale 2fde9fe
abstracted out the lemma that combinating commutes with labeling
djspacewhale bea9e04
workinonit
djspacewhale 3b9f6dd
pre-commit run to keep things sanitary
djspacewhale 076b4e8
fixed function name in idea
djspacewhale 57da257
pruning imports
djspacewhale 026ddf0
workinonit
djspacewhale 4c5ef35
continuing to build this but it's expanding the scope of this fork qu…
djspacewhale 4f9c62b
characterizing identifications of full binary trees
djspacewhale 15bb5bb
pre-commit hooks
djspacewhale 2c405f3
removed the dead end
djspacewhale 97274c3
workinonit
djspacewhale a396d95
characterizing identifications of labeled full binary trees
djspacewhale bc2794b
workinonit
djspacewhale b6091b7
Merge branch 'master' into Free-magmas
djspacewhale 269a87b
workinonit
djspacewhale bdc04cf
propositional equality in full binary trees
djspacewhale d1410c8
commented out, for now
djspacewhale 0b406fe
workinonit
djspacewhale 42e3ded
going back to structure identity principle formalism. lots of cleanin…
djspacewhale ab59e76
workinonit
djspacewhale 3a40463
Merge branch 'master' into Free-magmas
djspacewhale 208bba2
Merge branch 'Free-magmas' of https://github.com/djspacewhale/agda-un…
djspacewhale 13dfb88
workinonit
djspacewhale b5f85cf
refactoring everything to not use tr (hard to compute with!)
djspacewhale e139114
workinonit
djspacewhale a25cb11
workinonit
djspacewhale 4302cc6
workinonit
djspacewhale f0fe1c9
workinonit
djspacewhale c74dec9
sigh
djspacewhale da7999d
notation in the free magmas on types file
djspacewhale 5e533c4
Merge branch 'master' into Free-magmas
djspacewhale 53efee0
Merge branch 'master' into Free-magmas
djspacewhale cb6e518
Merge branch 'master' into Free-magmas
djspacewhale File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # The combinator of full binary trees | ||
|
|
||
| ```agda | ||
| module trees.combinator-full-binary-trees where | ||
| ``` | ||
|
|
||
| <details><summary>Imports</summary> | ||
|
|
||
| ```agda | ||
| open import foundation.coproduct-types | ||
| open import foundation.dependent-pair-types | ||
| open import foundation.universe-levels | ||
|
|
||
| open import structured-types.magmas | ||
|
|
||
| open import trees.full-binary-trees | ||
| open import trees.labeled-full-binary-trees | ||
| ``` | ||
|
|
||
| </details> | ||
|
|
||
| ## Idea | ||
|
|
||
| Two [full binary trees](trees.full-binary-trees.md) `L, R` may be combined into | ||
| a new full binary tree in the natural way. By abstract nonsense, this extends to | ||
djspacewhale marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| a combinator of [labeled full binary trees](trees.labeled-full-binary-trees.md). | ||
| These form an important class of [magmas](structured-types.magmas.md), cf. | ||
| [the free magma on one generator](trees.free-magma-on-one-generator.md) and | ||
| [free magmas on types](trees.free-magmas-on-types.md). | ||
|
|
||
| ## Definition | ||
|
|
||
| ```agda | ||
| combinator-full-binary-tree : | ||
| full-binary-tree → full-binary-tree → full-binary-tree | ||
| combinator-full-binary-tree L R = join-full-binary-tree L R | ||
|
|
||
| combinator-labeled-full-binary-tree : | ||
| {l : Level} (X : UU l) → labeled-full-binary-tree X → | ||
| labeled-full-binary-tree X → labeled-full-binary-tree X | ||
| pr1 (combinator-labeled-full-binary-tree X (L , _) (R , _)) = | ||
| combinator-full-binary-tree L R | ||
| pr2 (combinator-labeled-full-binary-tree X (L , L-label) (R , _)) (inl x) = | ||
| L-label x | ||
| pr2 (combinator-labeled-full-binary-tree X (L , _) (R , R-label)) (inr x) = | ||
| R-label x | ||
| ``` | ||
|
|
||
| ### The magmas of full binary trees and labeled full binary trees | ||
|
|
||
| ```agda | ||
| full-binary-tree-Magma : Magma lzero | ||
| pr1 full-binary-tree-Magma = full-binary-tree | ||
| pr2 full-binary-tree-Magma = combinator-full-binary-tree | ||
|
|
||
| labeled-full-binary-tree-Magma : {l : Level} (X : UU l) → Magma l | ||
| pr1 (labeled-full-binary-tree-Magma X) = labeled-full-binary-tree X | ||
| pr2 (labeled-full-binary-tree-Magma X) = combinator-labeled-full-binary-tree X | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,148 @@ | ||
| # The free magma on one generator | ||
|
|
||
| ```agda | ||
| module trees.free-magma-on-one-generator where | ||
| ``` | ||
|
|
||
| <details><summary>Imports</summary> | ||
|
|
||
| ```agda | ||
| open import foundation.action-on-identifications-binary-functions | ||
| open import foundation.dependent-pair-types | ||
| open import foundation.equality-dependent-pair-types | ||
| open import foundation.equivalences | ||
| open import foundation.function-extensionality | ||
| open import foundation.homotopies | ||
| open import foundation.identity-types | ||
| open import foundation.universe-levels | ||
|
|
||
| open import foundation-core.dependent-identifications | ||
| open import foundation-core.sets | ||
| open import foundation-core.transport-along-identifications | ||
|
|
||
| open import structured-types.magmas | ||
| open import structured-types.morphisms-magmas | ||
|
|
||
| open import trees.combinator-full-binary-trees | ||
| open import trees.full-binary-trees | ||
| open import trees.labeled-full-binary-trees | ||
| ``` | ||
|
|
||
| </details> | ||
|
|
||
| ## Idea | ||
|
|
||
| Function extensionality implies that the | ||
| [magma of full binary trees](trees.combinator-full-binary-trees.md) is the | ||
| **free magma on one generator**. That is, there are natural maps | ||
| `image-of-leaf : hom-Magma full-binary-tree-Magma M → (type-Magma M), extension-of-point-hom-full-binary-tree-Magma : (type-Magma M) → hom-Magma full-binary-tree-Magma M` | ||
| for any [magma](structured-types.magmas.md) `M`. | ||
| `extension-of-point-hom-full-binary-tree-Magma` is always a | ||
| [section](foundation-core.sections.md) of `image-of-leaf`, and when `M` is a | ||
| set, we may prove it is also a [retraction](foundation-core.retractions.md), | ||
| i.e. that `image-of-leaf` is an [equivalence](foundation-core.equivalences.md). | ||
|
|
||
| ## Proof | ||
|
|
||
| ```agda | ||
| module _ | ||
| {l : Level} (M : Magma l) | ||
| where | ||
|
|
||
| image-of-leaf : hom-Magma full-binary-tree-Magma M → type-Magma M | ||
| image-of-leaf (f , _) = f leaf-full-binary-tree | ||
|
|
||
| extension-of-point-full-binary-tree-Magma : | ||
| type-Magma M → full-binary-tree → type-Magma M | ||
| extension-of-point-full-binary-tree-Magma m leaf-full-binary-tree = m | ||
| extension-of-point-full-binary-tree-Magma m (join-full-binary-tree L R) = | ||
| mul-Magma M (extension-of-point-full-binary-tree-Magma m L) | ||
| ( extension-of-point-full-binary-tree-Magma m R) | ||
|
|
||
| is-hom-extension-of-point-full-binary-tree-Magma : | ||
| ( m : type-Magma M) → preserves-mul-Magma full-binary-tree-Magma M | ||
| ( extension-of-point-full-binary-tree-Magma m) | ||
| is-hom-extension-of-point-full-binary-tree-Magma m T U = refl | ||
|
|
||
| extension-of-point-hom-full-binary-tree-Magma : | ||
| type-Magma M → hom-Magma full-binary-tree-Magma M | ||
| pr1 (extension-of-point-hom-full-binary-tree-Magma m) = | ||
| extension-of-point-full-binary-tree-Magma m | ||
| pr2 (extension-of-point-hom-full-binary-tree-Magma m) = | ||
| is-hom-extension-of-point-full-binary-tree-Magma m | ||
|
|
||
| is-retraction-extension-of-point-full-binary-tree-Magma : | ||
| ( T : full-binary-tree) → (f : hom-Magma full-binary-tree-Magma M) → | ||
| extension-of-point-full-binary-tree-Magma (image-of-leaf f) T = | ||
| map-hom-Magma full-binary-tree-Magma M f T | ||
| is-retraction-extension-of-point-full-binary-tree-Magma | ||
| leaf-full-binary-tree f = refl | ||
| is-retraction-extension-of-point-full-binary-tree-Magma | ||
| ( join-full-binary-tree L R) (f , is-hom-f) = | ||
| ap-binary (mul-Magma M) | ||
| ( is-retraction-extension-of-point-full-binary-tree-Magma L | ||
| ( f , is-hom-f)) | ||
| ( is-retraction-extension-of-point-full-binary-tree-Magma R | ||
| ( f , is-hom-f)) | ||
| ∙ inv (is-hom-f L R) | ||
|
|
||
| is-set-dependent-identification-preserves-mul-full-binary-tree-Magma : | ||
| ( f : hom-Magma full-binary-tree-Magma M) → is-set (type-Magma M) → | ||
| dependent-identification (preserves-mul-Magma full-binary-tree-Magma M) | ||
| ( eq-htpy | ||
| ( λ T → is-retraction-extension-of-point-full-binary-tree-Magma T f)) | ||
| ( λ T U → refl) (pr2 f) | ||
| is-set-dependent-identification-preserves-mul-full-binary-tree-Magma | ||
| f is-set-M = eq-htpy htpy | ||
| where | ||
| htpy : | ||
| tr (preserves-mul-Magma full-binary-tree-Magma M) (eq-htpy | ||
| ( λ T → is-retraction-extension-of-point-full-binary-tree-Magma T f)) | ||
| ( λ T U → refl) ~ pr2 f | ||
| htpy T = eq-htpy htpy2 | ||
| where | ||
| htpy2 : | ||
| tr (preserves-mul-Magma full-binary-tree-Magma M) (eq-htpy | ||
| ( λ U → | ||
| is-retraction-extension-of-point-full-binary-tree-Magma U f)) | ||
| ( λ U V → refl) T ~ pr2 f T | ||
| htpy2 U = | ||
| pr1 (is-set-M (map-hom-Magma full-binary-tree-Magma M f | ||
| ( pr2 full-binary-tree-Magma T U)) | ||
| ( pr2 M (map-hom-Magma full-binary-tree-Magma M f T) | ||
| ( map-hom-Magma full-binary-tree-Magma M f U)) | ||
| ( tr (preserves-mul-Magma full-binary-tree-Magma M) | ||
| ( eq-htpy (λ V → | ||
| is-retraction-extension-of-point-full-binary-tree-Magma V f)) | ||
| ( λ V W → refl) T U) (pr2 f T U)) | ||
|
|
||
| is-set-is-equiv-image-of-leaf-full-binary-tree-Magma : | ||
| is-set (type-Magma M) → is-equiv image-of-leaf | ||
| pr1 (pr1 (is-set-is-equiv-image-of-leaf-full-binary-tree-Magma _)) = | ||
| extension-of-point-hom-full-binary-tree-Magma | ||
| pr2 (pr1 (is-set-is-equiv-image-of-leaf-full-binary-tree-Magma _)) _ = refl | ||
| pr1 (pr2 (is-set-is-equiv-image-of-leaf-full-binary-tree-Magma _)) = | ||
| extension-of-point-hom-full-binary-tree-Magma | ||
| pr2 (pr2 (is-set-is-equiv-image-of-leaf-full-binary-tree-Magma is-set-M)) f = | ||
| eq-pair-Σ (eq-htpy | ||
| ( λ T → is-retraction-extension-of-point-full-binary-tree-Magma T f)) | ||
| ( is-set-dependent-identification-preserves-mul-full-binary-tree-Magma | ||
| f is-set-M) | ||
|
|
||
| is-set-equiv-image-of-leaf-full-binary-tree-Magma : | ||
| is-set (type-Magma M) → hom-Magma full-binary-tree-Magma M ≃ type-Magma M | ||
| pr1 (is-set-equiv-image-of-leaf-full-binary-tree-Magma _) = image-of-leaf | ||
| pr2 (is-set-equiv-image-of-leaf-full-binary-tree-Magma is-set-M) = | ||
| is-set-is-equiv-image-of-leaf-full-binary-tree-Magma is-set-M | ||
| ``` | ||
|
|
||
| ## See also | ||
|
|
||
| - This construction may be extended to | ||
| [labeled full binary trees](trees.labeled-full-binary-trees.md) to realize | ||
| free magmas on any type, see | ||
| [`trees.free-magmas-on-types`](trees.free-magmas-on-types.md). | ||
|
|
||
| ## External links | ||
|
|
||
| [Free magmas](https://ncatlab.org/nlab/show/magma#free_magmas) at $n$Lab |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.