Skip to content
Draft
Show file tree
Hide file tree
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 Nov 16, 2024
ddca8ef
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale Jan 20, 2025
a92bed5
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale Jan 26, 2025
bf40188
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale Jan 31, 2025
1d9d150
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale Feb 8, 2025
3b712f0
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale Feb 9, 2025
238428f
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale Feb 15, 2025
ed86083
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale Mar 6, 2025
518c706
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale Mar 22, 2025
0c7d365
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale Apr 17, 2025
0f3059a
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale May 5, 2025
3498aa5
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale Jun 1, 2025
d58569f
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale Jun 21, 2025
cf3a842
Merge branch 'master' of https://github.com/djspacewhale/agda-unimath…
djspacewhale Jun 26, 2025
7e45233
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale Jul 16, 2025
9b17cfe
Merge branch 'master' of https://github.com/UniMath/agda-unimath
djspacewhale Jul 27, 2025
60d1878
punctuation
djspacewhale Jul 27, 2025
70672b7
added nodes of full binary trees
djspacewhale Jul 27, 2025
96931db
the combinator of full binary trees, and of labeled full binary trees
djspacewhale Jul 27, 2025
4d66fdd
labeled full binary trees
djspacewhale Jul 27, 2025
fb02671
the free magma on one generator (the hard direction is left!)
djspacewhale Jul 27, 2025
6c210aa
formatting
djspacewhale Jul 27, 2025
2448542
why can I not just apply f-preserves to the goal in htpy?...
djspacewhale Jul 27, 2025
cbdd7cc
formatting
djspacewhale Jul 27, 2025
81ab2d7
commented out one attempt. could still work, but may be useful to fac…
djspacewhale Jul 27, 2025
98ab6fe
pre-commit, with goals commented out, and pruned imports
djspacewhale Jul 27, 2025
c3d619e
for some reason, the termination checker really dislikes the recursiv…
djspacewhale Jul 27, 2025
89eec76
formatting
djspacewhale Jul 27, 2025
976e849
reopened goal
djspacewhale Jul 27, 2025
37f3ab0
so odd...
djspacewhale Jul 27, 2025
6411034
the free magma on one generator! its universal property is only prove…
djspacewhale Jul 27, 2025
8c77862
pre-commit hooks
djspacewhale Jul 27, 2025
7f824d3
formatting, removing free magma on a general type (for now, hopefully)
djspacewhale Jul 27, 2025
d218fe6
link to the free magma on one generator subarticle in the nLab
djspacewhale Jul 27, 2025
d932f1c
changed `M` to `type-Magma M` in Idea
djspacewhale Jul 27, 2025
a42eaf6
whoops
djspacewhale Jul 27, 2025
221cb10
deleted incomplete "free magmas on a type" file; termination checker …
djspacewhale Jul 27, 2025
927b88f
pre-commit hooks
djspacewhale Jul 27, 2025
e4dc26e
Merge branch 'master' into Free-magmas
djspacewhale Jul 29, 2025
901aa87
pruned unnecessary import
djspacewhale Aug 2, 2025
f2561a0
introducing free magmas on types (with terminating flags, and again o…
djspacewhale Aug 2, 2025
f48e783
pre-commit hooks
djspacewhale Aug 2, 2025
10801b6
Merge branch 'master' into Free-magmas
djspacewhale Aug 2, 2025
db5840d
s
djspacewhale Aug 2, 2025
84df00c
"
djspacewhale Aug 2, 2025
6d2b937
weights of full binary trees
djspacewhale Aug 3, 2025
d38c33c
the magma of a wild monoid
djspacewhale Aug 3, 2025
ddf6ba1
flattenings of labeled full binary trees to lists
djspacewhale Aug 3, 2025
5502c97
Merge branch 'master' into Free-magmas
djspacewhale Aug 3, 2025
34cd215
Merge branch 'Free-magmas' of https://github.com/djspacewhale/agda-un…
djspacewhale Aug 3, 2025
b372e5c
Apply suggestions from code review
djspacewhale Aug 3, 2025
9a8d5b2
workinonit
djspacewhale Aug 3, 2025
d434b64
Merge branch 'Free-magmas' of https://github.com/djspacewhale/agda-un…
djspacewhale Aug 3, 2025
91e551f
removed "abstract nonsense" quip
djspacewhale Aug 3, 2025
c02a011
adding helper modules for the proof
djspacewhale Aug 4, 2025
def5e23
the univerrsal property of the free magma on one generator!!
djspacewhale Aug 4, 2025
2fde9fe
abstracted out the lemma that combinating commutes with labeling
djspacewhale Aug 4, 2025
bea9e04
workinonit
djspacewhale Aug 4, 2025
3b9f6dd
pre-commit run to keep things sanitary
djspacewhale Aug 4, 2025
076b4e8
fixed function name in idea
djspacewhale Aug 4, 2025
57da257
pruning imports
djspacewhale Aug 4, 2025
026ddf0
workinonit
djspacewhale Aug 5, 2025
4c5ef35
continuing to build this but it's expanding the scope of this fork qu…
djspacewhale Aug 5, 2025
4f9c62b
characterizing identifications of full binary trees
djspacewhale Aug 9, 2025
15bb5bb
pre-commit hooks
djspacewhale Aug 10, 2025
2c405f3
removed the dead end
djspacewhale Aug 10, 2025
97274c3
workinonit
djspacewhale Aug 10, 2025
a396d95
characterizing identifications of labeled full binary trees
djspacewhale Aug 10, 2025
bc2794b
workinonit
djspacewhale Aug 10, 2025
b6091b7
Merge branch 'master' into Free-magmas
djspacewhale Aug 10, 2025
269a87b
workinonit
djspacewhale Aug 10, 2025
bdc04cf
propositional equality in full binary trees
djspacewhale Aug 10, 2025
d1410c8
commented out, for now
djspacewhale Aug 10, 2025
0b406fe
workinonit
djspacewhale Aug 10, 2025
42e3ded
going back to structure identity principle formalism. lots of cleanin…
djspacewhale Aug 11, 2025
ab59e76
workinonit
djspacewhale Aug 11, 2025
3a40463
Merge branch 'master' into Free-magmas
djspacewhale Aug 11, 2025
208bba2
Merge branch 'Free-magmas' of https://github.com/djspacewhale/agda-un…
djspacewhale Aug 11, 2025
13dfb88
workinonit
djspacewhale Aug 12, 2025
b5f85cf
refactoring everything to not use tr (hard to compute with!)
djspacewhale Aug 18, 2025
e139114
workinonit
djspacewhale Aug 18, 2025
a25cb11
workinonit
djspacewhale Aug 18, 2025
4302cc6
workinonit
djspacewhale Aug 18, 2025
f0fe1c9
workinonit
djspacewhale Aug 18, 2025
c74dec9
sigh
djspacewhale Aug 19, 2025
da7999d
notation in the free magmas on types file
djspacewhale Aug 19, 2025
5e533c4
Merge branch 'master' into Free-magmas
djspacewhale Aug 29, 2025
53efee0
Merge branch 'master' into Free-magmas
djspacewhale Aug 31, 2025
cb6e518
Merge branch 'master' into Free-magmas
djspacewhale Sep 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/structured-types/morphisms-magmas.lagda.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ open import structured-types.magmas

## Idea

A morphism of magmas from `M` to `N` is a map between their underlying type that
preserves the binary operation
A morphism of magmas from `M` to `N` is a map between their underlying types
that preserves the binary operation.

## Definition

Expand Down
4 changes: 4 additions & 0 deletions src/trees.lagda.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ open import trees.coalgebra-of-enriched-directed-trees public
open import trees.coalgebras-polynomial-endofunctors public
open import trees.combinator-directed-trees public
open import trees.combinator-enriched-directed-trees public
open import trees.combinator-full-binary-trees public
open import trees.directed-trees public
open import trees.elementhood-relation-coalgebras-polynomial-endofunctors public
open import trees.elementhood-relation-w-types public
Expand All @@ -29,6 +30,8 @@ open import trees.equivalences-enriched-directed-trees public
open import trees.extensional-w-types public
open import trees.fibers-directed-trees public
open import trees.fibers-enriched-directed-trees public
open import trees.free-magma-on-one-generator public
open import trees.free-magmas-on-types public
open import trees.full-binary-trees public
open import trees.functoriality-combinator-directed-trees public
open import trees.functoriality-fiber-directed-tree public
Expand All @@ -37,6 +40,7 @@ open import trees.hereditary-w-types public
open import trees.indexed-w-types public
open import trees.induction-w-types public
open import trees.inequality-w-types public
open import trees.labeled-full-binary-trees public
open import trees.lower-types-w-types public
open import trees.morphisms-algebras-polynomial-endofunctors public
open import trees.morphisms-coalgebras-polynomial-endofunctors public
Expand Down
59 changes: 59 additions & 0 deletions src/trees/combinator-full-binary-trees.lagda.md
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
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
```
148 changes: 148 additions & 0 deletions src/trees/free-magma-on-one-generator.lagda.md
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
Loading