From 27fa38b3b43a2cec47ecf0842c0b5c9f772a02dd Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 27 Aug 2025 12:52:45 +0200 Subject: [PATCH 01/97] add directory variables to `Makefile` --- Makefile | 116 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 66 insertions(+), 50 deletions(-) diff --git a/Makefile b/Makefile index 837e5c2a69..67df06ebb7 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,23 @@ +#### Directory variables #### +SOURCE_DIR := src +SCRIPTS_DIR := scripts +WEBSITE_DIR := website +WEBSITE_CSS_DIR := $(WEBSITE_DIR)/css +WEBSITE_IMAGES_DIR := $(WEBSITE_DIR)/images +WEBSITE_JS_DIR := $(WEBSITE_DIR)/js +THEME_DIR := theme +TABLES_DIR := tables +# MDBOOK build directory +MDBOOK_DIR := book +## Agda directories ## +# Agda output HTML directory +AGDA_HTML_DIR := docs +# Base directory where Agda interface files are stored +AGDA_BUILD_DIR := _build +## Profiling directories ## +PROFILING_TEMP_DIR := temp +PROFILING_OUTPUT_FILE := $(PROFILING_OUTPUT_FILE) + # Options added to the autogenerated `everything.lagda.md` file. # We put options that apply to all files into the `agda-unimath.agda-lib` file, # but there are some options that we want to enable only for specific source @@ -19,7 +39,7 @@ else endif AGDARTS := +RTS -H$(AGDA_MIN_HEAP) -M6G -RTS -AGDAFILES := $(shell find src -name temp -prune -o -type f \( -name "*.lagda.md" -not -name "everything.lagda.md" \) -print) +AGDAFILES := $(shell find $(SOURCE_DIR) -name temp -prune -o -type f \( -name "*.lagda.md" -not -name "everything.lagda.md" \) -print) CONTRIBUTORS_FILE := CONTRIBUTORS.toml # All our code is in literate Agda, so we could set highlight=code and drop the @@ -30,7 +50,7 @@ CONTRIBUTORS_FILE := CONTRIBUTORS.toml # resulting page looks garbled. With highlight=auto and the default Agda.css, it # at is at least in a proper code block with syntax highlighting, albeit without # the agda-unimath chrome. -AGDAHTMLFLAGS ?= --html --html-highlight=auto --html-dir=docs --css=website/css/Agda.css --only-scope-checking +AGDAHTMLFLAGS ?= --html --html-highlight=auto --html-dir=$(AGDA_HTML_DIR) --css=$(WEBSITE_CSS_DIR)/Agda.css --only-scope-checking AGDAPROFILEFLAGS ?= --profile=modules +RTS -s -RTS AGDA ?= agda $(AGDAVERBOSE) $(AGDARTS) TIME ?= time @@ -60,14 +80,14 @@ METAFILES := \ .PHONY: agdaFiles agdaFiles: @rm -rf $@ - @rm -rf ./src/everything.lagda.md - @git ls-files src | grep '\.lagda.md$$' > $@ + @rm -rf ./$(SOURCE_DIR)/everything.lagda.md + @git ls-files $(SOURCE_DIR) | grep '\.lagda.md$$' > $@ @sort -o $@ $@ @wc -l $@ - @echo "$(shell (git ls-files src | grep '.lagda.md$$' | xargs cat) | wc -l) LOC" + @echo "$(shell (git ls-files $(SOURCE_DIR) | grep '.lagda.md$$' | xargs cat) | wc -l) LOC" -.PHONY: ./src/everything.lagda.md -src/everything.lagda.md: agdaFiles +.PHONY: ./$(SOURCE_DIR)/everything.lagda.md +$(SOURCE_DIR)/everything.lagda.md: agdaFiles @echo "\`\`\`agda" > $@ ;\ echo "{-# OPTIONS $(everythingOpts) #-}" >> $@ ;\ echo "" >> $@ ;\ @@ -81,20 +101,16 @@ src/everything.lagda.md: agdaFiles echo "\`\`\`" >> $@ ; .PHONY: check -check: ./src/everything.lagda.md +check: ./$(SOURCE_DIR)/everything.lagda.md ${TIME} ${AGDA} $? .PHONY: check-profile # `clean` is specified second so that the $< variable stores the everything file. # We don't mind, because the `clean` target busts the typechecking and website cache, # but doesn't touch the everything file. -check-profile: ./src/everything.lagda.md clean +check-profile: ./$(SOURCE_DIR)/everything.lagda.md clean ${AGDA} ${AGDAPROFILEFLAGS} $< -# Base directory where Agda interface files are stored -BUILD_DIR := ./_build -# Directory for temporary files -TEMP_DIR := ./temp # Convert module path to directory path (replace dots with slashes) MODULE_DIR = $(subst .,/,$(MODULE)) @@ -111,61 +127,61 @@ profile-module: fi @# Attempt to delete the interface file only if the build directory exists @echo "\033[0;32mAttempting to delete interface file for $(MODULE)\033[0m" - @find $(BUILD_DIR) -type f -path "*/agda/src/$(MODULE_DIR).agdai" -exec rm -f {} \+ 2>/dev/null || \ - echo "\033[0;31m$(BUILD_DIR) directory does not exist, skipping deletion of interface files.\033[0m" + @find ./$(AGDA_BUILD_DIR) -type f -path "*/agda/$(SOURCE_DIR)/$(MODULE_DIR).agdai" -exec rm -f {} \+ 2>/dev/null || \ + echo "\033[0;31m$(AGDA_BUILD_DIR) directory does not exist, skipping deletion of interface files.\033[0m" @# Ensure the temporary directory exists - @mkdir -p $(TEMP_DIR) + @mkdir -p ./$(PROFILING_TEMP_DIR) @# Profile typechecking the module and capture the output in the temp directory, also display on terminal @echo "\033[0;32mProfiling typechecking of $(MODULE)\033[0m" - @$(AGDA) $(PROFILE_MODULE_AGDA_ARGS) src/$(MODULE_DIR).lagda.md 2>&1 | tee $(TEMP_DIR)/typecheck_output.txt + @$(AGDA) $(PROFILE_MODULE_AGDA_ARGS) $(SOURCE_DIR)/$(MODULE_DIR).lagda.md 2>&1 | tee ./$(PROFILING_OUTPUT_FILE) @# Check for additional modules being typechecked by looking for any indented "Checking" line - @if grep -E "^\s+Checking " $(TEMP_DIR)/typecheck_output.txt > /dev/null; then \ + @if grep -E "^\s+Checking " ./$(PROFILING_OUTPUT_FILE) > /dev/null; then \ echo "\033[0;31mOther modules were also checked. Repeating profiling after deleting interface file again.\033[0m"; \ - find $(BUILD_DIR) -type f -path "*/agda/src/$(MODULE_DIR).agdai" -exec rm -f {} \+; \ - $(AGDA) $(PROFILE_MODULE_AGDA_ARGS) src/$(MODULE_DIR).lagda.md; \ + find ./$(AGDA_BUILD_DIR) -type f -path "*/agda/$(SOURCE_DIR)/$(MODULE_DIR).agdai" -exec rm -f {} \+; \ + $(AGDA) $(PROFILE_MODULE_AGDA_ARGS) $(SOURCE_DIR)/$(MODULE_DIR).lagda.md; \ else \ echo "\033[0;32mOnly $(MODULE) was checked. Profiling complete.\033[0m"; \ fi @# Cleanup - @rm -f $(TEMP_DIR)/typecheck_output.txt + @rm -f ./$(PROFILING_OUTPUT_FILE) -agda-html: ./src/everything.lagda.md - @rm -rf ./docs/ - @mkdir -p ./docs/ +agda-html: ./$(SOURCE_DIR)/everything.lagda.md + @rm -rf ./$(AGDA_HTML_DIR)/ + @mkdir -p ./$(AGDA_HTML_DIR)/ # Use bash if instead of ifeq, because we want to change SKIPAGDA with rules @if [ -z "$(SKIPAGDA)" ];\ - then ${AGDA} ${AGDAHTMLFLAGS} ./src/everything.lagda.md; \ - else python3 ./scripts/generate_noagda_html.py ./docs/; \ + then ${AGDA} ${AGDAHTMLFLAGS} ./$(SOURCE_DIR)/everything.lagda.md; \ + else python3 ./$(SCRIPTS_DIR)/generate_noagda_html.py ./$(AGDA_HTML_DIR)/; \ fi -SUMMARY.md: ${AGDAFILES} ./scripts/generate_main_index_file.py - @python3 ./scripts/generate_main_index_file.py +SUMMARY.md: ${AGDAFILES} ./$(SCRIPTS_DIR)/generate_main_index_file.py + @python3 ./$(SCRIPTS_DIR)/generate_main_index_file.py -MAINTAINERS.md: ${CONTRIBUTORS_FILE} ./scripts/generate_maintainers.py - @python3 ./scripts/generate_maintainers.py +MAINTAINERS.md: ${CONTRIBUTORS_FILE} ./$(SCRIPTS_DIR)/generate_maintainers.py + @python3 ./$(SCRIPTS_DIR)/generate_maintainers.py -CONTRIBUTORS.md: ${AGDAFILES} ${CONTRIBUTORS_FILE} ./scripts/generate_contributors.py - @python3 ./scripts/generate_contributors.py +CONTRIBUTORS.md: ${AGDAFILES} ${CONTRIBUTORS_FILE} ./$(SCRIPTS_DIR)/generate_contributors.py + @python3 ./$(SCRIPTS_DIR)/generate_contributors.py -website/css/Agda-highlight.css: ./scripts/generate_agda_css.py ./theme/catppuccin.css - @python3 ./scripts/generate_agda_css.py +$(WEBSITE_CSS_DIR)/Agda-highlight.css: ./$(SCRIPTS_DIR)/generate_agda_css.py ./$(THEME_DIR)/catppuccin.css + @python3 ./$(SCRIPTS_DIR)/generate_agda_css.py -website/images/agda_dependency_graph.svg website/images/agda_dependency_graph_legend.html &: ${AGDAFILES} - @python3 ./scripts/generate_dependency_graph_rendering.py website/images/agda_dependency_graph svg || true +$(WEBSITE_IMAGES_DIR)/agda_dependency_graph.svg $(WEBSITE_IMAGES_DIR)/agda_dependency_graph_legend.html &: ${AGDAFILES} + @python3 ./$(SCRIPTS_DIR)/generate_dependency_graph_rendering.py $(WEBSITE_IMAGES_DIR)/agda_dependency_graph svg || true .PHONY: website-prepare website-prepare: agda-html ./SUMMARY.md ./CONTRIBUTORS.md ./MAINTAINERS.md \ - ./website/css/Agda-highlight.css ./website/images/agda_dependency_graph.svg \ - ./website/images/agda_dependency_graph_legend.html - @cp $(METAFILES) ./docs/ - @mkdir -p ./docs/website - @cp -r ./website/images ./docs/website/ - @cp -r ./website/css ./docs/website/ - @cp -r ./website/js ./docs/website/ - @cp -r ./tables ./docs + ./$(WEBSITE_CSS_DIR)/Agda-highlight.css ./$(WEBSITE_IMAGES_DIR)/agda_dependency_graph.svg \ + ./$(WEBSITE_IMAGES_DIR)/agda_dependency_graph_legend.html + @cp $(METAFILES) ./$(AGDA_HTML_DIR)/ + @mkdir -p ./$(AGDA_HTML_DIR)/website + @cp -r ./$(WEBSITE_IMAGES_DIR) ./$(AGDA_HTML_DIR)/website/ + @cp -r ./$(WEBSITE_CSS_DIR) ./$(AGDA_HTML_DIR)/website/ + @cp -r ./$(WEBSITE_JS_DIR) ./$(AGDA_HTML_DIR)/website/ + @cp -r ./$(TABLES_DIR) ./$(AGDA_HTML_DIR) .PHONY: website website: website-prepare @@ -175,17 +191,17 @@ website: website-prepare .PHONY: serve-website serve-website: website-prepare @MDBOOK_PREPROCESSOR__CONCEPTS__SKIP_AGDA=$(SKIPAGDA) \ - mdbook serve -p 8080 --open -d ./book/html + mdbook serve -p 8080 --open -d ./$(MDBOOK_DIR)/html -docs/dependency.dot : ./src/everything.lagda.md ${AGDAFILES} +$(AGDA_HTML_DIR)/dependency.dot : ./$(SOURCE_DIR)/everything.lagda.md ${AGDAFILES} ${AGDA} ${AGDAHTMLFLAGS} --dependency-graph=$@ $< .PHONY: graph -graph: docs/dependency.dot +graph: $(AGDA_HTML_DIR)/dependency.dot .PHONY: clean clean: - @rm -Rf ./_build/ ./book/ ./docs/ + @rm -Rf ./$(AGDA_BUILD_DIR)/ ./$(MDBOOK_DIR)/ ./$(AGDA_HTML_DIR)/ .PHONY: pre-commit pre-commit: @@ -204,5 +220,5 @@ install-website-dev: .PHONY: unused-imports unused-imports: - python3 ./scripts/remove_unused_imports.py - python3 ./scripts/demote_foundation_imports.py + python3 ./$(SCRIPTS_DIR)/remove_unused_imports.py + python3 ./$(SCRIPTS_DIR)/demote_foundation_imports.py From c837ced19e11021c14ab809cdd223b5e32fa5d5c Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 27 Aug 2025 12:53:29 +0200 Subject: [PATCH 02/97] add profiling temp directory to cleanup --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 67df06ebb7..6a91701911 100644 --- a/Makefile +++ b/Makefile @@ -201,7 +201,7 @@ graph: $(AGDA_HTML_DIR)/dependency.dot .PHONY: clean clean: - @rm -Rf ./$(AGDA_BUILD_DIR)/ ./$(MDBOOK_DIR)/ ./$(AGDA_HTML_DIR)/ + @rm -Rf ./$(AGDA_BUILD_DIR)/ ./$(MDBOOK_DIR)/ ./$(AGDA_HTML_DIR)/ ./$(PROFILING_TEMP_DIR)/ .PHONY: pre-commit pre-commit: From 7a4314952c46f793374a5edc084d3f3aef502c58 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 27 Aug 2025 13:02:37 +0200 Subject: [PATCH 03/97] more organization directory variables `Makefile` --- Makefile | 95 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 49 insertions(+), 46 deletions(-) diff --git a/Makefile b/Makefile index 6a91701911..78e832927d 100644 --- a/Makefile +++ b/Makefile @@ -1,22 +1,47 @@ #### Directory variables #### SOURCE_DIR := src SCRIPTS_DIR := scripts +# Website assets WEBSITE_DIR := website WEBSITE_CSS_DIR := $(WEBSITE_DIR)/css WEBSITE_IMAGES_DIR := $(WEBSITE_DIR)/images WEBSITE_JS_DIR := $(WEBSITE_DIR)/js THEME_DIR := theme -TABLES_DIR := tables +# MDBOOK input, corresponds to the `src` variable in `book.toml` +MDBOOK_SRC := docs # MDBOOK build directory MDBOOK_DIR := book -## Agda directories ## -# Agda output HTML directory -AGDA_HTML_DIR := docs # Base directory where Agda interface files are stored AGDA_BUILD_DIR := _build -## Profiling directories ## -PROFILING_TEMP_DIR := temp -PROFILING_OUTPUT_FILE := $(PROFILING_OUTPUT_FILE) +# Agda profiling directory +AGDA_PROFILING_TEMP_DIR := temp +AGDA_PROFILING_OUTPUT_FILE := $(AGDA_PROFILING_TEMP_DIR)/typecheck_output.txt + +# Docs +TABLES_DIR := tables + +METAFILES := \ + ART.md \ + CITE-THIS-LIBRARY.md \ + CITING-SOURCES.md \ + CODINGSTYLE.md \ + CONTRIBUTING.md \ + CONTRIBUTORS.md \ + FILE-CONVENTIONS.md \ + DESIGN-PRINCIPLES.md \ + GRANT-ACKNOWLEDGMENTS.md \ + HOME.md \ + HOWTO-INSTALL.md \ + LICENSE.md \ + MIXFIX-OPERATORS.md \ + MAINTAINERS.md \ + README.md \ + STATEMENT-OF-INCLUSION.md \ + SUMMARY.md \ + TEMPLATE.lagda.md \ + PROJECTS.md \ + VISUALIZATION.md + # Options added to the autogenerated `everything.lagda.md` file. # We put options that apply to all files into the `agda-unimath.agda-lib` file, @@ -50,33 +75,11 @@ CONTRIBUTORS_FILE := CONTRIBUTORS.toml # resulting page looks garbled. With highlight=auto and the default Agda.css, it # at is at least in a proper code block with syntax highlighting, albeit without # the agda-unimath chrome. -AGDAHTMLFLAGS ?= --html --html-highlight=auto --html-dir=$(AGDA_HTML_DIR) --css=$(WEBSITE_CSS_DIR)/Agda.css --only-scope-checking +AGDAHTMLFLAGS ?= --html --html-highlight=auto --html-dir=$(MDBOOK_SRC) --css=$(WEBSITE_CSS_DIR)/Agda.css --only-scope-checking AGDAPROFILEFLAGS ?= --profile=modules +RTS -s -RTS AGDA ?= agda $(AGDAVERBOSE) $(AGDARTS) TIME ?= time -METAFILES := \ - ART.md \ - CITE-THIS-LIBRARY.md \ - CITING-SOURCES.md \ - CODINGSTYLE.md \ - CONTRIBUTING.md \ - CONTRIBUTORS.md \ - FILE-CONVENTIONS.md \ - DESIGN-PRINCIPLES.md \ - GRANT-ACKNOWLEDGMENTS.md \ - HOME.md \ - HOWTO-INSTALL.md \ - LICENSE.md \ - MIXFIX-OPERATORS.md \ - MAINTAINERS.md \ - README.md \ - STATEMENT-OF-INCLUSION.md \ - SUMMARY.md \ - TEMPLATE.lagda.md \ - PROJECTS.md \ - VISUALIZATION.md - .PHONY: agdaFiles agdaFiles: @rm -rf $@ @@ -130,12 +133,12 @@ profile-module: @find ./$(AGDA_BUILD_DIR) -type f -path "*/agda/$(SOURCE_DIR)/$(MODULE_DIR).agdai" -exec rm -f {} \+ 2>/dev/null || \ echo "\033[0;31m$(AGDA_BUILD_DIR) directory does not exist, skipping deletion of interface files.\033[0m" @# Ensure the temporary directory exists - @mkdir -p ./$(PROFILING_TEMP_DIR) + @mkdir -p ./$(AGDA_PROFILING_TEMP_DIR) @# Profile typechecking the module and capture the output in the temp directory, also display on terminal @echo "\033[0;32mProfiling typechecking of $(MODULE)\033[0m" - @$(AGDA) $(PROFILE_MODULE_AGDA_ARGS) $(SOURCE_DIR)/$(MODULE_DIR).lagda.md 2>&1 | tee ./$(PROFILING_OUTPUT_FILE) + @$(AGDA) $(PROFILE_MODULE_AGDA_ARGS) $(SOURCE_DIR)/$(MODULE_DIR).lagda.md 2>&1 | tee ./$(AGDA_PROFILING_OUTPUT_FILE) @# Check for additional modules being typechecked by looking for any indented "Checking" line - @if grep -E "^\s+Checking " ./$(PROFILING_OUTPUT_FILE) > /dev/null; then \ + @if grep -E "^\s+Checking " ./$(AGDA_PROFILING_OUTPUT_FILE) > /dev/null; then \ echo "\033[0;31mOther modules were also checked. Repeating profiling after deleting interface file again.\033[0m"; \ find ./$(AGDA_BUILD_DIR) -type f -path "*/agda/$(SOURCE_DIR)/$(MODULE_DIR).agdai" -exec rm -f {} \+; \ $(AGDA) $(PROFILE_MODULE_AGDA_ARGS) $(SOURCE_DIR)/$(MODULE_DIR).lagda.md; \ @@ -144,17 +147,17 @@ profile-module: fi @# Cleanup - @rm -f ./$(PROFILING_OUTPUT_FILE) + @rm -f ./$(AGDA_PROFILING_OUTPUT_FILE) agda-html: ./$(SOURCE_DIR)/everything.lagda.md - @rm -rf ./$(AGDA_HTML_DIR)/ - @mkdir -p ./$(AGDA_HTML_DIR)/ + @rm -rf ./$(MDBOOK_SRC)/ + @mkdir -p ./$(MDBOOK_SRC)/ # Use bash if instead of ifeq, because we want to change SKIPAGDA with rules @if [ -z "$(SKIPAGDA)" ];\ then ${AGDA} ${AGDAHTMLFLAGS} ./$(SOURCE_DIR)/everything.lagda.md; \ - else python3 ./$(SCRIPTS_DIR)/generate_noagda_html.py ./$(AGDA_HTML_DIR)/; \ + else python3 ./$(SCRIPTS_DIR)/generate_noagda_html.py ./$(MDBOOK_SRC)/; \ fi SUMMARY.md: ${AGDAFILES} ./$(SCRIPTS_DIR)/generate_main_index_file.py @@ -176,12 +179,12 @@ $(WEBSITE_IMAGES_DIR)/agda_dependency_graph.svg $(WEBSITE_IMAGES_DIR)/agda_depen website-prepare: agda-html ./SUMMARY.md ./CONTRIBUTORS.md ./MAINTAINERS.md \ ./$(WEBSITE_CSS_DIR)/Agda-highlight.css ./$(WEBSITE_IMAGES_DIR)/agda_dependency_graph.svg \ ./$(WEBSITE_IMAGES_DIR)/agda_dependency_graph_legend.html - @cp $(METAFILES) ./$(AGDA_HTML_DIR)/ - @mkdir -p ./$(AGDA_HTML_DIR)/website - @cp -r ./$(WEBSITE_IMAGES_DIR) ./$(AGDA_HTML_DIR)/website/ - @cp -r ./$(WEBSITE_CSS_DIR) ./$(AGDA_HTML_DIR)/website/ - @cp -r ./$(WEBSITE_JS_DIR) ./$(AGDA_HTML_DIR)/website/ - @cp -r ./$(TABLES_DIR) ./$(AGDA_HTML_DIR) + @cp $(METAFILES) ./$(MDBOOK_SRC)/ + @mkdir -p ./$(MDBOOK_SRC)/website + @cp -r ./$(WEBSITE_IMAGES_DIR) ./$(MDBOOK_SRC)/website/ + @cp -r ./$(WEBSITE_CSS_DIR) ./$(MDBOOK_SRC)/website/ + @cp -r ./$(WEBSITE_JS_DIR) ./$(MDBOOK_SRC)/website/ + @cp -r ./$(TABLES_DIR) ./$(MDBOOK_SRC) .PHONY: website website: website-prepare @@ -193,15 +196,15 @@ serve-website: website-prepare @MDBOOK_PREPROCESSOR__CONCEPTS__SKIP_AGDA=$(SKIPAGDA) \ mdbook serve -p 8080 --open -d ./$(MDBOOK_DIR)/html -$(AGDA_HTML_DIR)/dependency.dot : ./$(SOURCE_DIR)/everything.lagda.md ${AGDAFILES} +$(MDBOOK_SRC)/dependency.dot : ./$(SOURCE_DIR)/everything.lagda.md ${AGDAFILES} ${AGDA} ${AGDAHTMLFLAGS} --dependency-graph=$@ $< .PHONY: graph -graph: $(AGDA_HTML_DIR)/dependency.dot +graph: $(MDBOOK_SRC)/dependency.dot .PHONY: clean clean: - @rm -Rf ./$(AGDA_BUILD_DIR)/ ./$(MDBOOK_DIR)/ ./$(AGDA_HTML_DIR)/ ./$(PROFILING_TEMP_DIR)/ + @rm -Rf ./$(AGDA_BUILD_DIR)/ ./$(MDBOOK_DIR)/ ./$(MDBOOK_SRC)/ ./$(AGDA_PROFILING_TEMP_DIR)/ .PHONY: pre-commit pre-commit: From b2636434d725ac8dcc41ff5736e90354fdc4f224 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 27 Aug 2025 13:28:01 +0200 Subject: [PATCH 04/97] move `theme` to `website/theme` --- .prettierignore | 2 +- Makefile | 2 +- book.toml | 9 +++++---- scripts/generate_agda_css.py | 2 +- {theme => website/theme}/README.md | 0 {theme => website/theme}/catppuccin-admonish.css | 0 {theme => website/theme}/catppuccin.css | 0 {theme => website/theme}/css/chrome.css | 0 {theme => website/theme}/css/general.css | 0 {theme => website/theme}/css/variables.css | 0 {theme => website/theme}/head.hbs | 0 {theme => website/theme}/index.hbs | 0 {theme => website/theme}/pagetoc.css | 0 {theme => website/theme}/pagetoc.js | 0 14 files changed, 8 insertions(+), 7 deletions(-) rename {theme => website/theme}/README.md (100%) rename {theme => website/theme}/catppuccin-admonish.css (100%) rename {theme => website/theme}/catppuccin.css (100%) rename {theme => website/theme}/css/chrome.css (100%) rename {theme => website/theme}/css/general.css (100%) rename {theme => website/theme}/css/variables.css (100%) rename {theme => website/theme}/head.hbs (100%) rename {theme => website/theme}/index.hbs (100%) rename {theme => website/theme}/pagetoc.css (100%) rename {theme => website/theme}/pagetoc.js (100%) diff --git a/.prettierignore b/.prettierignore index c4171a99a6..4557e51a4b 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,4 +1,4 @@ book/ docs/ -theme/index.hbs +website/theme/index.hbs CITATION.cff diff --git a/Makefile b/Makefile index 78e832927d..d75a96db1d 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ WEBSITE_DIR := website WEBSITE_CSS_DIR := $(WEBSITE_DIR)/css WEBSITE_IMAGES_DIR := $(WEBSITE_DIR)/images WEBSITE_JS_DIR := $(WEBSITE_DIR)/js -THEME_DIR := theme +THEME_DIR := website/theme # MDBOOK input, corresponds to the `src` variable in `book.toml` MDBOOK_SRC := docs # MDBOOK build directory diff --git a/book.toml b/book.toml index ee34a8494f..ebc4671e58 100644 --- a/book.toml +++ b/book.toml @@ -66,6 +66,7 @@ before = [ "git-metadata" ] follow-web-links = false [output.html] +theme = "website/theme" default-theme = "light" preferred-dark-theme = "Ayu" # The following option is renamed to smart-punctuation in mdbook 0.4.38 @@ -76,13 +77,13 @@ additional-css = [ "website/css/Agda-highlight.css", "website/css/agda-logo.css", "website/css/bibliography.css", - "theme/catppuccin.css", - "theme/catppuccin-admonish.css", - "theme/pagetoc.css", + "website/theme/catppuccin.css", + "website/theme/catppuccin-admonish.css", + "website/theme/pagetoc.css", ] additional-js = [ "website/js/custom.js", - "theme/pagetoc.js" + "website/theme/pagetoc.js" ] no-section-label = false site-url = "/agda-unimath/" diff --git a/scripts/generate_agda_css.py b/scripts/generate_agda_css.py index cbeef198b4..7ab5c00c09 100644 --- a/scripts/generate_agda_css.py +++ b/scripts/generate_agda_css.py @@ -5,7 +5,7 @@ # In mdbook-catppuccin this is merged to catppuccin.css, so we'll need # to update this script accordingly -CATPPUCCIN_HIGHLIGHT_FILE = 'theme/catppuccin.css' +CATPPUCCIN_HIGHLIGHT_FILE = 'website/theme/catppuccin.css' AGDA_HIGHLIGHT_FILE = 'website/css/Agda-highlight.css' # First group -> theme name diff --git a/theme/README.md b/website/theme/README.md similarity index 100% rename from theme/README.md rename to website/theme/README.md diff --git a/theme/catppuccin-admonish.css b/website/theme/catppuccin-admonish.css similarity index 100% rename from theme/catppuccin-admonish.css rename to website/theme/catppuccin-admonish.css diff --git a/theme/catppuccin.css b/website/theme/catppuccin.css similarity index 100% rename from theme/catppuccin.css rename to website/theme/catppuccin.css diff --git a/theme/css/chrome.css b/website/theme/css/chrome.css similarity index 100% rename from theme/css/chrome.css rename to website/theme/css/chrome.css diff --git a/theme/css/general.css b/website/theme/css/general.css similarity index 100% rename from theme/css/general.css rename to website/theme/css/general.css diff --git a/theme/css/variables.css b/website/theme/css/variables.css similarity index 100% rename from theme/css/variables.css rename to website/theme/css/variables.css diff --git a/theme/head.hbs b/website/theme/head.hbs similarity index 100% rename from theme/head.hbs rename to website/theme/head.hbs diff --git a/theme/index.hbs b/website/theme/index.hbs similarity index 100% rename from theme/index.hbs rename to website/theme/index.hbs diff --git a/theme/pagetoc.css b/website/theme/pagetoc.css similarity index 100% rename from theme/pagetoc.css rename to website/theme/pagetoc.css diff --git a/theme/pagetoc.js b/website/theme/pagetoc.js similarity index 100% rename from theme/pagetoc.js rename to website/theme/pagetoc.js From 0930e35810750ac0a05959c102bb6e071493c403 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 27 Aug 2025 13:31:00 +0200 Subject: [PATCH 05/97] rename `docs` temp directory to `book-src` --- .gitignore | 2 +- .prettierignore | 2 +- Makefile | 2 +- book.toml | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 16596918c1..01f4ce7698 100644 --- a/.gitignore +++ b/.gitignore @@ -420,7 +420,7 @@ node_modules/* package-lock.json # mdbook, automatically generated files -docs/ +book-src/ html/ book/ temp/ diff --git a/.prettierignore b/.prettierignore index 4557e51a4b..581052d714 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,4 +1,4 @@ book/ -docs/ +book-src/ website/theme/index.hbs CITATION.cff diff --git a/Makefile b/Makefile index d75a96db1d..9c80f9cdfa 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ WEBSITE_IMAGES_DIR := $(WEBSITE_DIR)/images WEBSITE_JS_DIR := $(WEBSITE_DIR)/js THEME_DIR := website/theme # MDBOOK input, corresponds to the `src` variable in `book.toml` -MDBOOK_SRC := docs +MDBOOK_SRC := book-src # MDBOOK build directory MDBOOK_DIR := book # Base directory where Agda interface files are stored diff --git a/book.toml b/book.toml index ebc4671e58..392cb1c791 100644 --- a/book.toml +++ b/book.toml @@ -1,7 +1,7 @@ [book] language = "en" multilingual = false -src = "docs" +src = "book-src" title = "agda-unimath" [build] @@ -48,7 +48,7 @@ suppress_processing = [ [preprocessor.concepts] command = "python3 ./scripts/preprocessor_concepts.py" -output-file = "docs/concept_index.json" +output-file = "book-src/concept_index.json" mathswitch-template = "https://mathswitch.xyz/concept/Wd/{wikidata_id}" wikidata-template = "https://www.wikidata.org/entity/{wikidata_id}" skip-agda = false From 81d56660f0c6f4e6b256dd92d5e6e2d05dc93707 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 27 Aug 2025 14:41:53 +0200 Subject: [PATCH 06/97] parmetrize contributors file --- Makefile | 7 +++---- book.toml | 1 + scripts/generate_contributors.py | 29 ++++++++++++++++++++++------ scripts/generate_maintainers.py | 28 +++++++++++++++++++++------ scripts/preprocessor_git_metadata.py | 22 ++++++++++----------- scripts/utils/contributors.py | 14 ++++++-------- 6 files changed, 66 insertions(+), 35 deletions(-) diff --git a/Makefile b/Makefile index 9c80f9cdfa..9f5a068366 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ AGDA_PROFILING_OUTPUT_FILE := $(AGDA_PROFILING_TEMP_DIR)/typecheck_output.txt # Docs TABLES_DIR := tables - +CONTRIBUTORS_FILE := CONTRIBUTORS.toml METAFILES := \ ART.md \ CITE-THIS-LIBRARY.md \ @@ -65,7 +65,6 @@ endif AGDARTS := +RTS -H$(AGDA_MIN_HEAP) -M6G -RTS AGDAFILES := $(shell find $(SOURCE_DIR) -name temp -prune -o -type f \( -name "*.lagda.md" -not -name "everything.lagda.md" \) -print) -CONTRIBUTORS_FILE := CONTRIBUTORS.toml # All our code is in literate Agda, so we could set highlight=code and drop the # css flag, which only affects how files with the .agda extension are processed. @@ -164,10 +163,10 @@ SUMMARY.md: ${AGDAFILES} ./$(SCRIPTS_DIR)/generate_main_index_file.py @python3 ./$(SCRIPTS_DIR)/generate_main_index_file.py MAINTAINERS.md: ${CONTRIBUTORS_FILE} ./$(SCRIPTS_DIR)/generate_maintainers.py - @python3 ./$(SCRIPTS_DIR)/generate_maintainers.py + @python3 ./$(SCRIPTS_DIR)/generate_maintainers.py ${CONTRIBUTORS_FILE} MAINTAINERS.md CONTRIBUTORS.md: ${AGDAFILES} ${CONTRIBUTORS_FILE} ./$(SCRIPTS_DIR)/generate_contributors.py - @python3 ./$(SCRIPTS_DIR)/generate_contributors.py + @python3 ./$(SCRIPTS_DIR)/generate_contributors.py ${CONTRIBUTORS_FILE} CONTRIBUTORS.md $(WEBSITE_CSS_DIR)/Agda-highlight.css: ./$(SCRIPTS_DIR)/generate_agda_css.py ./$(THEME_DIR)/catppuccin.css @python3 ./$(SCRIPTS_DIR)/generate_agda_css.py diff --git a/book.toml b/book.toml index 392cb1c791..08b5b83472 100644 --- a/book.toml +++ b/book.toml @@ -26,6 +26,7 @@ assets_version = "1.2.0" # DO NOT EDIT: Managed by `mdbook-catppuccin install` [preprocessor.git-metadata] command = "python3 ./scripts/preprocessor_git_metadata.py" +contributors_file = "CONTRIBUTORS.toml" # Disable by default - it takes a nontrivial amount of time # Can be overridden by running # `export MDBOOK_PREPROCESSOR__GIT_METADATA__ENABLE=true` in your shell diff --git a/scripts/generate_contributors.py b/scripts/generate_contributors.py index cfb18c87bb..e9af261387 100644 --- a/scripts/generate_contributors.py +++ b/scripts/generate_contributors.py @@ -1,10 +1,13 @@ #!/usr/bin/env python3 # Run this script: -# $ ./scripts/generate_contributors.py +# $ ./scripts/generate_contributors.py CONTRIBUTORS.toml book-src/CONTRIBUTORS.md import subprocess +import argparse +import os +import sys from utils import github_page_for_contributor -from utils.contributors import CONTRIBUTORS_FILE, parse_contributors_file, sorted_authors_from_raw_shortlog_lines +from utils.contributors import parse_contributors_file, sorted_authors_from_raw_shortlog_lines template = """ @@ -38,7 +41,13 @@ def format_contributor(contributor): if __name__ == '__main__': - contributors_data = parse_contributors_file() + parser = argparse.ArgumentParser( + description='Generate contributors markdown content. Usage: generate_contributors.py ') + parser.add_argument('contributors_file', help='Path to the CONTRIBUTORS.toml file.') + parser.add_argument('output_file', help='Output file path to write the generated contributors markdown content to.') + args = parser.parse_args() + + contributors_data = parse_contributors_file(args.contributors_file) git_log_output = subprocess.run([ 'git', 'shortlog', @@ -49,11 +58,19 @@ def format_contributor(contributor): ], capture_output=True, text=True, check=True).stdout.splitlines() sorted_authors = sorted_authors_from_raw_shortlog_lines( - git_log_output, contributors_data) + git_log_output, contributors_data, args.contributors_file) output = template.format( names='\n'.join((format_contributor(c) for c in sorted_authors)), - CONTRIBUTORS_FILE=CONTRIBUTORS_FILE + CONTRIBUTORS_FILE=args.contributors_file ) - with open('CONTRIBUTORS.md', 'w') as output_file: + out_path = args.output_file + if os.path.isdir(out_path): + print(f'Error: {out_path!r} is a directory; please provide a path including the filename.', file=sys.stderr) + sys.exit(2) + parent = os.path.dirname(out_path) + if parent: + os.makedirs(parent, exist_ok=True) + with open(out_path, 'w') as output_file: output_file.write(output) + print(f'Wrote contributors markdown content to {out_path}.') diff --git a/scripts/generate_maintainers.py b/scripts/generate_maintainers.py index cfec6c692a..14c8e91f11 100644 --- a/scripts/generate_maintainers.py +++ b/scripts/generate_maintainers.py @@ -1,9 +1,11 @@ #!/usr/bin/env python3 # Run this script: -# $ ./scripts/generate_maintainers.py +# $ ./scripts/generate_maintainers.py CONTRIBUTORS.toml book-src/MAINTAINERS.md -from utils import github_page_for_contributor -from utils.contributors import CONTRIBUTORS_FILE, parse_contributors_file +import argparse +import os +import sys +from utils.contributors import parse_contributors_file template = """ -## Contributors We are grateful to the following people for their contributions to the library. diff --git a/scripts/generate_maintainers.py b/scripts/generate_maintainers.py index 14c8e91f11..7d9ea818b0 100644 --- a/scripts/generate_maintainers.py +++ b/scripts/generate_maintainers.py @@ -7,12 +7,13 @@ import sys from utils.contributors import parse_contributors_file -template = """ +template = """\ +# Maintainers + -# Maintainers {maintainers} """ diff --git a/scripts/generate_main_index_file.py b/scripts/generate_mdbook_summary.py similarity index 87% rename from scripts/generate_main_index_file.py rename to scripts/generate_mdbook_summary.py index c3f9a3448e..1cd44c9133 100755 --- a/scripts/generate_main_index_file.py +++ b/scripts/generate_mdbook_summary.py @@ -1,8 +1,8 @@ #!/usr/bin/env python3 # Run this script: -# $ ./scripts/generate_main_index_file.py +# $ ./scripts/generate_mdbook_summary.py book-src/SUMMARY.md -import os +import argparse import sys import utils import pathlib @@ -91,12 +91,13 @@ def generate_index(root_path): return index, literature_index, status -summary_template = """ +summary_template = """\ +# SUMMARY + -# SUMMARY # Overview @@ -129,9 +130,15 @@ def generate_index(root_path): if __name__ == '__main__': - root = 'src' + parser = argparse.ArgumentParser( + description='Generate mdbook SUMMARY file. Usage: generate_mdbook_summary.py ') + parser.add_argument('output_file', help='Output file path to write the generated SUMMARY markdown content to.') + parser.add_argument('--root', help='Root path to source.', default='src', required=False) + + args = parser.parse_args() - summary_path = 'SUMMARY.md' + root = args.root + summary_path = args.output_file root_path = pathlib.Path(root) From a5d8ccc8e7d03ea85503c289f785e5bc7f763626 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 27 Aug 2025 15:19:59 +0200 Subject: [PATCH 11/97] place `SUMMARY.md` directly in mdbook source directory --- Makefile | 7 +++---- scripts/generate_mdbook_summary.py | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 43d11bbf1e..32cde59f4e 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,6 @@ METAFILES := \ MIXFIX-OPERATORS.md \ README.md \ STATEMENT-OF-INCLUSION.md \ - SUMMARY.md \ TEMPLATE.lagda.md \ PROJECTS.md \ VISUALIZATION.md @@ -157,8 +156,8 @@ agda-html: ./$(SOURCE_DIR)/everything.lagda.md else python3 ./$(SCRIPTS_DIR)/generate_noagda_html.py ./$(MDBOOK_SRC)/; \ fi -SUMMARY.md: ${AGDAFILES} ./$(SCRIPTS_DIR)/generate_mdbook_summary.py - @python3 ./$(SCRIPTS_DIR)/generate_mdbook_summary.py SUMMARY.md +./$(MDBOOK_SRC)/SUMMARY.md: ${AGDAFILES} ./$(SCRIPTS_DIR)/generate_mdbook_summary.py + @python3 ./$(SCRIPTS_DIR)/generate_mdbook_summary.py ./$(MDBOOK_SRC)/SUMMARY.md ./$(MDBOOK_SRC)/MAINTAINERS.md: ${CONTRIBUTORS_FILE} ./$(SCRIPTS_DIR)/generate_maintainers.py @python3 ./$(SCRIPTS_DIR)/generate_maintainers.py ${CONTRIBUTORS_FILE} ./$(MDBOOK_SRC)/MAINTAINERS.md @@ -173,7 +172,7 @@ $(WEBSITE_IMAGES_DIR)/agda_dependency_graph.svg $(WEBSITE_IMAGES_DIR)/agda_depen @python3 ./$(SCRIPTS_DIR)/generate_dependency_graph_rendering.py $(WEBSITE_IMAGES_DIR)/agda_dependency_graph svg || true .PHONY: website-prepare -website-prepare: agda-html ./SUMMARY.md ./$(MDBOOK_SRC)/CONTRIBUTORS.md ./$(MDBOOK_SRC)/MAINTAINERS.md \ +website-prepare: agda-html ./$(MDBOOK_SRC)/SUMMARY.md ./$(MDBOOK_SRC)/CONTRIBUTORS.md ./$(MDBOOK_SRC)/MAINTAINERS.md \ ./$(WEBSITE_CSS_DIR)/Agda-highlight.css ./$(WEBSITE_IMAGES_DIR)/agda_dependency_graph.svg \ ./$(WEBSITE_IMAGES_DIR)/agda_dependency_graph_legend.html @cp $(METAFILES) ./$(MDBOOK_SRC)/ diff --git a/scripts/generate_mdbook_summary.py b/scripts/generate_mdbook_summary.py index 1cd44c9133..8ce8795a3a 100755 --- a/scripts/generate_mdbook_summary.py +++ b/scripts/generate_mdbook_summary.py @@ -150,4 +150,5 @@ def generate_index(root_path): ) with open(summary_path, 'w') as summary_file: summary_file.write(summary_contents) + print(f'Wrote mdbook summary content to {summary_path}.') sys.exit(status) From 56141c7e5277a49f4c428ba9ac58185f5482be5c Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 27 Aug 2025 15:40:02 +0200 Subject: [PATCH 12/97] move docs to new `docs` folder --- Makefile | 21 ++++--------------- ART.md => docs/ART.md | 0 .../CITE-THIS-LIBRARY.md | 0 CITING-SOURCES.md => docs/CITING-SOURCES.md | 0 CODINGSTYLE.md => docs/CODINGSTYLE.md | 0 .../DESIGN-PRINCIPLES.md | 0 .../FILE-CONVENTIONS.md | 4 ++-- .../GRANT-ACKNOWLEDGMENTS.md | 0 HOME.md => docs/HOME.md | 0 HOWTO-INSTALL.md => docs/HOWTO-INSTALL.md | 0 .../MIXFIX-OPERATORS.md | 0 PROJECTS.md => docs/PROJECTS.md | 0 .../STATEMENT-OF-INCLUSION.md | 0 TEMPLATE.lagda.md => docs/TEMPLATE.lagda.md | 0 VISUALIZATION.md => docs/VISUALIZATION.md | 0 {tables => docs/tables}/categories.md | 0 {tables => docs/tables}/composition.md | 0 {tables => docs/tables}/cyclic-types.md | 0 {tables => docs/tables}/fibers-of-maps.md | 0 {tables => docs/tables}/galois-connections.md | 0 {tables => docs/tables}/higher-modalities.md | 0 {tables => docs/tables}/identity-types.md | 0 .../tables}/loop-spaces-concepts.md | 0 {tables => docs/tables}/metric-spaces.md | 0 {tables => docs/tables}/precategories.md | 0 .../tables}/propositional-logic.md | 0 {tables => docs/tables}/pullbacks.md | 0 {tables => docs/tables}/pushouts.md | 0 {tables => docs/tables}/sequential-limits.md | 0 {tables => docs/tables}/wild-categories.md | 0 30 files changed, 6 insertions(+), 19 deletions(-) rename ART.md => docs/ART.md (100%) rename CITE-THIS-LIBRARY.md => docs/CITE-THIS-LIBRARY.md (100%) rename CITING-SOURCES.md => docs/CITING-SOURCES.md (100%) rename CODINGSTYLE.md => docs/CODINGSTYLE.md (100%) rename DESIGN-PRINCIPLES.md => docs/DESIGN-PRINCIPLES.md (100%) rename FILE-CONVENTIONS.md => docs/FILE-CONVENTIONS.md (97%) rename GRANT-ACKNOWLEDGMENTS.md => docs/GRANT-ACKNOWLEDGMENTS.md (100%) rename HOME.md => docs/HOME.md (100%) rename HOWTO-INSTALL.md => docs/HOWTO-INSTALL.md (100%) rename MIXFIX-OPERATORS.md => docs/MIXFIX-OPERATORS.md (100%) rename PROJECTS.md => docs/PROJECTS.md (100%) rename STATEMENT-OF-INCLUSION.md => docs/STATEMENT-OF-INCLUSION.md (100%) rename TEMPLATE.lagda.md => docs/TEMPLATE.lagda.md (100%) rename VISUALIZATION.md => docs/VISUALIZATION.md (100%) rename {tables => docs/tables}/categories.md (100%) rename {tables => docs/tables}/composition.md (100%) rename {tables => docs/tables}/cyclic-types.md (100%) rename {tables => docs/tables}/fibers-of-maps.md (100%) rename {tables => docs/tables}/galois-connections.md (100%) rename {tables => docs/tables}/higher-modalities.md (100%) rename {tables => docs/tables}/identity-types.md (100%) rename {tables => docs/tables}/loop-spaces-concepts.md (100%) rename {tables => docs/tables}/metric-spaces.md (100%) rename {tables => docs/tables}/precategories.md (100%) rename {tables => docs/tables}/propositional-logic.md (100%) rename {tables => docs/tables}/pullbacks.md (100%) rename {tables => docs/tables}/pushouts.md (100%) rename {tables => docs/tables}/sequential-limits.md (100%) rename {tables => docs/tables}/wild-categories.md (100%) diff --git a/Makefile b/Makefile index 32cde59f4e..2c6b910076 100644 --- a/Makefile +++ b/Makefile @@ -18,26 +18,13 @@ AGDA_PROFILING_TEMP_DIR := temp AGDA_PROFILING_OUTPUT_FILE := $(AGDA_PROFILING_TEMP_DIR)/typecheck_output.txt # Docs -TABLES_DIR := tables +DOCS_DIR := docs +TABLES_DIR := $(DOCS_DIR)/tables CONTRIBUTORS_FILE := CONTRIBUTORS.toml METAFILES := \ - ART.md \ - CITE-THIS-LIBRARY.md \ - CITING-SOURCES.md \ - CODINGSTYLE.md \ CONTRIBUTING.md \ - FILE-CONVENTIONS.md \ - DESIGN-PRINCIPLES.md \ - GRANT-ACKNOWLEDGMENTS.md \ - HOME.md \ - HOWTO-INSTALL.md \ LICENSE.md \ - MIXFIX-OPERATORS.md \ - README.md \ - STATEMENT-OF-INCLUSION.md \ - TEMPLATE.lagda.md \ - PROJECTS.md \ - VISUALIZATION.md + README.md # Options added to the autogenerated `everything.lagda.md` file. @@ -176,11 +163,11 @@ website-prepare: agda-html ./$(MDBOOK_SRC)/SUMMARY.md ./$(MDBOOK_SRC)/CONTRIBUTO ./$(WEBSITE_CSS_DIR)/Agda-highlight.css ./$(WEBSITE_IMAGES_DIR)/agda_dependency_graph.svg \ ./$(WEBSITE_IMAGES_DIR)/agda_dependency_graph_legend.html @cp $(METAFILES) ./$(MDBOOK_SRC)/ + @cp -r ./$(DOCS_DIR)/ ./$(MDBOOK_SRC) @mkdir -p ./$(MDBOOK_SRC)/website @cp -r ./$(WEBSITE_IMAGES_DIR) ./$(MDBOOK_SRC)/website/ @cp -r ./$(WEBSITE_CSS_DIR) ./$(MDBOOK_SRC)/website/ @cp -r ./$(WEBSITE_JS_DIR) ./$(MDBOOK_SRC)/website/ - @cp -r ./$(TABLES_DIR) ./$(MDBOOK_SRC) .PHONY: website website: website-prepare diff --git a/ART.md b/docs/ART.md similarity index 100% rename from ART.md rename to docs/ART.md diff --git a/CITE-THIS-LIBRARY.md b/docs/CITE-THIS-LIBRARY.md similarity index 100% rename from CITE-THIS-LIBRARY.md rename to docs/CITE-THIS-LIBRARY.md diff --git a/CITING-SOURCES.md b/docs/CITING-SOURCES.md similarity index 100% rename from CITING-SOURCES.md rename to docs/CITING-SOURCES.md diff --git a/CODINGSTYLE.md b/docs/CODINGSTYLE.md similarity index 100% rename from CODINGSTYLE.md rename to docs/CODINGSTYLE.md diff --git a/DESIGN-PRINCIPLES.md b/docs/DESIGN-PRINCIPLES.md similarity index 100% rename from DESIGN-PRINCIPLES.md rename to docs/DESIGN-PRINCIPLES.md diff --git a/FILE-CONVENTIONS.md b/docs/FILE-CONVENTIONS.md similarity index 97% rename from FILE-CONVENTIONS.md rename to docs/FILE-CONVENTIONS.md index 2cfd843629..34867ad979 100644 --- a/FILE-CONVENTIONS.md +++ b/docs/FILE-CONVENTIONS.md @@ -131,7 +131,7 @@ explanatory text within a section when necessary. If you want to include a table in your file, for example listing examples of a relevant construction or files with related concepts, we suggest adding the -table as its own Markdown file in the `tables` directory, using +table as its own Markdown file in the `docs/tables` directory, using [Markdown syntax for tables](https://www.markdownguide.org/extended-syntax/#tables). This isn't a strict rule, and there are valid reasons for only having a table in a file directly, but for the two example cases outlined above, we recommend @@ -160,7 +160,7 @@ contents of the file. `[The univalence axiom](foundation.univalence.md)`, which will be displayed as [The univalence axiom](foundation.univalence.md). - You can reference another module by module name using - ``[`foundation.univalence`](foundation.univalence.md)``, which will be + `` [`foundation.univalence`](foundation.univalence.md) ``, which will be displayed as [`foundation.univalence`](foundation.univalence.md). - If you just want to add a clickable link, use the pattern ``. This will be displayed as diff --git a/GRANT-ACKNOWLEDGMENTS.md b/docs/GRANT-ACKNOWLEDGMENTS.md similarity index 100% rename from GRANT-ACKNOWLEDGMENTS.md rename to docs/GRANT-ACKNOWLEDGMENTS.md diff --git a/HOME.md b/docs/HOME.md similarity index 100% rename from HOME.md rename to docs/HOME.md diff --git a/HOWTO-INSTALL.md b/docs/HOWTO-INSTALL.md similarity index 100% rename from HOWTO-INSTALL.md rename to docs/HOWTO-INSTALL.md diff --git a/MIXFIX-OPERATORS.md b/docs/MIXFIX-OPERATORS.md similarity index 100% rename from MIXFIX-OPERATORS.md rename to docs/MIXFIX-OPERATORS.md diff --git a/PROJECTS.md b/docs/PROJECTS.md similarity index 100% rename from PROJECTS.md rename to docs/PROJECTS.md diff --git a/STATEMENT-OF-INCLUSION.md b/docs/STATEMENT-OF-INCLUSION.md similarity index 100% rename from STATEMENT-OF-INCLUSION.md rename to docs/STATEMENT-OF-INCLUSION.md diff --git a/TEMPLATE.lagda.md b/docs/TEMPLATE.lagda.md similarity index 100% rename from TEMPLATE.lagda.md rename to docs/TEMPLATE.lagda.md diff --git a/VISUALIZATION.md b/docs/VISUALIZATION.md similarity index 100% rename from VISUALIZATION.md rename to docs/VISUALIZATION.md diff --git a/tables/categories.md b/docs/tables/categories.md similarity index 100% rename from tables/categories.md rename to docs/tables/categories.md diff --git a/tables/composition.md b/docs/tables/composition.md similarity index 100% rename from tables/composition.md rename to docs/tables/composition.md diff --git a/tables/cyclic-types.md b/docs/tables/cyclic-types.md similarity index 100% rename from tables/cyclic-types.md rename to docs/tables/cyclic-types.md diff --git a/tables/fibers-of-maps.md b/docs/tables/fibers-of-maps.md similarity index 100% rename from tables/fibers-of-maps.md rename to docs/tables/fibers-of-maps.md diff --git a/tables/galois-connections.md b/docs/tables/galois-connections.md similarity index 100% rename from tables/galois-connections.md rename to docs/tables/galois-connections.md diff --git a/tables/higher-modalities.md b/docs/tables/higher-modalities.md similarity index 100% rename from tables/higher-modalities.md rename to docs/tables/higher-modalities.md diff --git a/tables/identity-types.md b/docs/tables/identity-types.md similarity index 100% rename from tables/identity-types.md rename to docs/tables/identity-types.md diff --git a/tables/loop-spaces-concepts.md b/docs/tables/loop-spaces-concepts.md similarity index 100% rename from tables/loop-spaces-concepts.md rename to docs/tables/loop-spaces-concepts.md diff --git a/tables/metric-spaces.md b/docs/tables/metric-spaces.md similarity index 100% rename from tables/metric-spaces.md rename to docs/tables/metric-spaces.md diff --git a/tables/precategories.md b/docs/tables/precategories.md similarity index 100% rename from tables/precategories.md rename to docs/tables/precategories.md diff --git a/tables/propositional-logic.md b/docs/tables/propositional-logic.md similarity index 100% rename from tables/propositional-logic.md rename to docs/tables/propositional-logic.md diff --git a/tables/pullbacks.md b/docs/tables/pullbacks.md similarity index 100% rename from tables/pullbacks.md rename to docs/tables/pullbacks.md diff --git a/tables/pushouts.md b/docs/tables/pushouts.md similarity index 100% rename from tables/pushouts.md rename to docs/tables/pushouts.md diff --git a/tables/sequential-limits.md b/docs/tables/sequential-limits.md similarity index 100% rename from tables/sequential-limits.md rename to docs/tables/sequential-limits.md diff --git a/tables/wild-categories.md b/docs/tables/wild-categories.md similarity index 100% rename from tables/wild-categories.md rename to docs/tables/wild-categories.md From a71a12f78ccacc2b1e72fe12d2c555710ca2f12a Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 27 Aug 2025 15:44:53 +0200 Subject: [PATCH 13/97] "statement of inclusivity*" --- book.toml | 2 +- ...{STATEMENT-OF-INCLUSION.md => STATEMENT-OF-INCLUSIVITY.md} | 2 +- scripts/generate_mdbook_summary.py | 4 ++-- website/js/custom.js | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) rename docs/{STATEMENT-OF-INCLUSION.md => STATEMENT-OF-INCLUSIVITY.md} (97%) diff --git a/book.toml b/book.toml index 50f8dec992..417add9384 100644 --- a/book.toml +++ b/book.toml @@ -42,7 +42,7 @@ suppress_processing = [ "HOME.md", "MAINTAINERS.md", "PROJECTS.md", - "STATEMENT-OF-INCLUSION.md", + "STATEMENT-OF-INCLUSIVITY.md", "SUMMARY.md", "VISUALIZATION.md" ] diff --git a/docs/STATEMENT-OF-INCLUSION.md b/docs/STATEMENT-OF-INCLUSIVITY.md similarity index 97% rename from docs/STATEMENT-OF-INCLUSION.md rename to docs/STATEMENT-OF-INCLUSIVITY.md index dddbdbb2c1..824168eabe 100644 --- a/docs/STATEMENT-OF-INCLUSION.md +++ b/docs/STATEMENT-OF-INCLUSIVITY.md @@ -1,4 +1,4 @@ -# Statement of inclusion +# Statement of inclusivity There are many reasons to contribute something to a library of formalized mathematics. Some do it just for fun, some do it for their research, some do it diff --git a/scripts/generate_mdbook_summary.py b/scripts/generate_mdbook_summary.py index 8ce8795a3a..2b61014a1a 100755 --- a/scripts/generate_mdbook_summary.py +++ b/scripts/generate_mdbook_summary.py @@ -105,7 +105,7 @@ def generate_index(root_path): - [Community](CONTRIBUTORS.md) - [Maintainers](MAINTAINERS.md) - [Contributors](CONTRIBUTORS.md) - - [Statement of inclusivity](STATEMENT-OF-INCLUSION.md) + - [Statement of inclusivity](STATEMENT-OF-INCLUSIVITY.md) - [Projects using agda-unimath](PROJECTS.md) - [Grant acknowledgments](GRANT-ACKNOWLEDGMENTS.md) - [Guides](HOWTO-INSTALL.md) @@ -120,7 +120,7 @@ def generate_index(root_path): - [Citing the library](CITE-THIS-LIBRARY.md) - [Library explorer](VISUALIZATION.md) - [Art](ART.md) -- [Full list of library contents](SUMMARY.md) +- [Full list of contents](SUMMARY.md) {literature_index} # The agda-unimath library diff --git a/website/js/custom.js b/website/js/custom.js index d12932153d..486224fbec 100644 --- a/website/js/custom.js +++ b/website/js/custom.js @@ -18,7 +18,7 @@ if (link) { 'MAINTAINERS.md', 'MIXFIX-OPERATORS.md', 'README.md', - 'STATEMENT-OF-INCLUSION.md', + 'STATEMENT-OF-INCLUSIVITY.md', 'SUMMARY.md', 'PROJECTS.md', 'VISUALIZATION.md', From e9cf143d3e784b6d52568fd8352d4304f1c9cd2b Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 27 Aug 2025 15:47:33 +0200 Subject: [PATCH 14/97] tidy `Makefile` --- Makefile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 2c6b910076..23407262af 100644 --- a/Makefile +++ b/Makefile @@ -16,16 +16,15 @@ AGDA_BUILD_DIR := _build # Agda profiling directory AGDA_PROFILING_TEMP_DIR := temp AGDA_PROFILING_OUTPUT_FILE := $(AGDA_PROFILING_TEMP_DIR)/typecheck_output.txt - # Docs DOCS_DIR := docs TABLES_DIR := $(DOCS_DIR)/tables -CONTRIBUTORS_FILE := CONTRIBUTORS.toml METAFILES := \ CONTRIBUTING.md \ LICENSE.md \ README.md - +# Meta +CONTRIBUTORS_FILE := CONTRIBUTORS.toml # Options added to the autogenerated `everything.lagda.md` file. # We put options that apply to all files into the `agda-unimath.agda-lib` file, @@ -132,8 +131,6 @@ profile-module: @# Cleanup @rm -f ./$(AGDA_PROFILING_OUTPUT_FILE) - - agda-html: ./$(SOURCE_DIR)/everything.lagda.md @rm -rf ./$(MDBOOK_SRC)/ @mkdir -p ./$(MDBOOK_SRC)/ From dc50a2084730e323383043c0095ddbf2cdfa4052 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 27 Aug 2025 15:51:00 +0200 Subject: [PATCH 15/97] a word --- scripts/generate_maintainers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/generate_maintainers.py b/scripts/generate_maintainers.py index 7d9ea818b0..9128cfca08 100644 --- a/scripts/generate_maintainers.py +++ b/scripts/generate_maintainers.py @@ -34,7 +34,7 @@ def format_maintainer(maintainer): parser = argparse.ArgumentParser( description='Generate maintainers markdown content. Usage: generate_maintainers.py ') parser.add_argument('contributors_file', help='Path to the CONTRIBUTORS.toml file.') - parser.add_argument('output_file', help='Output file path to write the generated contributors markdown content to.') + parser.add_argument('output_file', help='Output file path to write the generated maintainers markdown content to.') args = parser.parse_args() contributors_data = parse_contributors_file(args.contributors_file) From e0e4ee6ff606d30f64376506402c40e8ec5bcdc1 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 27 Aug 2025 15:55:43 +0200 Subject: [PATCH 16/97] simplify directory variables --- Makefile | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index 23407262af..d0b7c4b486 100644 --- a/Makefile +++ b/Makefile @@ -3,19 +3,19 @@ SOURCE_DIR := src SCRIPTS_DIR := scripts # Website assets WEBSITE_DIR := website -WEBSITE_CSS_DIR := $(WEBSITE_DIR)/css -WEBSITE_IMAGES_DIR := $(WEBSITE_DIR)/images -WEBSITE_JS_DIR := $(WEBSITE_DIR)/js -THEME_DIR := website/theme +WEBSITE_CSS := $(WEBSITE_DIR)/css +WEBSITE_IMAGES := $(WEBSITE_DIR)/images +WEBSITE_JS := $(WEBSITE_DIR)/js +WEBSITE_THEME := website/theme # MDBOOK input, corresponds to the `src` variable in `book.toml` MDBOOK_SRC := book-src # MDBOOK build directory -MDBOOK_DIR := book +MDBOOK_BUILD := book # Base directory where Agda interface files are stored -AGDA_BUILD_DIR := _build +AGDA_BUILD := _build # Agda profiling directory -AGDA_PROFILING_TEMP_DIR := temp -AGDA_PROFILING_OUTPUT_FILE := $(AGDA_PROFILING_TEMP_DIR)/typecheck_output.txt +AGDA_PROFILING_TEMP := temp +AGDA_PROFILING_FILE := $(AGDA_PROFILING_TEMP)/typecheck_output.txt # Docs DOCS_DIR := docs TABLES_DIR := $(DOCS_DIR)/tables @@ -57,7 +57,7 @@ AGDAFILES := $(shell find $(SOURCE_DIR) -name temp -prune -o -type f \( -name "* # resulting page looks garbled. With highlight=auto and the default Agda.css, it # at is at least in a proper code block with syntax highlighting, albeit without # the agda-unimath chrome. -AGDAHTMLFLAGS ?= --html --html-highlight=auto --html-dir=$(MDBOOK_SRC) --css=$(WEBSITE_CSS_DIR)/Agda.css --only-scope-checking +AGDAHTMLFLAGS ?= --html --html-highlight=auto --html-dir=$(MDBOOK_SRC) --css=$(WEBSITE_CSS)/Agda.css --only-scope-checking AGDAPROFILEFLAGS ?= --profile=modules +RTS -s -RTS AGDA ?= agda $(AGDAVERBOSE) $(AGDARTS) TIME ?= time @@ -112,24 +112,24 @@ profile-module: fi @# Attempt to delete the interface file only if the build directory exists @echo "\033[0;32mAttempting to delete interface file for $(MODULE)\033[0m" - @find ./$(AGDA_BUILD_DIR) -type f -path "*/agda/$(SOURCE_DIR)/$(MODULE_DIR).agdai" -exec rm -f {} \+ 2>/dev/null || \ - echo "\033[0;31m$(AGDA_BUILD_DIR) directory does not exist, skipping deletion of interface files.\033[0m" + @find ./$(AGDA_BUILD) -type f -path "*/agda/$(SOURCE_DIR)/$(MODULE_DIR).agdai" -exec rm -f {} \+ 2>/dev/null || \ + echo "\033[0;31m$(AGDA_BUILD) directory does not exist, skipping deletion of interface files.\033[0m" @# Ensure the temporary directory exists - @mkdir -p ./$(AGDA_PROFILING_TEMP_DIR) + @mkdir -p ./$(AGDA_PROFILING_TEMP) @# Profile typechecking the module and capture the output in the temp directory, also display on terminal @echo "\033[0;32mProfiling typechecking of $(MODULE)\033[0m" - @$(AGDA) $(PROFILE_MODULE_AGDA_ARGS) $(SOURCE_DIR)/$(MODULE_DIR).lagda.md 2>&1 | tee ./$(AGDA_PROFILING_OUTPUT_FILE) + @$(AGDA) $(PROFILE_MODULE_AGDA_ARGS) $(SOURCE_DIR)/$(MODULE_DIR).lagda.md 2>&1 | tee ./$(AGDA_PROFILING_FILE) @# Check for additional modules being typechecked by looking for any indented "Checking" line - @if grep -E "^\s+Checking " ./$(AGDA_PROFILING_OUTPUT_FILE) > /dev/null; then \ + @if grep -E "^\s+Checking " ./$(AGDA_PROFILING_FILE) > /dev/null; then \ echo "\033[0;31mOther modules were also checked. Repeating profiling after deleting interface file again.\033[0m"; \ - find ./$(AGDA_BUILD_DIR) -type f -path "*/agda/$(SOURCE_DIR)/$(MODULE_DIR).agdai" -exec rm -f {} \+; \ + find ./$(AGDA_BUILD) -type f -path "*/agda/$(SOURCE_DIR)/$(MODULE_DIR).agdai" -exec rm -f {} \+; \ $(AGDA) $(PROFILE_MODULE_AGDA_ARGS) $(SOURCE_DIR)/$(MODULE_DIR).lagda.md; \ else \ echo "\033[0;32mOnly $(MODULE) was checked. Profiling complete.\033[0m"; \ fi @# Cleanup - @rm -f ./$(AGDA_PROFILING_OUTPUT_FILE) + @rm -f ./$(AGDA_PROFILING_FILE) agda-html: ./$(SOURCE_DIR)/everything.lagda.md @rm -rf ./$(MDBOOK_SRC)/ @@ -149,22 +149,22 @@ agda-html: ./$(SOURCE_DIR)/everything.lagda.md ./$(MDBOOK_SRC)/CONTRIBUTORS.md: ${AGDAFILES} ${CONTRIBUTORS_FILE} ./$(SCRIPTS_DIR)/generate_contributors.py @python3 ./$(SCRIPTS_DIR)/generate_contributors.py ${CONTRIBUTORS_FILE} ./$(MDBOOK_SRC)/CONTRIBUTORS.md -$(WEBSITE_CSS_DIR)/Agda-highlight.css: ./$(SCRIPTS_DIR)/generate_agda_css.py ./$(THEME_DIR)/catppuccin.css +$(WEBSITE_CSS)/Agda-highlight.css: ./$(SCRIPTS_DIR)/generate_agda_css.py ./$(WEBSITE_THEME)/catppuccin.css @python3 ./$(SCRIPTS_DIR)/generate_agda_css.py -$(WEBSITE_IMAGES_DIR)/agda_dependency_graph.svg $(WEBSITE_IMAGES_DIR)/agda_dependency_graph_legend.html &: ${AGDAFILES} - @python3 ./$(SCRIPTS_DIR)/generate_dependency_graph_rendering.py $(WEBSITE_IMAGES_DIR)/agda_dependency_graph svg || true +$(WEBSITE_IMAGES)/agda_dependency_graph.svg $(WEBSITE_IMAGES)/agda_dependency_graph_legend.html &: ${AGDAFILES} + @python3 ./$(SCRIPTS_DIR)/generate_dependency_graph_rendering.py $(WEBSITE_IMAGES)/agda_dependency_graph svg || true .PHONY: website-prepare website-prepare: agda-html ./$(MDBOOK_SRC)/SUMMARY.md ./$(MDBOOK_SRC)/CONTRIBUTORS.md ./$(MDBOOK_SRC)/MAINTAINERS.md \ - ./$(WEBSITE_CSS_DIR)/Agda-highlight.css ./$(WEBSITE_IMAGES_DIR)/agda_dependency_graph.svg \ - ./$(WEBSITE_IMAGES_DIR)/agda_dependency_graph_legend.html + ./$(WEBSITE_CSS)/Agda-highlight.css ./$(WEBSITE_IMAGES)/agda_dependency_graph.svg \ + ./$(WEBSITE_IMAGES)/agda_dependency_graph_legend.html @cp $(METAFILES) ./$(MDBOOK_SRC)/ @cp -r ./$(DOCS_DIR)/ ./$(MDBOOK_SRC) @mkdir -p ./$(MDBOOK_SRC)/website - @cp -r ./$(WEBSITE_IMAGES_DIR) ./$(MDBOOK_SRC)/website/ - @cp -r ./$(WEBSITE_CSS_DIR) ./$(MDBOOK_SRC)/website/ - @cp -r ./$(WEBSITE_JS_DIR) ./$(MDBOOK_SRC)/website/ + @cp -r ./$(WEBSITE_IMAGES) ./$(MDBOOK_SRC)/website/ + @cp -r ./$(WEBSITE_CSS) ./$(MDBOOK_SRC)/website/ + @cp -r ./$(WEBSITE_JS) ./$(MDBOOK_SRC)/website/ .PHONY: website website: website-prepare @@ -174,7 +174,7 @@ website: website-prepare .PHONY: serve-website serve-website: website-prepare @MDBOOK_PREPROCESSOR__CONCEPTS__SKIP_AGDA=$(SKIPAGDA) \ - mdbook serve -p 8080 --open -d ./$(MDBOOK_DIR)/html + mdbook serve -p 8080 --open -d ./$(MDBOOK_BUILD)/html $(MDBOOK_SRC)/dependency.dot : ./$(SOURCE_DIR)/everything.lagda.md ${AGDAFILES} ${AGDA} ${AGDAHTMLFLAGS} --dependency-graph=$@ $< @@ -184,7 +184,7 @@ graph: $(MDBOOK_SRC)/dependency.dot .PHONY: clean clean: - @rm -Rf ./$(AGDA_BUILD_DIR)/ ./$(MDBOOK_DIR)/ ./$(MDBOOK_SRC)/ ./$(AGDA_PROFILING_TEMP_DIR)/ + @rm -Rf ./$(AGDA_BUILD)/ ./$(MDBOOK_BUILD)/ ./$(MDBOOK_SRC)/ ./$(AGDA_PROFILING_TEMP)/ .PHONY: pre-commit pre-commit: From 4e0cc3b157e8e4d95bdda3017c0517e24ffd7461 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 27 Aug 2025 15:57:00 +0200 Subject: [PATCH 17/97] simplify directory variables --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index d0b7c4b486..0ec399b690 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ MDBOOK_BUILD := book AGDA_BUILD := _build # Agda profiling directory AGDA_PROFILING_TEMP := temp -AGDA_PROFILING_FILE := $(AGDA_PROFILING_TEMP)/typecheck_output.txt +AGDA_PROFILING_OUTPUT := $(AGDA_PROFILING_TEMP)/typecheck_output.txt # Docs DOCS_DIR := docs TABLES_DIR := $(DOCS_DIR)/tables @@ -118,9 +118,9 @@ profile-module: @mkdir -p ./$(AGDA_PROFILING_TEMP) @# Profile typechecking the module and capture the output in the temp directory, also display on terminal @echo "\033[0;32mProfiling typechecking of $(MODULE)\033[0m" - @$(AGDA) $(PROFILE_MODULE_AGDA_ARGS) $(SOURCE_DIR)/$(MODULE_DIR).lagda.md 2>&1 | tee ./$(AGDA_PROFILING_FILE) + @$(AGDA) $(PROFILE_MODULE_AGDA_ARGS) $(SOURCE_DIR)/$(MODULE_DIR).lagda.md 2>&1 | tee ./$(AGDA_PROFILING_OUTPUT) @# Check for additional modules being typechecked by looking for any indented "Checking" line - @if grep -E "^\s+Checking " ./$(AGDA_PROFILING_FILE) > /dev/null; then \ + @if grep -E "^\s+Checking " ./$(AGDA_PROFILING_OUTPUT) > /dev/null; then \ echo "\033[0;31mOther modules were also checked. Repeating profiling after deleting interface file again.\033[0m"; \ find ./$(AGDA_BUILD) -type f -path "*/agda/$(SOURCE_DIR)/$(MODULE_DIR).agdai" -exec rm -f {} \+; \ $(AGDA) $(PROFILE_MODULE_AGDA_ARGS) $(SOURCE_DIR)/$(MODULE_DIR).lagda.md; \ @@ -129,7 +129,7 @@ profile-module: fi @# Cleanup - @rm -f ./$(AGDA_PROFILING_FILE) + @rm -f ./$(AGDA_PROFILING_OUTPUT) agda-html: ./$(SOURCE_DIR)/everything.lagda.md @rm -rf ./$(MDBOOK_SRC)/ From a659f48a939538a95b4cc356a33b724e1e7ee743 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 27 Aug 2025 17:17:42 +0200 Subject: [PATCH 18/97] add `config` folder --- .github/workflows/ci.yaml | 3 +-- .github/workflows/pages.yaml | 3 +-- .pre-commit-config.yaml | 7 ++++--- .vscode/settings.json | 2 +- CONTRIBUTING.md | 4 ++-- book.toml | 2 +- .codespellrc => config/.codespellrc | 2 +- .prettierignore => config/.prettierignore | 2 +- .prettierrc.json => config/.prettierrc.json | 0 .../codespell-dictionary.txt | 0 codespell-ignore.txt => config/codespell-ignore.txt | 0 {website => config}/latex-macros.txt | 0 docs/CODINGSTYLE.md | 1 + docs/FILE-CONVENTIONS.md | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) rename .codespellrc => config/.codespellrc (81%) rename .prettierignore => config/.prettierignore (54%) rename .prettierrc.json => config/.prettierrc.json (100%) rename codespell-dictionary.txt => config/codespell-dictionary.txt (100%) rename codespell-ignore.txt => config/codespell-ignore.txt (100%) rename {website => config}/latex-macros.txt (100%) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2773a028c8..5af8e0bbb6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -47,8 +47,7 @@ jobs: name: Restore Agda formalization cache with: path: master/_build - key: - ${{ runner.os }}-check-${{ github.ref }}-${{ matrix.agda }}-${{ + key: ${{ runner.os }}-check-${{ github.ref }}-${{ matrix.agda }}-${{ hashFiles('master/src/**') }} restore-keys: | ${{ runner.os }}-check-${{ github.ref }}-${{ matrix.agda }}- diff --git a/.github/workflows/pages.yaml b/.github/workflows/pages.yaml index 718d6a7542..b69ed6e1d6 100644 --- a/.github/workflows/pages.yaml +++ b/.github/workflows/pages.yaml @@ -48,8 +48,7 @@ jobs: name: Restore Agda formalization cache with: path: master/_build - key: - ${{ runner.os }}-check-${{ github.ref }}-${{ matrix.agda }}-${{ + key: ${{ runner.os }}-check-${{ github.ref }}-${{ matrix.agda }}-${{ hashFiles('master/src/**') }} restore-keys: | ${{ runner.os }}-check-${{ github.ref }}-${{ matrix.agda }}- diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e18b157c32..f8d3c3d33a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,11 +22,11 @@ repos: args: [ '--config', - '.codespellrc', + 'config/.codespellrc', '--builtin', 'clear,rare,informal,usage,code,names,en-GB_to_en-US', '--dictionary', - 'codespell-dictionary.txt,-', + 'config/codespell-dictionary.txt,-', ] - repo: local @@ -35,7 +35,7 @@ repos: name: Sort codespell dictionary and ignore files entry: bash -c 'for f in "$@"; do LC_ALL=C sort -o "$f" "$f"; done' -- language: system - files: ^codespell-(dictionary|ignore)\.txt$ + files: ^config/codespell-(dictionary|ignore)\.txt$ - id: markdown-conventions name: Markdown conventions entry: scripts/markdown_conventions.py @@ -133,6 +133,7 @@ repos: - id: prettier name: CSS, JS, YAML and Markdown (no codeblocks) formatting types_or: [css, javascript, yaml, markdown] + args: ['--ignore-path', 'config/.prettierignore'] - repo: https://github.com/FlamingTempura/bibtex-tidy rev: v1.14.0 diff --git a/.vscode/settings.json b/.vscode/settings.json index 637fc489bd..75eaafe676 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -38,7 +38,7 @@ // Autoformatting "editor.defaultFormatter": "esbenp.prettier-vscode", - "prettier.configPath": ".prettierrc.json", + "prettier.configPath": "config/.prettierrc.json", "editor.formatOnType": true, "editor.formatOnSave": true, diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4cb68f9cee..8bacdf056a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,11 +43,11 @@ Below is a summary of the tasks this tool performs: permissible spellchecker that only reports known misspellings, rather than words it does not recognize. I.e., it is a blacklist based spellchecker. We maintain an additional library-defined dictionary of misspellings at: - [`codespell-dictionary.txt`](https://github.com/UniMath/agda-unimath/blob/master/codespell-dictionary.txt). + [`config/codespell-dictionary.txt`](https://github.com/UniMath/agda-unimath/blob/master/codespell-dictionary.txt). If you find a misspelled word in the library, it is good practice to add it to this dictionary in addition to correcting the mistake. If codespell erroneously reports a word as misspelled, please add it to - [`codespell-ignore.txt`](https://github.com/UniMath/agda-unimath/blob/master/codespell-ignore.txt). + [`config/codespell-ignore.txt`](https://github.com/UniMath/agda-unimath/blob/master/codespell-ignore.txt). - **Sort codespell dictionary and ignore files**: Sorts and formats the associated codespell dictionary and ignore files. diff --git a/book.toml b/book.toml index 417add9384..70f1ab9b90 100644 --- a/book.toml +++ b/book.toml @@ -19,7 +19,7 @@ static-css = false include-src = false block-delimiter = {left = "$$", right = "$$"} inline-delimiter = {left = "$", right = "$"} -macros = "website/latex-macros.txt" +macros = "config/latex-macros.txt" [preprocessor.catppuccin] assets_version = "1.2.0" # DO NOT EDIT: Managed by `mdbook-catppuccin install` diff --git a/.codespellrc b/config/.codespellrc similarity index 81% rename from .codespellrc rename to config/.codespellrc index 6becede5b0..1cbd52284c 100644 --- a/.codespellrc +++ b/config/.codespellrc @@ -1,6 +1,6 @@ [codespell] skip = *.css,*.bib -ignore-words = codespell-ignore.txt +ignore-words = config/codespell-ignore.txt # Ignore all words with a capital letter after the first character ignore-regex = ```.*?```|\b\S+[A-Z]\S*\b diff --git a/.prettierignore b/config/.prettierignore similarity index 54% rename from .prettierignore rename to config/.prettierignore index 581052d714..16ba0b16ea 100644 --- a/.prettierignore +++ b/config/.prettierignore @@ -1,4 +1,4 @@ book/ book-src/ -website/theme/index.hbs +website/theme/ CITATION.cff diff --git a/.prettierrc.json b/config/.prettierrc.json similarity index 100% rename from .prettierrc.json rename to config/.prettierrc.json diff --git a/codespell-dictionary.txt b/config/codespell-dictionary.txt similarity index 100% rename from codespell-dictionary.txt rename to config/codespell-dictionary.txt diff --git a/codespell-ignore.txt b/config/codespell-ignore.txt similarity index 100% rename from codespell-ignore.txt rename to config/codespell-ignore.txt diff --git a/website/latex-macros.txt b/config/latex-macros.txt similarity index 100% rename from website/latex-macros.txt rename to config/latex-macros.txt diff --git a/docs/CODINGSTYLE.md b/docs/CODINGSTYLE.md index b753b16f31..e71c06428a 100644 --- a/docs/CODINGSTYLE.md +++ b/docs/CODINGSTYLE.md @@ -212,6 +212,7 @@ module _ (I : radical-ideal-Commutative-Ring l2 A) {U : UU l3} (J : U → radical-ideal-Commutative-Ring l4 A) where +``` ```` The use of descriptive section headers, coupled with comprehensive markdown diff --git a/docs/FILE-CONVENTIONS.md b/docs/FILE-CONVENTIONS.md index 34867ad979..9e291aea7d 100644 --- a/docs/FILE-CONVENTIONS.md +++ b/docs/FILE-CONVENTIONS.md @@ -160,7 +160,7 @@ contents of the file. `[The univalence axiom](foundation.univalence.md)`, which will be displayed as [The univalence axiom](foundation.univalence.md). - You can reference another module by module name using - `` [`foundation.univalence`](foundation.univalence.md) ``, which will be + ``[`foundation.univalence`](foundation.univalence.md)``, which will be displayed as [`foundation.univalence`](foundation.univalence.md). - If you just want to add a clickable link, use the pattern ``. This will be displayed as From a4e8ebcfac438967311b84957a9c086f3d5a2119 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 27 Aug 2025 17:41:19 +0200 Subject: [PATCH 19/97] move `book-src` to `book/src` --- .gitignore | 1 - Makefile | 11 ++++++----- book.toml | 4 ++-- config/.prettierignore | 1 - scripts/generate_contributors.py | 2 +- scripts/generate_maintainers.py | 2 +- scripts/generate_mdbook_summary.py | 2 +- website/theme/pagetoc.js | 8 ++++---- 8 files changed, 15 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 01f4ce7698..97eaa7a1d8 100644 --- a/.gitignore +++ b/.gitignore @@ -420,7 +420,6 @@ node_modules/* package-lock.json # mdbook, automatically generated files -book-src/ html/ book/ temp/ diff --git a/Makefile b/Makefile index 0ec399b690..92c1c3a25d 100644 --- a/Makefile +++ b/Makefile @@ -7,10 +7,11 @@ WEBSITE_CSS := $(WEBSITE_DIR)/css WEBSITE_IMAGES := $(WEBSITE_DIR)/images WEBSITE_JS := $(WEBSITE_DIR)/js WEBSITE_THEME := website/theme + +# MDBOOK directory +MDBOOK_DIR := book # MDBOOK input, corresponds to the `src` variable in `book.toml` -MDBOOK_SRC := book-src -# MDBOOK build directory -MDBOOK_BUILD := book +MDBOOK_SRC := $(MDBOOK_DIR)/src # Base directory where Agda interface files are stored AGDA_BUILD := _build # Agda profiling directory @@ -174,7 +175,7 @@ website: website-prepare .PHONY: serve-website serve-website: website-prepare @MDBOOK_PREPROCESSOR__CONCEPTS__SKIP_AGDA=$(SKIPAGDA) \ - mdbook serve -p 8080 --open -d ./$(MDBOOK_BUILD)/html + mdbook serve -p 8080 --open -d ./$(MDBOOK_DIR)/html $(MDBOOK_SRC)/dependency.dot : ./$(SOURCE_DIR)/everything.lagda.md ${AGDAFILES} ${AGDA} ${AGDAHTMLFLAGS} --dependency-graph=$@ $< @@ -184,7 +185,7 @@ graph: $(MDBOOK_SRC)/dependency.dot .PHONY: clean clean: - @rm -Rf ./$(AGDA_BUILD)/ ./$(MDBOOK_BUILD)/ ./$(MDBOOK_SRC)/ ./$(AGDA_PROFILING_TEMP)/ + @rm -Rf ./$(MDBOOK_DIR)/ ./$(AGDA_BUILD)/ ./$(AGDA_PROFILING_TEMP)/ .PHONY: pre-commit pre-commit: diff --git a/book.toml b/book.toml index 70f1ab9b90..937de04469 100644 --- a/book.toml +++ b/book.toml @@ -1,7 +1,7 @@ [book] language = "en" multilingual = false -src = "book-src" +src = "book/src" title = "agda-unimath" [build] @@ -49,7 +49,7 @@ suppress_processing = [ [preprocessor.concepts] command = "python3 ./scripts/preprocessor_concepts.py" -output-file = "book-src/concept_index.json" +output-file = "book/src/concept_index.json" mathswitch-template = "https://mathswitch.xyz/concept/Wd/{wikidata_id}" wikidata-template = "https://www.wikidata.org/entity/{wikidata_id}" skip-agda = false diff --git a/config/.prettierignore b/config/.prettierignore index 16ba0b16ea..c976df16fe 100644 --- a/config/.prettierignore +++ b/config/.prettierignore @@ -1,4 +1,3 @@ book/ -book-src/ website/theme/ CITATION.cff diff --git a/scripts/generate_contributors.py b/scripts/generate_contributors.py index 6ef79d7a90..af9cff1545 100644 --- a/scripts/generate_contributors.py +++ b/scripts/generate_contributors.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # Run this script: -# $ ./scripts/generate_contributors.py CONTRIBUTORS.toml book-src/CONTRIBUTORS.md +# $ ./scripts/generate_contributors.py CONTRIBUTORS.toml book/src/CONTRIBUTORS.md import subprocess import argparse diff --git a/scripts/generate_maintainers.py b/scripts/generate_maintainers.py index 9128cfca08..86199ac49a 100644 --- a/scripts/generate_maintainers.py +++ b/scripts/generate_maintainers.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # Run this script: -# $ ./scripts/generate_maintainers.py CONTRIBUTORS.toml book-src/MAINTAINERS.md +# $ ./scripts/generate_maintainers.py CONTRIBUTORS.toml book/src/MAINTAINERS.md import argparse import os diff --git a/scripts/generate_mdbook_summary.py b/scripts/generate_mdbook_summary.py index 2b61014a1a..5c770d4bc8 100755 --- a/scripts/generate_mdbook_summary.py +++ b/scripts/generate_mdbook_summary.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # Run this script: -# $ ./scripts/generate_mdbook_summary.py book-src/SUMMARY.md +# $ ./scripts/generate_mdbook_summary.py book/src/SUMMARY.md import argparse import sys diff --git a/website/theme/pagetoc.js b/website/theme/pagetoc.js index a5517cc8e1..7e6b74cb16 100644 --- a/website/theme/pagetoc.js +++ b/website/theme/pagetoc.js @@ -7,11 +7,11 @@ Array.prototype.forEach.call( document.getElementsByClassName('pagetoc')[0].children, function (el) { el.classList.remove('active'); - } + }, ); el.classList.add('active'); }); - } + }, ); var updateFunction = function () { @@ -27,7 +27,7 @@ var updateFunction = function () { document.getElementsByClassName('pagetoc')[0].children, function (el) { el.classList.remove('active'); - } + }, ); if (!id) return; Array.prototype.forEach.call( @@ -36,7 +36,7 @@ var updateFunction = function () { if (id.href.localeCompare(el.href) == 0) { el.classList.add('active'); } - } + }, ); }; From 1068213c270fb1ffd8377162269de77ba59be763 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 27 Aug 2025 18:26:13 +0200 Subject: [PATCH 20/97] add description and author metadata to `book.toml` --- book.toml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/book.toml b/book.toml index 937de04469..0748b35dd7 100644 --- a/book.toml +++ b/book.toml @@ -1,10 +1,20 @@ [book] +title = "agda-unimath" +description = "A community-driven library of formalized mathematics from a univalent point of view using the dependently typed programming language Agda." +authors = [ + "Egbert Rijke", + "Elisabeth Stenholm", + "Jonathan Prieto-Cubides", + "Fredrik Bakke", + "Vojtěch Štěpančík", + "others" +] language = "en" multilingual = false src = "book/src" -title = "agda-unimath" [build] +build-dir = "book" create-missing = true [preprocessor.index] From e013402a77c79f41e9a577215a22a8a982466fb9 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 27 Aug 2025 18:28:55 +0200 Subject: [PATCH 21/97] remove `.prettierignore` --- .pre-commit-config.yaml | 1 - config/.prettierignore | 3 --- 2 files changed, 4 deletions(-) delete mode 100644 config/.prettierignore diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f8d3c3d33a..e5cbaa0c53 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -133,7 +133,6 @@ repos: - id: prettier name: CSS, JS, YAML and Markdown (no codeblocks) formatting types_or: [css, javascript, yaml, markdown] - args: ['--ignore-path', 'config/.prettierignore'] - repo: https://github.com/FlamingTempura/bibtex-tidy rev: v1.14.0 diff --git a/config/.prettierignore b/config/.prettierignore deleted file mode 100644 index c976df16fe..0000000000 --- a/config/.prettierignore +++ /dev/null @@ -1,3 +0,0 @@ -book/ -website/theme/ -CITATION.cff From 1f2f738003f8888616f76c81a9798c066803e273 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sat, 30 Aug 2025 16:04:55 +0200 Subject: [PATCH 22/97] =?UTF-8?q?Closure=20properties=20of=20=CF=80-finite?= =?UTF-8?q?=20types=20(#1311)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Here's that PR I talked about a while back. --- .vscode/tasks.json | 51 ++- .../generate_dependency_graph_rendering.py | 2 +- .../equality-natural-numbers.lagda.md | 4 +- .../maximum-natural-numbers.lagda.md | 6 +- .../finite-groups.lagda.md | 10 +- .../finite-monoids.lagda.md | 10 +- .../finite-semigroups.lagda.md | 10 +- .../iterating-functions.lagda.md | 33 -- src/foundation.lagda.md | 6 + src/foundation/connected-maps.lagda.md | 55 +-- .../equality-truncation-levels.lagda.md | 165 +++++++ .../finitely-truncated-types.lagda.md | 359 +++++++++++++++ .../inequality-truncation-levels.lagda.md | 275 +++++++++++ ...ated-successors-truncation-levels.lagda.md | 127 ++++++ src/foundation/iterating-functions.lagda.md | 34 ++ .../maximum-truncation-levels.lagda.md | 173 +++++++ src/foundation/path-cosplit-maps.lagda.md | 5 +- src/foundation/surjective-maps.lagda.md | 2 - ...ncated-addition-truncation-levels.lagda.md | 222 +++++++++ src/foundation/truncated-types.lagda.md | 6 +- src/foundation/truncation-levels.lagda.md | 84 +--- src/univalent-combinatorics.lagda.md | 1 + .../finitely-enumerable-types.lagda.md | 4 + .../main-classes-of-latin-hypercubes.lagda.md | 10 +- .../main-classes-of-latin-squares.lagda.md | 10 +- .../pi-finite-types.lagda.md | 298 +++++++++--- .../truncated-pi-finite-types.lagda.md | 430 ++++++++++++++++++ .../unbounded-pi-finite-types.lagda.md | 113 +++-- .../untruncated-pi-finite-types.lagda.md | 167 ++++--- 29 files changed, 2306 insertions(+), 366 deletions(-) create mode 100644 src/foundation/equality-truncation-levels.lagda.md create mode 100644 src/foundation/finitely-truncated-types.lagda.md create mode 100644 src/foundation/inequality-truncation-levels.lagda.md create mode 100644 src/foundation/iterated-successors-truncation-levels.lagda.md create mode 100644 src/foundation/maximum-truncation-levels.lagda.md create mode 100644 src/foundation/truncated-addition-truncation-levels.lagda.md create mode 100644 src/univalent-combinatorics/truncated-pi-finite-types.lagda.md diff --git a/.vscode/tasks.json b/.vscode/tasks.json index bb7bf51a9e..ac3e2254a1 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -2,24 +2,56 @@ "version": "2.0.0", "tasks": [ { - "label": "check", - "detail": "Typecheck the entire library.", + "label": "quality-test", + "detail": "Run GitHub tests", + "problemMatcher": [], + "group": { + "kind": "test", + "isDefault": true + }, + "dependsOn": ["pre-commit", "link-check", "typecheck"], + "dependsOrder": "parallel" + }, + { + "label": "typecheck", + "detail": "Typecheck the library", "type": "shell", "command": "make", "args": ["check"], "problemMatcher": [], - "group": "build" + "group": { "kind": "build" }, + "dependsOn": "pre-commit", + "presentation": { + "panel": "dedicated", + "clear": true + } }, { "label": "pre-commit", - "detail": "Quality assurance for the library.", + "detail": "Check and fix code conventions", + "type": "shell", + "command": "pre-commit", + "args": ["run", "--all-files"], + "problemMatcher": [], + "hide": true, + "presentation": { + "panel": "dedicated", + "clear": true + } + }, + { + "label": "link-check", + "detail": "Check website links and bibtex references", "type": "shell", "command": "make", - "args": ["pre-commit"], + "args": ["SKIPAGDA=1", "website"], "problemMatcher": [], "group": { - "kind": "build", - "isDefault": true + "kind": "test" + }, + "presentation": { + "panel": "dedicated", + "clear": true } }, { @@ -48,10 +80,11 @@ "args": ["${workspaceFolder}/scripts/demote_foundation_imports.py"], "problemMatcher": [], "dependsOn": ["remove-unused-imports", "demote-foundation-imports"], - "dependsOrder": "sequence" + "dependsOrder": "sequence", + "hide": true }, { - "label": "remove-unused-imports-current-file", + "label": "unused-imports-here", "detail": "Remove unused imports in current file", "type": "shell", "command": "${workspaceFolder}/scripts/remove_unused_imports.py", diff --git a/scripts/generate_dependency_graph_rendering.py b/scripts/generate_dependency_graph_rendering.py index 09238a364e..3816fdae21 100644 --- a/scripts/generate_dependency_graph_rendering.py +++ b/scripts/generate_dependency_graph_rendering.py @@ -148,7 +148,7 @@ def render_graph(graph, file_sizes, output_file, format, repo): """Render the dependency graph using Graphviz.""" # Fetch GitHub labels and colors label_colors = fetch_github_labels(repo) - eprint("Label colors:", label_colors) + # eprint("Label colors:", label_colors) dot = graphviz.Digraph(engine="sfdp", format=format) dot.attr(splines="false", overlap="prism10000", bgcolor="#FFFFFF00", K="0.3", repulsiveforce="0.3") #sfdp diff --git a/src/elementary-number-theory/equality-natural-numbers.lagda.md b/src/elementary-number-theory/equality-natural-numbers.lagda.md index 1c5fb74ff5..78bff66b5f 100644 --- a/src/elementary-number-theory/equality-natural-numbers.lagda.md +++ b/src/elementary-number-theory/equality-natural-numbers.lagda.md @@ -161,8 +161,8 @@ is-torsorial-Eq-ℕ : (m : ℕ) → is-torsorial (Eq-ℕ m) pr1 (pr1 (is-torsorial-Eq-ℕ m)) = m pr2 (pr1 (is-torsorial-Eq-ℕ m)) = refl-Eq-ℕ m -pr2 (is-torsorial-Eq-ℕ zero-ℕ) (pair zero-ℕ star) = refl -pr2 (is-torsorial-Eq-ℕ (succ-ℕ m)) (pair (succ-ℕ n) e) = +pr2 (is-torsorial-Eq-ℕ zero-ℕ) (zero-ℕ , _) = refl +pr2 (is-torsorial-Eq-ℕ (succ-ℕ m)) (succ-ℕ n , e) = ap (map-total-Eq-ℕ m) (pr2 (is-torsorial-Eq-ℕ m) (pair n e)) is-equiv-Eq-eq-ℕ : diff --git a/src/elementary-number-theory/maximum-natural-numbers.lagda.md b/src/elementary-number-theory/maximum-natural-numbers.lagda.md index d656c4912f..95dee8dced 100644 --- a/src/elementary-number-theory/maximum-natural-numbers.lagda.md +++ b/src/elementary-number-theory/maximum-natural-numbers.lagda.md @@ -40,11 +40,11 @@ max-ℕ 0 n = n max-ℕ (succ-ℕ m) 0 = succ-ℕ m max-ℕ (succ-ℕ m) (succ-ℕ n) = succ-ℕ (max-ℕ m n) -ap-max-ℕ : {x x' y y' : ℕ} → x = x' → y = y' → max-ℕ x y = max-ℕ x' y' -ap-max-ℕ p = ap-binary max-ℕ p - max-ℕ' : ℕ → (ℕ → ℕ) max-ℕ' x y = max-ℕ y x + +ap-max-ℕ : {x x' y y' : ℕ} → x = x' → y = y' → max-ℕ x y = max-ℕ x' y' +ap-max-ℕ p q = ap-binary max-ℕ p q ``` ### Maximum of elements of standard finite types diff --git a/src/finite-group-theory/finite-groups.lagda.md b/src/finite-group-theory/finite-groups.lagda.md index b52469f559..c83e518a69 100644 --- a/src/finite-group-theory/finite-groups.lagda.md +++ b/src/finite-group-theory/finite-groups.lagda.md @@ -51,8 +51,8 @@ open import univalent-combinatorics.equality-finite-types open import univalent-combinatorics.finite-types open import univalent-combinatorics.finitely-many-connected-components open import univalent-combinatorics.function-types -open import univalent-combinatorics.pi-finite-types open import univalent-combinatorics.standard-finite-types +open import univalent-combinatorics.truncated-pi-finite-types open import univalent-combinatorics.untruncated-pi-finite-types ``` @@ -424,10 +424,10 @@ is-untruncated-π-finite-Group-of-Order {l} k n = is-untruncated-π-finite-is-finite k ( is-finite-is-group-Semigroup n X))) -is-π-finite-Group-of-Order : - {l : Level} (n : ℕ) → is-π-finite 1 (Group-of-Order l n) -is-π-finite-Group-of-Order n = - is-π-finite-is-untruncated-π-finite 1 +is-truncated-π-finite-Group-of-Order : + {l : Level} (n : ℕ) → is-truncated-π-finite 1 (Group-of-Order l n) +is-truncated-π-finite-Group-of-Order n = + is-truncated-π-finite-is-untruncated-π-finite 1 ( is-1-type-Group-of-Order n) ( is-untruncated-π-finite-Group-of-Order 1 n) ``` diff --git a/src/finite-group-theory/finite-monoids.lagda.md b/src/finite-group-theory/finite-monoids.lagda.md index 36b3f1e29b..c8d3d11225 100644 --- a/src/finite-group-theory/finite-monoids.lagda.md +++ b/src/finite-group-theory/finite-monoids.lagda.md @@ -38,8 +38,8 @@ open import univalent-combinatorics.dependent-pair-types open import univalent-combinatorics.equality-finite-types open import univalent-combinatorics.finite-types open import univalent-combinatorics.finitely-many-connected-components -open import univalent-combinatorics.pi-finite-types open import univalent-combinatorics.standard-finite-types +open import univalent-combinatorics.truncated-pi-finite-types open import univalent-combinatorics.untruncated-pi-finite-types ``` @@ -217,10 +217,10 @@ is-untruncated-π-finite-Monoid-of-Order {l} k n = is-untruncated-π-finite-is-finite k ( is-finite-is-unital-Semigroup n X))) -is-π-finite-Monoid-of-Order : - {l : Level} (n : ℕ) → is-π-finite 1 (Monoid-of-Order l n) -is-π-finite-Monoid-of-Order n = - is-π-finite-is-untruncated-π-finite 1 +is-truncated-π-finite-Monoid-of-Order : + {l : Level} (n : ℕ) → is-truncated-π-finite 1 (Monoid-of-Order l n) +is-truncated-π-finite-Monoid-of-Order n = + is-truncated-π-finite-is-untruncated-π-finite 1 ( is-1-type-Monoid-of-Order n) ( is-untruncated-π-finite-Monoid-of-Order 1 n) ``` diff --git a/src/finite-group-theory/finite-semigroups.lagda.md b/src/finite-group-theory/finite-semigroups.lagda.md index 80e46d4e23..8359a8f8f2 100644 --- a/src/finite-group-theory/finite-semigroups.lagda.md +++ b/src/finite-group-theory/finite-semigroups.lagda.md @@ -32,8 +32,8 @@ open import univalent-combinatorics.equality-finite-types open import univalent-combinatorics.finite-types open import univalent-combinatorics.finitely-many-connected-components open import univalent-combinatorics.function-types -open import univalent-combinatorics.pi-finite-types open import univalent-combinatorics.standard-finite-types +open import univalent-combinatorics.truncated-pi-finite-types open import univalent-combinatorics.untruncated-pi-finite-types ``` @@ -205,10 +205,10 @@ is-untruncated-π-finite-Semigroup-of-Order k n = ( compute-Semigroup-of-Order n) ( is-untruncated-π-finite-Semigroup-of-Order' k n) -is-π-finite-Semigroup-of-Order : - {l : Level} (n : ℕ) → is-π-finite 1 (Semigroup-of-Order l n) -is-π-finite-Semigroup-of-Order {l} n = - is-π-finite-is-untruncated-π-finite 1 +is-truncated-π-finite-Semigroup-of-Order : + {l : Level} (n : ℕ) → is-truncated-π-finite 1 (Semigroup-of-Order l n) +is-truncated-π-finite-Semigroup-of-Order {l} n = + is-truncated-π-finite-is-untruncated-π-finite 1 ( is-1-type-Semigroup-of-Order n) ( is-untruncated-π-finite-Semigroup-of-Order 1 n) ``` diff --git a/src/foundation-core/iterating-functions.lagda.md b/src/foundation-core/iterating-functions.lagda.md index e17b549215..f6d8aefcf0 100644 --- a/src/foundation-core/iterating-functions.lagda.md +++ b/src/foundation-core/iterating-functions.lagda.md @@ -10,7 +10,6 @@ module foundation-core.iterating-functions where open import elementary-number-theory.natural-numbers open import foundation.action-on-identifications-functions -open import foundation.subtypes open import foundation.universe-levels open import foundation-core.commuting-squares-of-maps @@ -89,35 +88,3 @@ module _ reassociate-iterate (succ-ℕ k) f x = reassociate-iterate-succ-ℕ k f x ∙ reassociate-iterate k f (f x) ``` - -### If `f : X → X` satisfies a property of endofunctions on `X`, and the property is closed under composition then iterates of `f` satisfy the property - -```agda -module _ - {l1 l2 : Level} {X : UU l1} {f : X → X} - (P : subtype l2 (X → X)) - where - - is-in-subtype-iterate-succ-ℕ : - (F : is-in-subtype P f) → - ( (h g : X → X) → - is-in-subtype P h → - is-in-subtype P g → - is-in-subtype P (h ∘ g)) → - (n : ℕ) → is-in-subtype P (iterate (succ-ℕ n) f) - is-in-subtype-iterate-succ-ℕ F H zero-ℕ = F - is-in-subtype-iterate-succ-ℕ F H (succ-ℕ n) = - H f (iterate (succ-ℕ n) f) F (is-in-subtype-iterate-succ-ℕ F H n) - - is-in-subtype-iterate : - (I : is-in-subtype P (id {A = X})) → - (F : is-in-subtype P f) → - ( (h g : X → X) → - is-in-subtype P h → - is-in-subtype P g → - is-in-subtype P (h ∘ g)) → - (n : ℕ) → is-in-subtype P (iterate n f) - is-in-subtype-iterate I F H zero-ℕ = I - is-in-subtype-iterate I F H (succ-ℕ n) = - H f (iterate n f) F (is-in-subtype-iterate I F H n) -``` diff --git a/src/foundation.lagda.md b/src/foundation.lagda.md index 436d5f2674..7bb7da9770 100644 --- a/src/foundation.lagda.md +++ b/src/foundation.lagda.md @@ -168,6 +168,7 @@ open import foundation.equality-coproduct-types public open import foundation.equality-dependent-function-types public open import foundation.equality-dependent-pair-types public open import foundation.equality-fibers-of-maps public +open import foundation.equality-truncation-levels public open import foundation.equivalence-classes public open import foundation.equivalence-extensionality public open import foundation.equivalence-induction public @@ -203,6 +204,7 @@ open import foundation.fibers-of-maps public open import foundation.finite-sequences-set-quotients public open import foundation.finitely-coherent-equivalences public open import foundation.finitely-coherently-invertible-maps public +open import foundation.finitely-truncated-types public open import foundation.fixed-points-endofunctions public open import foundation.freely-generated-equivalence-relations public open import foundation.full-subtypes public @@ -251,6 +253,7 @@ open import foundation.impredicative-encodings public open import foundation.impredicative-universes public open import foundation.induction-principle-propositional-truncation public open import foundation.inequality-booleans public +open import foundation.inequality-truncation-levels public open import foundation.infinitely-coherent-equivalences public open import foundation.infinity-connected-maps public open import foundation.infinity-connected-types public @@ -269,6 +272,7 @@ open import foundation.isomorphisms-of-sets public open import foundation.iterated-cartesian-product-types public open import foundation.iterated-dependent-pair-types public open import foundation.iterated-dependent-product-types public +open import foundation.iterated-successors-truncation-levels public open import foundation.iterating-automorphisms public open import foundation.iterating-families-of-maps public open import foundation.iterating-functions public @@ -292,6 +296,7 @@ open import foundation.logical-equivalences public open import foundation.logical-operations-booleans public open import foundation.maps-in-global-subuniverses public open import foundation.maps-in-subuniverses public +open import foundation.maximum-truncation-levels public open import foundation.maybe public open import foundation.mere-embeddings public open import foundation.mere-equality public @@ -453,6 +458,7 @@ open import foundation.transposition-identifications-along-sections public open import foundation.transposition-span-diagrams public open import foundation.trivial-relaxed-sigma-decompositions public open import foundation.trivial-sigma-decompositions public +open import foundation.truncated-addition-truncation-levels public open import foundation.truncated-equality public open import foundation.truncated-maps public open import foundation.truncated-types public diff --git a/src/foundation/connected-maps.lagda.md b/src/foundation/connected-maps.lagda.md index be43b567a7..414edbd171 100644 --- a/src/foundation/connected-maps.lagda.md +++ b/src/foundation/connected-maps.lagda.md @@ -12,6 +12,7 @@ open import foundation.dependent-pair-types open import foundation.function-extensionality open import foundation.fundamental-theorem-of-identity-types open import foundation.homotopy-induction +open import foundation.iterated-successors-truncation-levels open import foundation.precomposition-dependent-functions open import foundation.structure-identity-principle open import foundation.subtype-identity-principle @@ -432,38 +433,38 @@ module _ dependent-universal-property-trunc ``` -### A map `f : A → B` is `k`-connected if and only if precomposing dependent functions into `k + n`-truncated types is an `n-2`-truncated map for all `n : ℕ` +### A map `f : A → B` is `k`-connected if and only if precomposing dependent functions into `k+n`-truncated types is an `n-2`-truncated map for all `n : ℕ` ```agda -is-trunc-map-precomp-Π-is-connected-map : - {l1 l2 l3 : Level} (k l n : 𝕋) → k +𝕋 (succ-𝕋 (succ-𝕋 n)) = l → - {A : UU l1} {B : UU l2} {f : A → B} → is-connected-map k f → - (P : B → Truncated-Type l3 l) → - is-trunc-map - ( n) - ( precomp-Π f (λ b → type-Truncated-Type (P b))) -is-trunc-map-precomp-Π-is-connected-map - {l1} {l2} {l3} k ._ neg-two-𝕋 refl {A} {B} H P = - is-contr-map-is-equiv - ( dependent-universal-property-is-connected-map k H - ( λ b → - pair - ( type-Truncated-Type (P b)) - ( is-trunc-eq - ( right-unit-law-add-𝕋 k) - ( is-trunc-type-Truncated-Type (P b))))) -is-trunc-map-precomp-Π-is-connected-map k ._ (succ-𝕋 n) refl {A} {B} {f} H P = - is-trunc-map-succ-precomp-Π - ( λ g h → - is-trunc-map-precomp-Π-is-connected-map k _ n refl H +abstract + is-trunc-map-precomp-Π-is-connected-map : + {l1 l2 l3 : Level} (k n : 𝕋) → + {A : UU l1} {B : UU l2} {f : A → B} → is-connected-map k f → + (P : B → Truncated-Type l3 (add+2-𝕋 n k)) → + is-trunc-map + ( n) + ( precomp-Π f (λ b → type-Truncated-Type (P b))) + is-trunc-map-precomp-Π-is-connected-map k neg-two-𝕋 H P = + is-contr-map-is-equiv + ( dependent-universal-property-is-connected-map k H ( λ b → pair - ( eq-value g h b) + ( type-Truncated-Type (P b)) ( is-trunc-eq - ( right-successor-law-add-𝕋 k n) - ( is-trunc-type-Truncated-Type (P b)) - ( g b) - ( h b)))) + ( left-unit-law-add+2-𝕋 k) + ( is-trunc-type-Truncated-Type (P b))))) + is-trunc-map-precomp-Π-is-connected-map k (succ-𝕋 n) H P = + is-trunc-map-succ-precomp-Π + ( λ g h → + is-trunc-map-precomp-Π-is-connected-map k n H + ( λ b → + pair + ( eq-value g h b) + ( is-trunc-eq + ( left-successor-law-add+2-𝕋 k n) + ( is-trunc-type-Truncated-Type (P b)) + ( g b) + ( h b)))) ``` ### Characterization of the identity type of `Connected-Map l2 k A` diff --git a/src/foundation/equality-truncation-levels.lagda.md b/src/foundation/equality-truncation-levels.lagda.md new file mode 100644 index 0000000000..6441bb1011 --- /dev/null +++ b/src/foundation/equality-truncation-levels.lagda.md @@ -0,0 +1,165 @@ +# Equality of truncation levels + +```agda +module foundation.equality-truncation-levels where +``` + +
Imports + +```agda +open import foundation.action-on-identifications-functions +open import foundation.decidable-equality +open import foundation.decidable-types +open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.function-types +open import foundation.fundamental-theorem-of-identity-types +open import foundation.identity-types +open import foundation.propositions +open import foundation.truncation-levels +open import foundation.unit-type +open import foundation.universe-levels + +open import foundation-core.coproduct-types +open import foundation-core.decidable-propositions +open import foundation-core.discrete-types +open import foundation-core.empty-types +open import foundation-core.sets +open import foundation-core.torsorial-type-families +``` + +
+ +## Idea + +The [type of truncation levels](foundation-core.truncation-levels.md) `𝕋` has +[decidable equality](foundation.decidable-equality.md). + +## Definitions + +### Observational equality on truncation levels + +```agda +Eq-𝕋 : 𝕋 → 𝕋 → UU lzero +Eq-𝕋 neg-two-𝕋 neg-two-𝕋 = unit +Eq-𝕋 neg-two-𝕋 (succ-𝕋 r) = empty +Eq-𝕋 (succ-𝕋 k) neg-two-𝕋 = empty +Eq-𝕋 (succ-𝕋 k) (succ-𝕋 r) = Eq-𝕋 k r +``` + +## Properties + +### The type of truncation levels is a set + +```agda +abstract + is-prop-Eq-𝕋 : + (n m : 𝕋) → is-prop (Eq-𝕋 n m) + is-prop-Eq-𝕋 neg-two-𝕋 neg-two-𝕋 = is-prop-unit + is-prop-Eq-𝕋 neg-two-𝕋 (succ-𝕋 m) = is-prop-empty + is-prop-Eq-𝕋 (succ-𝕋 n) neg-two-𝕋 = is-prop-empty + is-prop-Eq-𝕋 (succ-𝕋 n) (succ-𝕋 m) = is-prop-Eq-𝕋 n m + +refl-Eq-𝕋 : (n : 𝕋) → Eq-𝕋 n n +refl-Eq-𝕋 neg-two-𝕋 = star +refl-Eq-𝕋 (succ-𝕋 n) = refl-Eq-𝕋 n + +Eq-eq-𝕋 : {x y : 𝕋} → x = y → Eq-𝕋 x y +Eq-eq-𝕋 {x} {.x} refl = refl-Eq-𝕋 x + +eq-Eq-𝕋 : (x y : 𝕋) → Eq-𝕋 x y → x = y +eq-Eq-𝕋 neg-two-𝕋 neg-two-𝕋 e = refl +eq-Eq-𝕋 (succ-𝕋 x) (succ-𝕋 y) e = ap succ-𝕋 (eq-Eq-𝕋 x y e) + +abstract + is-set-𝕋 : is-set 𝕋 + is-set-𝕋 = is-set-prop-in-id Eq-𝕋 is-prop-Eq-𝕋 refl-Eq-𝕋 eq-Eq-𝕋 + +𝕋-Set : Set lzero +pr1 𝕋-Set = 𝕋 +pr2 𝕋-Set = is-set-𝕋 +``` + +### The property of being negative two + +```agda +is-neg-two-𝕋 : 𝕋 → UU lzero +is-neg-two-𝕋 = _= neg-two-𝕋 + +is-prop-is-neg-two-𝕋 : (n : 𝕋) → is-prop (is-neg-two-𝕋 n) +is-prop-is-neg-two-𝕋 n = is-set-𝕋 n neg-two-𝕋 + +is-neg-two-𝕋-Prop : 𝕋 → Prop lzero +is-neg-two-𝕋-Prop n = (is-neg-two-𝕋 n , is-prop-is-neg-two-𝕋 n) +``` + +### The property of being negative one + +```agda +is-neg-one-𝕋 : 𝕋 → UU lzero +is-neg-one-𝕋 = _= neg-one-𝕋 + +is-prop-is-neg-one-𝕋 : (n : 𝕋) → is-prop (is-neg-one-𝕋 n) +is-prop-is-neg-one-𝕋 n = is-set-𝕋 n neg-one-𝕋 + +is-neg-one-𝕋-Prop : 𝕋 → Prop lzero +is-neg-one-𝕋-Prop n = (is-neg-one-𝕋 n , is-prop-is-neg-one-𝕋 n) +``` + +### The type of truncation levels has decidable equality + +```agda +is-decidable-Eq-𝕋 : + (m n : 𝕋) → is-decidable (Eq-𝕋 m n) +is-decidable-Eq-𝕋 neg-two-𝕋 neg-two-𝕋 = inl star +is-decidable-Eq-𝕋 neg-two-𝕋 (succ-𝕋 n) = inr id +is-decidable-Eq-𝕋 (succ-𝕋 m) neg-two-𝕋 = inr id +is-decidable-Eq-𝕋 (succ-𝕋 m) (succ-𝕋 n) = is-decidable-Eq-𝕋 m n + +has-decidable-equality-𝕋 : has-decidable-equality 𝕋 +has-decidable-equality-𝕋 x y = + is-decidable-iff (eq-Eq-𝕋 x y) Eq-eq-𝕋 (is-decidable-Eq-𝕋 x y) + +𝕋-Discrete-Type : Discrete-Type lzero +𝕋-Discrete-Type = (𝕋 , has-decidable-equality-𝕋) + +decidable-eq-𝕋 : 𝕋 → 𝕋 → Decidable-Prop lzero +pr1 (decidable-eq-𝕋 m n) = (m = n) +pr1 (pr2 (decidable-eq-𝕋 m n)) = is-set-𝕋 m n +pr2 (pr2 (decidable-eq-𝕋 m n)) = has-decidable-equality-𝕋 m n + +is-decidable-is-neg-two-𝕋 : (n : 𝕋) → is-decidable (is-neg-two-𝕋 n) +is-decidable-is-neg-two-𝕋 n = has-decidable-equality-𝕋 n neg-two-𝕋 + +is-decidable-is-neg-two-𝕋' : (n : 𝕋) → is-decidable (neg-two-𝕋 = n) +is-decidable-is-neg-two-𝕋' n = has-decidable-equality-𝕋 neg-two-𝕋 n + +is-decidable-is-neg-one-𝕋 : (n : 𝕋) → is-decidable (is-neg-one-𝕋 n) +is-decidable-is-neg-one-𝕋 n = has-decidable-equality-𝕋 n neg-one-𝕋 + +is-decidable-is-neg-one-𝕋' : (n : 𝕋) → is-decidable (neg-one-𝕋 = n) +is-decidable-is-neg-one-𝕋' n = has-decidable-equality-𝕋 neg-one-𝕋 n +``` + +## The full characterization of identifications of truncation levels + +```agda +map-total-Eq-𝕋 : (m : 𝕋) → Σ 𝕋 (Eq-𝕋 m) → Σ 𝕋 (Eq-𝕋 (succ-𝕋 m)) +map-total-Eq-𝕋 m (n , e) = (succ-𝕋 n , e) + +opaque + is-torsorial-Eq-𝕋 : (m : 𝕋) → is-torsorial (Eq-𝕋 m) + pr1 (pr1 (is-torsorial-Eq-𝕋 m)) = m + pr2 (pr1 (is-torsorial-Eq-𝕋 m)) = refl-Eq-𝕋 m + pr2 (is-torsorial-Eq-𝕋 neg-two-𝕋) (neg-two-𝕋 , *) = refl + pr2 (is-torsorial-Eq-𝕋 (succ-𝕋 m)) (succ-𝕋 n , e) = + ap (map-total-Eq-𝕋 m) (pr2 (is-torsorial-Eq-𝕋 m) (n , e)) + +abstract + is-equiv-Eq-eq-𝕋 : {m n : 𝕋} → is-equiv (Eq-eq-𝕋 {m} {n}) + is-equiv-Eq-eq-𝕋 {m} {n} = + fundamental-theorem-id (is-torsorial-Eq-𝕋 m) (λ y → Eq-eq-𝕋 {m} {y}) n + +extensionality-𝕋 : {m n : 𝕋} → (m = n) ≃ Eq-𝕋 m n +extensionality-𝕋 = (Eq-eq-𝕋 , is-equiv-Eq-eq-𝕋) +``` diff --git a/src/foundation/finitely-truncated-types.lagda.md b/src/foundation/finitely-truncated-types.lagda.md new file mode 100644 index 0000000000..fa9168fb3a --- /dev/null +++ b/src/foundation/finitely-truncated-types.lagda.md @@ -0,0 +1,359 @@ +# Finitely truncated types + +```agda +module foundation.finitely-truncated-types where +``` + +
Imports + +```agda +open import foundation.action-on-identifications-dependent-functions +open import foundation.action-on-identifications-functions +open import foundation.contractible-types +open import foundation.coproduct-types +open import foundation.dependent-pair-types +open import foundation.equality-cartesian-product-types +open import foundation.equality-coproduct-types +open import foundation.equivalences +open import foundation.existential-quantification +open import foundation.function-extensionality +open import foundation.maximum-truncation-levels +open import foundation.truncated-types +open import foundation.truncation-levels +open import foundation.universe-levels + +open import foundation-core.cartesian-product-types +open import foundation-core.embeddings +open import foundation-core.equality-dependent-pair-types +open import foundation-core.function-types +open import foundation-core.homotopies +open import foundation-core.identity-types +open import foundation-core.propositions +open import foundation-core.retracts-of-types +open import foundation-core.transport-along-identifications + +open import logic.functoriality-existential-quantification +``` + +
+ +## Idea + +A type $A$ is +{{#concept "finitely truncated" Disambiguation="type" Agda=is-finitely-trunc Agda=Finitely-Truncated-Type}} +if there [exists](foundation.existential-quantification.md) some $n$ such that +$A$ is $n$-[truncated](foundation-core.truncated-types.md). + +## Definition + +### The condition of being finitely truncated + +```agda +is-finitely-trunc : {l : Level} → UU l → UU l +is-finitely-trunc A = exists-structure 𝕋 (λ k → is-trunc k A) + +is-prop-is-finitely-trunc : + {l : Level} {A : UU l} → is-prop (is-finitely-trunc A) +is-prop-is-finitely-trunc {A = A} = is-prop-exists 𝕋 (λ k → is-trunc-Prop k A) + +is-finitely-trunc-Prop : {l : Level} → UU l → Prop l +is-finitely-trunc-Prop A = (is-finitely-trunc A , is-prop-is-finitely-trunc) +``` + +### The universe of finitely truncated types + +```agda +Finitely-Truncated-Type : (l : Level) → UU (lsuc l) +Finitely-Truncated-Type l = Σ (UU l) (is-finitely-trunc) + +type-Finitely-Truncated-Type : {l : Level} → Finitely-Truncated-Type l → UU l +type-Finitely-Truncated-Type = pr1 + +is-finitely-trunc-type-Finitely-Truncated-Type : + {l : Level} (A : Finitely-Truncated-Type l) → + is-finitely-trunc (type-Finitely-Truncated-Type A) +is-finitely-trunc-type-Finitely-Truncated-Type = pr2 +``` + +## Properties + +### The identity type of a finitely truncated type is finitely truncated + +```agda +abstract + is-finitely-trunc-Id : + {l : Level} {A : UU l} → + is-finitely-trunc A → (x y : A) → is-finitely-trunc (x = y) + is-finitely-trunc-Id {l} H x y = + map-tot-exists (λ k H' → is-trunc-Id H' x y) H + +Id-Finitely-Truncated-Type : + {l : Level} (A : Finitely-Truncated-Type l) → + (x y : type-Finitely-Truncated-Type A) → Finitely-Truncated-Type l +Id-Finitely-Truncated-Type A x y = + ( x = y , + is-finitely-trunc-Id (is-finitely-trunc-type-Finitely-Truncated-Type A) x y) +``` + +### Finitely truncated types are closed under retracts + +```agda +module _ + {l1 l2 : Level} + where + + is-finitely-trunc-retract-of : + {A : UU l1} {B : UU l2} → + A retract-of B → is-finitely-trunc B → is-finitely-trunc A + is-finitely-trunc-retract-of R = map-tot-exists (λ k → is-trunc-retract-of R) +``` + +### Finitely truncated types are closed under equivalences + +```agda +abstract + is-finitely-trunc-is-equiv : + {l1 l2 : Level} {A : UU l1} (B : UU l2) (f : A → B) → is-equiv f → + is-finitely-trunc B → is-finitely-trunc A + is-finitely-trunc-is-equiv B f is-equiv-f = + is-finitely-trunc-retract-of (retract-equiv (f , is-equiv-f)) + +abstract + is-finitely-trunc-equiv : + {l1 l2 : Level} {A : UU l1} (B : UU l2) (e : A ≃ B) → + is-finitely-trunc B → is-finitely-trunc A + is-finitely-trunc-equiv B (f , is-equiv-f) = + is-finitely-trunc-is-equiv B f is-equiv-f + +abstract + is-finitely-trunc-is-equiv' : + {l1 l2 : Level} (A : UU l1) {B : UU l2} (f : A → B) → + is-equiv f → is-finitely-trunc A → is-finitely-trunc B + is-finitely-trunc-is-equiv' A f is-equiv-f is-finitely-trunc-A = + is-finitely-trunc-is-equiv A + ( map-inv-is-equiv is-equiv-f) + ( is-equiv-map-inv-is-equiv is-equiv-f) + ( is-finitely-trunc-A) + +abstract + is-finitely-trunc-equiv' : + {l1 l2 : Level} (A : UU l1) {B : UU l2} (e : A ≃ B) → + is-finitely-trunc A → is-finitely-trunc B + is-finitely-trunc-equiv' A (f , is-equiv-f) = + is-finitely-trunc-is-equiv' A f is-equiv-f +``` + +### If a type embeds into a finitely truncated type, then it is finitely truncated + +There is a shorter proof that uses the fact that $n$-truncated types are +$n+1$-truncated, but we give a proof using the maximum of operation on +truncation levels in order to maintain stricter bounds on the truncation level. + +```agda +abstract + is-finitely-trunc-is-emb : + {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) → + is-emb f → is-finitely-trunc B → is-finitely-trunc A + is-finitely-trunc-is-emb {A = A} {B} f Ef = + map-exists + ( λ k → is-trunc k A) + ( max-𝕋 neg-one-𝕋) + ( λ where + neg-two-𝕋 H → is-trunc-is-emb neg-two-𝕋 f Ef (is-prop-is-contr H) + (succ-𝕋 k) H → is-trunc-is-emb k f Ef H) + +abstract + is-finitely-trunc-emb : + {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A ↪ B) → + is-finitely-trunc B → is-finitely-trunc A + is-finitely-trunc-emb f = + is-finitely-trunc-is-emb (map-emb f) (is-emb-map-emb f) +``` + +### Finitely truncated types are closed under dependent pair types + +```agda +abstract + is-finitely-trunc-Σ : + {k : 𝕋} {l1 l2 : Level} {A : UU l1} {B : A → UU l2} → + is-finitely-trunc A → ((x : A) → is-trunc k (B x)) → + is-finitely-trunc (Σ A B) + is-finitely-trunc-Σ {k} {A = A} {B} H K = + map-exists + ( λ r → is-trunc r (Σ A B)) + ( max-𝕋 k) + ( λ r H → + is-trunc-Σ + ( is-trunc-right-max-𝕋 r k H) + ( λ x → is-trunc-left-max-𝕋 k r (K x))) + ( H) + +Σ-Finitely-Truncated-Type : + {k : 𝕋} {l1 l2 : Level} (A : Finitely-Truncated-Type l1) + (B : type-Finitely-Truncated-Type A → Truncated-Type l2 k) → + Finitely-Truncated-Type (l1 ⊔ l2) +pr1 (Σ-Finitely-Truncated-Type A B) = + Σ (type-Finitely-Truncated-Type A) (type-Truncated-Type ∘ B) +pr2 (Σ-Finitely-Truncated-Type A B) = + is-finitely-trunc-Σ + ( is-finitely-trunc-type-Finitely-Truncated-Type A) + ( λ a → is-trunc-type-Truncated-Type (B a)) + +fiber-Finitely-Truncated-Type : + {k : 𝕋} {l1 l2 : Level} (A : Finitely-Truncated-Type l1) + (B : Truncated-Type l2 k) + (f : type-Finitely-Truncated-Type A → type-Truncated-Type B) → + type-Truncated-Type B → Finitely-Truncated-Type (l1 ⊔ l2) +fiber-Finitely-Truncated-Type A B f b = + Σ-Finitely-Truncated-Type A (λ a → Id-Truncated-Type' B (f a) b) +``` + +### Finite truncatedness of the base of a finitely truncated dependent sum + +```agda +abstract + is-finitely-trunc-base-is-finitely-trunc-Σ' : + {l1 l2 : Level} {A : UU l1} {B : A → UU l2} → + ((x : A) → B x) → is-finitely-trunc (Σ A B) → is-finitely-trunc A + is-finitely-trunc-base-is-finitely-trunc-Σ' f = + map-tot-exists (λ k → is-trunc-base-is-trunc-Σ' f) +``` + +### Products of finitely truncated types are truncated + +```agda +abstract + is-finitely-trunc-product : + {l1 l2 : Level} {A : UU l1} {B : UU l2} → + is-finitely-trunc A → is-finitely-trunc B → is-finitely-trunc (A × B) + is-finitely-trunc-product {A = A} {B} = + map-binary-exists + ( λ k → is-trunc k (A × B)) + ( max-𝕋) + ( λ k r K R → + is-trunc-product + ( max-𝕋 k r) + ( is-trunc-left-max-𝕋 k r K) + ( is-trunc-right-max-𝕋 r k R)) + +product-Finitely-Truncated-Type : + {l1 l2 : Level} → + Finitely-Truncated-Type l1 → + Finitely-Truncated-Type l2 → + Finitely-Truncated-Type (l1 ⊔ l2) +pr1 (product-Finitely-Truncated-Type A B) = + type-Finitely-Truncated-Type A × type-Finitely-Truncated-Type B +pr2 (product-Finitely-Truncated-Type A B) = + is-finitely-trunc-product + ( is-finitely-trunc-type-Finitely-Truncated-Type A) + ( is-finitely-trunc-type-Finitely-Truncated-Type B) +``` + +### The type of functions into a truncated type is truncated + +```agda +abstract + is-finitely-trunc-function-type : + {l1 l2 : Level} {A : UU l1} {B : UU l2} → + is-finitely-trunc B → is-finitely-trunc (A → B) + is-finitely-trunc-function-type {A} {B} = + map-tot-exists (λ k → is-trunc-function-type k) + +function-type-Finitely-Truncated-Type : + {l1 l2 : Level} (A : UU l1) (B : Finitely-Truncated-Type l2) → + Finitely-Truncated-Type (l1 ⊔ l2) +function-type-Finitely-Truncated-Type A B = + ( ( A → type-Finitely-Truncated-Type B) , + ( is-finitely-trunc-function-type + ( is-finitely-trunc-type-Finitely-Truncated-Type B))) + +type-hom-Finitely-Truncated-Type : + {l1 l2 : Level} (A : Finitely-Truncated-Type l1) + (B : Finitely-Truncated-Type l2) → UU (l1 ⊔ l2) +type-hom-Finitely-Truncated-Type A B = + type-Finitely-Truncated-Type A → type-Finitely-Truncated-Type B + +is-finitely-trunc-type-hom-Finitely-Truncated-Type : + {l1 l2 : Level} (A : Finitely-Truncated-Type l1) + (B : Finitely-Truncated-Type l2) → + is-finitely-trunc (type-hom-Finitely-Truncated-Type A B) +is-finitely-trunc-type-hom-Finitely-Truncated-Type A B = + is-finitely-trunc-function-type + ( is-finitely-trunc-type-Finitely-Truncated-Type B) + +hom-Finitely-Truncated-Type : + {l1 l2 : Level} (A : Finitely-Truncated-Type l1) + (B : Finitely-Truncated-Type l2) → Finitely-Truncated-Type (l1 ⊔ l2) +hom-Finitely-Truncated-Type A B = + ( type-hom-Finitely-Truncated-Type A B , + is-finitely-trunc-type-hom-Finitely-Truncated-Type A B) +``` + +### The coproduct type is finitely truncated + +```agda +abstract + is-finitely-trunc-coproduct : + {l1 l2 : Level} {A : UU l1} {B : UU l2} → + is-finitely-trunc A → is-finitely-trunc B → is-finitely-trunc (A + B) + is-finitely-trunc-coproduct {A = A} {B} = + map-binary-exists + ( λ k → is-trunc k (A + B)) + ( λ k r → succ-𝕋 (succ-𝕋 (k ⊔𝕋 r))) + ( λ k r K R → + is-trunc-coproduct + ( k ⊔𝕋 r) + ( is-trunc-iterated-succ-is-trunc + ( max-𝕋 k r) + ( 2) + ( is-trunc-left-max-𝕋 k r K)) + ( is-trunc-iterated-succ-is-trunc + ( max-𝕋 k r) + ( 2) + ( is-trunc-right-max-𝕋 r k R))) +``` + +Note that the bound on the truncation level in the preceding proof is not +optimal. + +### The type of equivalences between truncated types is truncated + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + where + + is-finitely-trunc-equiv-is-finitely-trunc : + is-finitely-trunc A → is-finitely-trunc B → is-finitely-trunc (A ≃ B) + is-finitely-trunc-equiv-is-finitely-trunc = + map-binary-exists + ( λ k → is-trunc k (A ≃ B)) + ( max-𝕋) + ( λ k r K R → + is-trunc-equiv-is-trunc + ( max-𝕋 k r) + ( is-trunc-left-max-𝕋 k r K) + ( is-trunc-right-max-𝕋 r k R)) + +type-equiv-Finitely-Truncated-Type : + {l1 l2 : Level} → Finitely-Truncated-Type l1 → Finitely-Truncated-Type l2 → + UU (l1 ⊔ l2) +type-equiv-Finitely-Truncated-Type A B = + type-Finitely-Truncated-Type A ≃ type-Finitely-Truncated-Type B + +is-finitely-trunc-type-equiv-Finitely-Truncated-Type : + {l1 l2 : Level} + (A : Finitely-Truncated-Type l1) (B : Finitely-Truncated-Type l2) → + is-finitely-trunc (type-equiv-Finitely-Truncated-Type A B) +is-finitely-trunc-type-equiv-Finitely-Truncated-Type A B = + is-finitely-trunc-equiv-is-finitely-trunc + ( is-finitely-trunc-type-Finitely-Truncated-Type A) + ( is-finitely-trunc-type-Finitely-Truncated-Type B) + +equiv-Finitely-Truncated-Type : + {l1 l2 : Level} → Finitely-Truncated-Type l1 → Finitely-Truncated-Type l2 → + Finitely-Truncated-Type (l1 ⊔ l2) +equiv-Finitely-Truncated-Type A B = + ( type-equiv-Finitely-Truncated-Type A B , + is-finitely-trunc-type-equiv-Finitely-Truncated-Type A B) +``` diff --git a/src/foundation/inequality-truncation-levels.lagda.md b/src/foundation/inequality-truncation-levels.lagda.md new file mode 100644 index 0000000000..ffae8e4bc2 --- /dev/null +++ b/src/foundation/inequality-truncation-levels.lagda.md @@ -0,0 +1,275 @@ +# Inequality of truncation levels + +```agda +module foundation.inequality-truncation-levels where +``` + +
Imports + +```agda +open import foundation.action-on-identifications-functions +open import foundation.binary-relations +open import foundation.cartesian-product-types +open import foundation.coproduct-types +open import foundation.decidable-types +open import foundation.dependent-pair-types +open import foundation.disjunction +open import foundation.empty-types +open import foundation.equality-truncation-levels +open import foundation.function-types +open import foundation.functoriality-coproduct-types +open import foundation.identity-types +open import foundation.negation +open import foundation.propositional-truncations +open import foundation.propositions +open import foundation.truncation-levels +open import foundation.unit-type +open import foundation.universe-levels + +open import order-theory.decidable-posets +open import order-theory.decidable-total-orders +open import order-theory.posets +open import order-theory.preorders +open import order-theory.total-orders +``` + +
+ +## Idea + +The ordering `≤` on [truncation levels](foundation-core.truncation-levels.md) +mirrors the +[ordering on integers](elementary-number-theory.inequality-integers.md) greater +than or equal to `-2`. + +## Definitions + +### Inequality of truncation levels + +```agda +leq-𝕋 : 𝕋 → 𝕋 → UU lzero +leq-𝕋 neg-two-𝕋 m = unit +leq-𝕋 (succ-𝕋 n) neg-two-𝕋 = empty +leq-𝕋 (succ-𝕋 n) (succ-𝕋 m) = leq-𝕋 n m + +infix 30 _≤-𝕋_ +_≤-𝕋_ : 𝕋 → 𝕋 → UU lzero +_≤-𝕋_ = leq-𝕋 +``` + +### Alternative definition of the inequality of truncation levels + +```agda +data leq-𝕋' : 𝕋 → 𝕋 → UU lzero where + refl-leq-𝕋' : (n : 𝕋) → leq-𝕋' n n + propagate-leq-𝕋' : {x y z : 𝕋} → succ-𝕋 y = z → (leq-𝕋' x y) → (leq-𝕋' x z) +``` + +## Properties + +### Inequality of truncation levels is a proposition + +```agda +is-prop-leq-𝕋 : (m n : 𝕋) → is-prop (leq-𝕋 m n) +is-prop-leq-𝕋 neg-two-𝕋 _ = is-prop-unit +is-prop-leq-𝕋 (succ-𝕋 m) neg-two-𝕋 = is-prop-empty +is-prop-leq-𝕋 (succ-𝕋 m) (succ-𝕋 n) = is-prop-leq-𝕋 m n + +leq-𝕋-Prop : 𝕋 → 𝕋 → Prop lzero +leq-𝕋-Prop m n = (leq-𝕋 m n , is-prop-leq-𝕋 m n) +``` + +### Inequality of truncation levels is decidable + +```agda +is-decidable-leq-𝕋 : (m n : 𝕋) → is-decidable (leq-𝕋 m n) +is-decidable-leq-𝕋 neg-two-𝕋 neg-two-𝕋 = inl star +is-decidable-leq-𝕋 neg-two-𝕋 (succ-𝕋 n) = inl star +is-decidable-leq-𝕋 (succ-𝕋 m) neg-two-𝕋 = inr id +is-decidable-leq-𝕋 (succ-𝕋 m) (succ-𝕋 n) = is-decidable-leq-𝕋 m n +``` + +### Inequality of truncation levels is a congruence + +```agda +concatenate-eq-leq-eq-𝕋 : + {x' x y y' : 𝕋} → x' = x → x ≤-𝕋 y → y = y' → x' ≤-𝕋 y' +concatenate-eq-leq-eq-𝕋 refl H refl = H + +concatenate-leq-eq-𝕋 : (m : 𝕋) {n n' : 𝕋} → m ≤-𝕋 n → n = n' → m ≤-𝕋 n' +concatenate-leq-eq-𝕋 m H refl = H + +concatenate-eq-leq-𝕋 : {m m' : 𝕋} (n : 𝕋) → m' = m → m ≤-𝕋 n → m' ≤-𝕋 n +concatenate-eq-leq-𝕋 n refl H = H +``` + +### Inequality of truncation levels is reflexive + +```agda +refl-leq-𝕋 : (n : 𝕋) → n ≤-𝕋 n +refl-leq-𝕋 neg-two-𝕋 = star +refl-leq-𝕋 (succ-𝕋 n) = refl-leq-𝕋 n + +leq-eq-𝕋 : (m n : 𝕋) → m = n → m ≤-𝕋 n +leq-eq-𝕋 m .m refl = refl-leq-𝕋 m +``` + +### Inequality of truncation levels is transitive + +```agda +transitive-leq-𝕋 : is-transitive leq-𝕋 +transitive-leq-𝕋 neg-two-𝕋 m l p q = star +transitive-leq-𝕋 (succ-𝕋 n) (succ-𝕋 m) (succ-𝕋 l) p q = + transitive-leq-𝕋 n m l p q +``` + +### Inequality of truncation levels is antisymmetric + +```agda +antisymmetric-leq-𝕋 : (m n : 𝕋) → m ≤-𝕋 n → n ≤-𝕋 m → m = n +antisymmetric-leq-𝕋 neg-two-𝕋 neg-two-𝕋 p q = refl +antisymmetric-leq-𝕋 (succ-𝕋 m) (succ-𝕋 n) p q = + ap succ-𝕋 (antisymmetric-leq-𝕋 m n p q) +``` + +### For any two truncation levels we can decide which one is less than the other + +```agda +linear-leq-𝕋 : (m n : 𝕋) → (m ≤-𝕋 n) + (n ≤-𝕋 m) +linear-leq-𝕋 neg-two-𝕋 neg-two-𝕋 = inl star +linear-leq-𝕋 neg-two-𝕋 (succ-𝕋 n) = inl star +linear-leq-𝕋 (succ-𝕋 m) neg-two-𝕋 = inr star +linear-leq-𝕋 (succ-𝕋 m) (succ-𝕋 n) = linear-leq-𝕋 m n + +abstract + is-total-leq-𝕋 : (m n : 𝕋) → disjunction-type (m ≤-𝕋 n) (n ≤-𝕋 m) + is-total-leq-𝕋 m n = unit-trunc-Prop (linear-leq-𝕋 m n) +``` + +### For any three truncation levels, there are three cases in how they can be ordered + +```agda +cases-order-three-elements-𝕋 : (x y z : 𝕋) → UU lzero +cases-order-three-elements-𝕋 x y z = + ( ( leq-𝕋 x y × leq-𝕋 y z) + + ( leq-𝕋 x z × leq-𝕋 z y)) + + ( ( ( leq-𝕋 y z × leq-𝕋 z x) + + ( leq-𝕋 y x × leq-𝕋 x z)) + + ( ( leq-𝕋 z x × leq-𝕋 x y) + + (leq-𝕋 z y × leq-𝕋 y x))) + +order-three-elements-𝕋 : (x y z : 𝕋) → cases-order-three-elements-𝕋 x y z +order-three-elements-𝕋 neg-two-𝕋 neg-two-𝕋 neg-two-𝕋 = inl (inl (star , star)) +order-three-elements-𝕋 neg-two-𝕋 neg-two-𝕋 (succ-𝕋 z) = inl (inl (star , star)) +order-three-elements-𝕋 neg-two-𝕋 (succ-𝕋 y) neg-two-𝕋 = inl (inr (star , star)) +order-three-elements-𝕋 neg-two-𝕋 (succ-𝕋 y) (succ-𝕋 z) = + inl (map-coproduct (pair star) (pair star) (linear-leq-𝕋 y z)) +order-three-elements-𝕋 (succ-𝕋 x) neg-two-𝕋 neg-two-𝕋 = + inr (inl (inl (star , star))) +order-three-elements-𝕋 (succ-𝕋 x) neg-two-𝕋 (succ-𝕋 z) = + inr (inl (map-coproduct (pair star) (pair star) (linear-leq-𝕋 z x))) +order-three-elements-𝕋 (succ-𝕋 x) (succ-𝕋 y) neg-two-𝕋 = + inr (inr (map-coproduct (pair star) (pair star) (linear-leq-𝕋 x y))) +order-three-elements-𝕋 (succ-𝕋 x) (succ-𝕋 y) (succ-𝕋 z) = + order-three-elements-𝕋 x y z +``` + +### Zero is less than or equal to any truncation level + +```agda +leq-neg-two-𝕋 : (n : 𝕋) → neg-two-𝕋 ≤-𝕋 n +leq-neg-two-𝕋 n = star +``` + +### Any truncation level less than -2 is -2 + +```agda +is-neg-two-leq-neg-two-𝕋 : (x : 𝕋) → x ≤-𝕋 neg-two-𝕋 → is-neg-two-𝕋 x +is-neg-two-leq-neg-two-𝕋 neg-two-𝕋 star = refl + +is-neg-two-leq-neg-two-𝕋' : (x : 𝕋) → x ≤-𝕋 neg-two-𝕋 → neg-two-𝕋 = x +is-neg-two-leq-neg-two-𝕋' neg-two-𝕋 star = refl +``` + +### Any truncation level is less than or equal to its own successor + +```agda +succ-leq-𝕋 : (n : 𝕋) → n ≤-𝕋 (succ-𝕋 n) +succ-leq-𝕋 neg-two-𝕋 = star +succ-leq-𝕋 (succ-𝕋 n) = succ-leq-𝕋 n +``` + +### Any truncation level less than or equal to `n+1` is either less than or equal to `n` or it is `n+1` + +```agda +decide-leq-succ-𝕋 : + (m n : 𝕋) → m ≤-𝕋 (succ-𝕋 n) → (m ≤-𝕋 n) + (m = succ-𝕋 n) +decide-leq-succ-𝕋 neg-two-𝕋 neg-two-𝕋 l = inl star +decide-leq-succ-𝕋 neg-two-𝕋 (succ-𝕋 n) l = inl star +decide-leq-succ-𝕋 (succ-𝕋 m) neg-two-𝕋 l = + inr (ap succ-𝕋 (is-neg-two-leq-neg-two-𝕋 m l)) +decide-leq-succ-𝕋 (succ-𝕋 m) (succ-𝕋 n) l = + map-coproduct id (ap succ-𝕋) (decide-leq-succ-𝕋 m n l) +``` + +### If `m` is less than `n`, then it is less than `n+1` + +```agda +preserves-leq-succ-𝕋 : (m n : 𝕋) → m ≤-𝕋 n → m ≤-𝕋 (succ-𝕋 n) +preserves-leq-succ-𝕋 m n = transitive-leq-𝕋 m n (succ-𝕋 n) (succ-leq-𝕋 n) +``` + +### The successor of `n` is not less than or equal to `n` + +```agda +neg-succ-leq-𝕋 : (n : 𝕋) → ¬ (leq-𝕋 (succ-𝕋 n) n) +neg-succ-leq-𝕋 neg-two-𝕋 = id +neg-succ-leq-𝕋 (succ-𝕋 n) = neg-succ-leq-𝕋 n +``` + +### If `m ≤ n + 1` then either `m ≤ n` or `m = n + 1` + +```agda +cases-leq-succ-𝕋 : + {m n : 𝕋} → leq-𝕋 m (succ-𝕋 n) → (leq-𝕋 m n) + (m = succ-𝕋 n) +cases-leq-succ-𝕋 {neg-two-𝕋} {n} star = inl star +cases-leq-succ-𝕋 {succ-𝕋 m} {neg-two-𝕋} p = + inr (ap succ-𝕋 (antisymmetric-leq-𝕋 m neg-two-𝕋 p star)) +cases-leq-succ-𝕋 {succ-𝕋 m} {succ-𝕋 n} p = + map-coproduct id (ap succ-𝕋) (cases-leq-succ-𝕋 p) + +cases-leq-succ-reflexive-leq-𝕋 : + {n : 𝕋} → cases-leq-succ-𝕋 {succ-𝕋 n} {n} (refl-leq-𝕋 n) = inr refl +cases-leq-succ-reflexive-leq-𝕋 {neg-two-𝕋} = refl +cases-leq-succ-reflexive-leq-𝕋 {succ-𝕋 n} = + ap (map-coproduct id (ap succ-𝕋)) cases-leq-succ-reflexive-leq-𝕋 +``` + +### `m ≤ n` if and only if `n + 1 ≰ m` + +```agda +contradiction-leq-𝕋 : (m n : 𝕋) → m ≤-𝕋 n → ¬ (succ-𝕋 n ≤-𝕋 m) +contradiction-leq-𝕋 (succ-𝕋 m) (succ-𝕋 n) = contradiction-leq-𝕋 m n + +contradiction-leq-𝕋' : (m n : 𝕋) → (succ-𝕋 n) ≤-𝕋 m → ¬ (m ≤-𝕋 n) +contradiction-leq-𝕋' m n K H = contradiction-leq-𝕋 m n H K +``` + +### The partially ordered set of truncation levels ordered by inequality + +```agda +𝕋-Preorder : Preorder lzero lzero +𝕋-Preorder = (𝕋 , leq-𝕋-Prop , refl-leq-𝕋 , transitive-leq-𝕋) + +𝕋-Poset : Poset lzero lzero +𝕋-Poset = (𝕋-Preorder , antisymmetric-leq-𝕋) + +𝕋-Total-Order : Total-Order lzero lzero +𝕋-Total-Order = (𝕋-Poset , is-total-leq-𝕋) + +𝕋-Decidable-Poset : Decidable-Poset lzero lzero +𝕋-Decidable-Poset = (𝕋-Poset , is-decidable-leq-𝕋) + +𝕋-Decidable-Total-Order : Decidable-Total-Order lzero lzero +𝕋-Decidable-Total-Order = (𝕋-Poset , is-total-leq-𝕋 , is-decidable-leq-𝕋) +``` diff --git a/src/foundation/iterated-successors-truncation-levels.lagda.md b/src/foundation/iterated-successors-truncation-levels.lagda.md new file mode 100644 index 0000000000..279be6afbe --- /dev/null +++ b/src/foundation/iterated-successors-truncation-levels.lagda.md @@ -0,0 +1,127 @@ +# Iterated successors of truncation levels + +```agda +module foundation.iterated-successors-truncation-levels where +``` + +
Imports + +```agda +open import elementary-number-theory.natural-numbers + +open import foundation.action-on-identifications-binary-functions +open import foundation.action-on-identifications-functions + +open import foundation-core.homotopies +open import foundation-core.identity-types +open import foundation-core.iterating-functions +open import foundation-core.truncation-levels +``` + +
+ +## Idea + +We define the family of +{{#concept "iterated successor functions" Disambiguation="on truncation levels" Agda=iterate-succ-𝕋}} +on [truncation levels](foundation-core.truncation-levels.md). + +## Definitions + +### The iterated successor on truncation levels + +```agda +iterate-succ-𝕋 : ℕ → 𝕋 → 𝕋 +iterate-succ-𝕋 n x = iterate' n succ-𝕋 x + +iterate-succ-𝕋' : 𝕋 → ℕ → 𝕋 +iterate-succ-𝕋' x n = iterate-succ-𝕋 n x +``` + +### The double successor of addition on truncation levels + +```agda +add+2-𝕋 : 𝕋 → 𝕋 → 𝕋 +add+2-𝕋 x neg-two-𝕋 = x +add+2-𝕋 x (succ-𝕋 y) = succ-𝕋 (add+2-𝕋 x y) +``` + +### The binary action of truncated addition on identifications + +```agda +ap-binary-add+2-𝕋 : + {m n m' n' : 𝕋} → m = m' → n = n' → add+2-𝕋 m n = add+2-𝕋 m' n' +ap-binary-add+2-𝕋 p = ap-binary add+2-𝕋 p +``` + +## Properties + +### The two definitions of the iterated successor agree + +```agda +reassociate-iterate-succ-𝕋 : + (n : ℕ) (k : 𝕋) → iterate-succ-𝕋 (succ-ℕ n) k = succ-𝕋 (iterate-succ-𝕋 n k) +reassociate-iterate-succ-𝕋 zero-ℕ k = refl +reassociate-iterate-succ-𝕋 (succ-ℕ n) k = + reassociate-iterate-succ-𝕋 n (succ-𝕋 k) + +compute-iterate-succ-𝕋 : (n : ℕ) → iterate n succ-𝕋 ~ iterate-succ-𝕋 n +compute-iterate-succ-𝕋 n = reassociate-iterate n succ-𝕋 +``` + +### Unit laws for addition of truncation levels + +```agda +left-unit-law-add+2-𝕋 : (k : 𝕋) → add+2-𝕋 neg-two-𝕋 k = k +left-unit-law-add+2-𝕋 neg-two-𝕋 = refl +left-unit-law-add+2-𝕋 (succ-𝕋 k) = + ap succ-𝕋 (left-unit-law-add+2-𝕋 k) + +right-unit-law-add+2-𝕋 : (k : 𝕋) → add+2-𝕋 k neg-two-𝕋 = k +right-unit-law-add+2-𝕋 neg-two-𝕋 = refl +right-unit-law-add+2-𝕋 (succ-𝕋 k) = refl +``` + +### Successor laws for the double successor of addition of truncation levels + +```agda +right-successor-law-add+2-𝕋 : + (n k : 𝕋) → add+2-𝕋 k (succ-𝕋 n) = succ-𝕋 (add+2-𝕋 k n) +right-successor-law-add+2-𝕋 n k = refl + +left-successor-law-add+2-𝕋 : + (n k : 𝕋) → add+2-𝕋 (succ-𝕋 k) n = succ-𝕋 (add+2-𝕋 k n) +left-successor-law-add+2-𝕋 neg-two-𝕋 n = + refl +left-successor-law-add+2-𝕋 (succ-𝕋 k) n = + ap succ-𝕋 (left-successor-law-add+2-𝕋 k n) +``` + +### The balancing law of the successor function over addition + +```agda +balance-succ-add+2-𝕋 : (k r : 𝕋) → add+2-𝕋 (succ-𝕋 k) r = add+2-𝕋 k (succ-𝕋 r) +balance-succ-add+2-𝕋 k neg-two-𝕋 = refl +balance-succ-add+2-𝕋 k (succ-𝕋 r) = ap succ-𝕋 (balance-succ-add+2-𝕋 k r) + +abstract + balance-iterated-succ-add+2-𝕋 : + (n : ℕ) (k r : 𝕋) → + add+2-𝕋 (iterate-succ-𝕋 n k) r = add+2-𝕋 k (iterate-succ-𝕋 n r) + balance-iterated-succ-add+2-𝕋 zero-ℕ k r = refl + balance-iterated-succ-add+2-𝕋 (succ-ℕ n) k r = + ( balance-iterated-succ-add+2-𝕋 n (succ-𝕋 k) r) ∙ + ( balance-succ-add+2-𝕋 k (iterate-succ-𝕋 n r)) ∙ + ( ap (add+2-𝕋 k) (inv (reassociate-iterate-succ-𝕋 n r))) +``` + +### The double successor of addition is commutative + +```agda +abstract + commutative-add+2-𝕋 : (x y : 𝕋) → add+2-𝕋 x y = add+2-𝕋 y x + commutative-add+2-𝕋 neg-two-𝕋 = + left-unit-law-add+2-𝕋 + commutative-add+2-𝕋 (succ-𝕋 x) y = + balance-succ-add+2-𝕋 x y ∙ ap succ-𝕋 (commutative-add+2-𝕋 x y) +``` diff --git a/src/foundation/iterating-functions.lagda.md b/src/foundation/iterating-functions.lagda.md index 97c6d29d93..47def9e9b1 100644 --- a/src/foundation/iterating-functions.lagda.md +++ b/src/foundation/iterating-functions.lagda.md @@ -19,6 +19,8 @@ open import foundation.action-on-higher-identifications-functions open import foundation.action-on-identifications-functions open import foundation.dependent-pair-types open import foundation.function-extensionality +open import foundation.function-types +open import foundation.subtypes open import foundation.universe-levels open import foundation-core.endomorphisms @@ -106,6 +108,38 @@ module _ pr2 (pr2 iterative-action-Monoid) = refl ``` +### If `f : X → X` satisfies a property of endofunctions on `X`, and the property is closed under composition then iterates of `f` satisfy the property + +```agda +module _ + {l1 l2 : Level} {X : UU l1} {f : X → X} + (P : subtype l2 (X → X)) + where + + is-in-subtype-iterate-succ-ℕ : + (F : is-in-subtype P f) → + ( (h g : X → X) → + is-in-subtype P h → + is-in-subtype P g → + is-in-subtype P (h ∘ g)) → + (n : ℕ) → is-in-subtype P (iterate (succ-ℕ n) f) + is-in-subtype-iterate-succ-ℕ F H zero-ℕ = F + is-in-subtype-iterate-succ-ℕ F H (succ-ℕ n) = + H f (iterate (succ-ℕ n) f) F (is-in-subtype-iterate-succ-ℕ F H n) + + is-in-subtype-iterate : + (I : is-in-subtype P (id {A = X})) → + (F : is-in-subtype P f) → + ( (h g : X → X) → + is-in-subtype P h → + is-in-subtype P g → + is-in-subtype P (h ∘ g)) → + (n : ℕ) → is-in-subtype P (iterate n f) + is-in-subtype-iterate I F H zero-ℕ = I + is-in-subtype-iterate I F H (succ-ℕ n) = + H f (iterate n f) F (is-in-subtype-iterate I F H n) +``` + ## External links - [Function iteration](https://www.wikidata.org/wiki/Q5254619) on Wikidata diff --git a/src/foundation/maximum-truncation-levels.lagda.md b/src/foundation/maximum-truncation-levels.lagda.md new file mode 100644 index 0000000000..2c38d473c3 --- /dev/null +++ b/src/foundation/maximum-truncation-levels.lagda.md @@ -0,0 +1,173 @@ +# The maximum of truncation levels + +```agda +module foundation.maximum-truncation-levels where +``` + +
Imports + +```agda +open import foundation.action-on-identifications-functions +open import foundation.contractible-types +open import foundation.dependent-pair-types +open import foundation.identity-types +open import foundation.inequality-truncation-levels +open import foundation.unit-type +open import foundation.universe-levels + +open import foundation-core.function-types +open import foundation-core.truncated-types +open import foundation-core.truncation-levels + +open import order-theory.least-upper-bounds-posets +``` + +
+ +## Idea + +Given two [truncation levels](foundation-core.truncation-levels.md) $k$ and $r$, +the +{{#concept "maximum" Disambiguation="binary maximum of truncation levels" Agda=max-𝕋}} +of $k$ and $r$ is the largest of the two. + +## Definitions + +### The maximum of two truncation levels + +```agda +max-𝕋 : 𝕋 → 𝕋 → 𝕋 +max-𝕋 neg-two-𝕋 r = r +max-𝕋 (succ-𝕋 k) neg-two-𝕋 = succ-𝕋 k +max-𝕋 (succ-𝕋 k) (succ-𝕋 r) = succ-𝕋 (max-𝕋 k r) + +infixl 35 _⊔𝕋_ +_⊔𝕋_ : 𝕋 → 𝕋 → 𝕋 +_⊔𝕋_ = max-𝕋 + +max-𝕋' : 𝕋 → 𝕋 → 𝕋 +max-𝕋' k r = max-𝕋 r k +``` + +## Properties + +### The unit laws for the maximum operation + +```agda +left-unit-law-𝕋 : {k : 𝕋} → neg-two-𝕋 ⊔𝕋 k = k +left-unit-law-𝕋 = refl + +right-unit-law-𝕋 : {k : 𝕋} → k ⊔𝕋 neg-two-𝕋 = k +right-unit-law-𝕋 {neg-two-𝕋} = refl +right-unit-law-𝕋 {succ-𝕋 k} = refl + +inv-right-unit-law-𝕋 : {k : 𝕋} → k = k ⊔𝕋 neg-two-𝕋 +inv-right-unit-law-𝕋 {neg-two-𝕋} = refl +inv-right-unit-law-𝕋 {succ-𝕋 k} = refl +``` + +### The maximum is a least upper bound + +```agda +leq-max-𝕋 : (k m n : 𝕋) → m ≤-𝕋 k → n ≤-𝕋 k → m ⊔𝕋 n ≤-𝕋 k +leq-max-𝕋 neg-two-𝕋 neg-two-𝕋 neg-two-𝕋 H K = star +leq-max-𝕋 (succ-𝕋 k) neg-two-𝕋 neg-two-𝕋 H K = star +leq-max-𝕋 (succ-𝕋 k) neg-two-𝕋 (succ-𝕋 n) H K = K +leq-max-𝕋 (succ-𝕋 k) (succ-𝕋 m) neg-two-𝕋 H K = H +leq-max-𝕋 (succ-𝕋 k) (succ-𝕋 m) (succ-𝕋 n) H K = leq-max-𝕋 k m n H K + +leq-left-leq-max-𝕋 : (k m n : 𝕋) → m ⊔𝕋 n ≤-𝕋 k → m ≤-𝕋 k +leq-left-leq-max-𝕋 k neg-two-𝕋 neg-two-𝕋 H = star +leq-left-leq-max-𝕋 k neg-two-𝕋 (succ-𝕋 n) H = star +leq-left-leq-max-𝕋 k (succ-𝕋 m) neg-two-𝕋 H = H +leq-left-leq-max-𝕋 (succ-𝕋 k) (succ-𝕋 m) (succ-𝕋 n) H = + leq-left-leq-max-𝕋 k m n H + +leq-right-leq-max-𝕋 : (k m n : 𝕋) → m ⊔𝕋 n ≤-𝕋 k → n ≤-𝕋 k +leq-right-leq-max-𝕋 k neg-two-𝕋 neg-two-𝕋 H = star +leq-right-leq-max-𝕋 k neg-two-𝕋 (succ-𝕋 n) H = H +leq-right-leq-max-𝕋 k (succ-𝕋 m) neg-two-𝕋 H = star +leq-right-leq-max-𝕋 (succ-𝕋 k) (succ-𝕋 m) (succ-𝕋 n) H = + leq-right-leq-max-𝕋 k m n H + +left-leq-max-𝕋 : (m n : 𝕋) → m ≤-𝕋 m ⊔𝕋 n +left-leq-max-𝕋 m n = leq-left-leq-max-𝕋 (m ⊔𝕋 n) m n (refl-leq-𝕋 (m ⊔𝕋 n)) + +right-leq-max-𝕋 : (m n : 𝕋) → n ≤-𝕋 m ⊔𝕋 n +right-leq-max-𝕋 m n = leq-right-leq-max-𝕋 (m ⊔𝕋 n) m n (refl-leq-𝕋 (m ⊔𝕋 n)) + +is-least-upper-bound-max-𝕋 : + (m n : 𝕋) → is-least-binary-upper-bound-Poset 𝕋-Poset m n (m ⊔𝕋 n) +is-least-upper-bound-max-𝕋 m n = + prove-is-least-binary-upper-bound-Poset + ( 𝕋-Poset) + { m} + { n} + { m ⊔𝕋 n} + ( left-leq-max-𝕋 m n , right-leq-max-𝕋 m n) + ( λ x (H , K) → leq-max-𝕋 x m n H K) +``` + +### The maximum operation is associative + +```agda +associative-max-𝕋 : (x y z : 𝕋) → (x ⊔𝕋 y) ⊔𝕋 z = x ⊔𝕋 (y ⊔𝕋 z) +associative-max-𝕋 neg-two-𝕋 y z = refl +associative-max-𝕋 (succ-𝕋 x) neg-two-𝕋 neg-two-𝕋 = refl +associative-max-𝕋 (succ-𝕋 x) neg-two-𝕋 (succ-𝕋 z) = refl +associative-max-𝕋 (succ-𝕋 x) (succ-𝕋 y) neg-two-𝕋 = refl +associative-max-𝕋 (succ-𝕋 x) (succ-𝕋 y) (succ-𝕋 z) = + ap succ-𝕋 (associative-max-𝕋 x y z) +``` + +### The maximum operation is commutative + +```agda +commutative-max-𝕋 : {k r : 𝕋} → k ⊔𝕋 r = r ⊔𝕋 k +commutative-max-𝕋 {neg-two-𝕋} {r} = inv-right-unit-law-𝕋 +commutative-max-𝕋 {succ-𝕋 k} {neg-two-𝕋} = refl +commutative-max-𝕋 {succ-𝕋 k} {succ-𝕋 r} = ap succ-𝕋 (commutative-max-𝕋 {k} {r}) +``` + +### The maximum operation is idempotent + +```agda +idempotent-max-𝕋 : (x : 𝕋) → x ⊔𝕋 x = x +idempotent-max-𝕋 neg-two-𝕋 = refl +idempotent-max-𝕋 (succ-𝕋 x) = ap succ-𝕋 (idempotent-max-𝕋 x) +``` + +### Successor diagonal laws for the maximum operation + +```agda +left-successor-diagonal-law-max-𝕋 : (x : 𝕋) → succ-𝕋 x ⊔𝕋 x = succ-𝕋 x +left-successor-diagonal-law-max-𝕋 neg-two-𝕋 = refl +left-successor-diagonal-law-max-𝕋 (succ-𝕋 x) = + ap succ-𝕋 (left-successor-diagonal-law-max-𝕋 x) + +right-successor-diagonal-law-max-𝕋 : (x : 𝕋) → x ⊔𝕋 succ-𝕋 x = succ-𝕋 x +right-successor-diagonal-law-max-𝕋 neg-two-𝕋 = refl +right-successor-diagonal-law-max-𝕋 (succ-𝕋 x) = + ap succ-𝕋 (right-successor-diagonal-law-max-𝕋 x) +``` + +### If a type is `k`-truncated and then it is `k ⊔ r`-truncated for every `r` + +```agda +is-trunc-left-max-𝕋 : + (k r : 𝕋) → {l : Level} {A : UU l} → is-trunc k A → is-trunc (k ⊔𝕋 r) A +is-trunc-left-max-𝕋 k neg-two-𝕋 = + is-trunc-eq inv-right-unit-law-𝕋 +is-trunc-left-max-𝕋 neg-two-𝕋 (succ-𝕋 r) H = + is-trunc-is-contr (succ-𝕋 r) H +is-trunc-left-max-𝕋 (succ-𝕋 k) (succ-𝕋 r) H x y = + is-trunc-left-max-𝕋 k r (H x y) + +is-trunc-right-max-𝕋 : + (k r : 𝕋) → {l : Level} {A : UU l} → is-trunc k A → is-trunc (r ⊔𝕋 k) A +is-trunc-right-max-𝕋 k neg-two-𝕋 = id +is-trunc-right-max-𝕋 neg-two-𝕋 (succ-𝕋 r) H = + is-trunc-is-contr (succ-𝕋 r) H +is-trunc-right-max-𝕋 (succ-𝕋 k) (succ-𝕋 r) H x y = + is-trunc-right-max-𝕋 k r (H x y) +``` diff --git a/src/foundation/path-cosplit-maps.lagda.md b/src/foundation/path-cosplit-maps.lagda.md index dfadccdbbc..854352b42a 100644 --- a/src/foundation/path-cosplit-maps.lagda.md +++ b/src/foundation/path-cosplit-maps.lagda.md @@ -29,6 +29,7 @@ open import foundation.homotopy-induction open import foundation.identity-types open import foundation.inhabited-types open import foundation.iterated-dependent-product-types +open import foundation.iterated-successors-truncation-levels open import foundation.logical-equivalences open import foundation.mere-path-cosplit-maps open import foundation.morphisms-arrows @@ -189,7 +190,7 @@ is-path-cosplit-succ-is-path-cosplit (succ-𝕋 k) is-cosplit-f x y = ```agda is-path-cosplit-iterated-succ-is-path-cosplit : {l1 l2 : Level} (k : 𝕋) (r : ℕ) {A : UU l1} {B : UU l2} {f : A → B} → - is-path-cosplit k f → is-path-cosplit (iterated-succ-𝕋 r k) f + is-path-cosplit k f → is-path-cosplit (iterate-succ-𝕋 r k) f is-path-cosplit-iterated-succ-is-path-cosplit k zero-ℕ = id is-path-cosplit-iterated-succ-is-path-cosplit k (succ-ℕ r) F = is-path-cosplit-iterated-succ-is-path-cosplit (succ-𝕋 k) r @@ -269,7 +270,7 @@ is-trunc-map-is-path-cosplit-is-trunc-codomain k is-trunc-B is-cosplit-f = ```agda is-trunc-is-path-cosplit-is-trunc-succ-domain : {l1 l2 : Level} {k r : 𝕋} {A : UU l1} {B : UU l2} {f : A → B} → - is-trunc (succ-succ-add-𝕋 r k) A → is-trunc r (is-path-cosplit k f) + is-trunc (add+2-𝕋 r k) A → is-trunc r (is-path-cosplit k f) is-trunc-is-path-cosplit-is-trunc-succ-domain {k = neg-two-𝕋} = is-trunc-retraction is-trunc-is-path-cosplit-is-trunc-succ-domain {k = succ-𝕋 k} {r} is-trunc-A = diff --git a/src/foundation/surjective-maps.lagda.md b/src/foundation/surjective-maps.lagda.md index f5878a0f62..969c1e7ade 100644 --- a/src/foundation/surjective-maps.lagda.md +++ b/src/foundation/surjective-maps.lagda.md @@ -604,9 +604,7 @@ is-trunc-map-precomp-Π-is-surjective : is-trunc-map-precomp-Π-is-surjective k H = is-trunc-map-precomp-Π-is-connected-map ( neg-one-𝕋) - ( succ-𝕋 k) ( k) - ( refl) ( is-neg-one-connected-map-is-surjective H) ``` diff --git a/src/foundation/truncated-addition-truncation-levels.lagda.md b/src/foundation/truncated-addition-truncation-levels.lagda.md new file mode 100644 index 0000000000..7c6e05a399 --- /dev/null +++ b/src/foundation/truncated-addition-truncation-levels.lagda.md @@ -0,0 +1,222 @@ +# Truncated addition of truncation levels + +```agda +module foundation.truncated-addition-truncation-levels where +``` + +
Imports + +```agda +open import elementary-number-theory.natural-numbers + +open import foundation.action-on-identifications-binary-functions +open import foundation.action-on-identifications-functions +open import foundation.dependent-pair-types +open import foundation.identity-types +open import foundation.inequality-truncation-levels +open import foundation.iterated-successors-truncation-levels +open import foundation.negated-equality +open import foundation.negation +open import foundation.truncation-levels +open import foundation.unit-type + +open import foundation-core.cartesian-product-types +open import foundation-core.function-types +``` + +
+ +## Idea + +We define the +{{#concept "truncated addition" Disambiguation="of truncation levels" Agda=truncadd-𝕋}} +binary operation on [truncation levels](foundation-core.truncation-levels.md). +Truncated addition is given by interpreting truncation levels as +[integers](elementary-number-theory.integers.md), +[adding](elementary-number-theory.addition-integers.md) them together, and +interpreting the result as a truncation level again, mapping any result less +than -2 to -2. + +**Note.** This operation, while conceptually clear, has many flaws that makes it +ill-equipped for use in formalization, and hence is not recommended. For +instance, the operation is not associative and does not reflect inequality. See +instead +[`iterated-successors-truncation-levels`](foundation.iterated-successors-truncation-levels.md) +for a more natural alternative. + +## Definitions + +### Truncated addition of truncation levels + +```agda +truncadd-𝕋' : 𝕋 → 𝕋 → 𝕋 +truncadd-𝕋' neg-two-𝕋 neg-two-𝕋 = neg-two-𝕋 +truncadd-𝕋' neg-two-𝕋 (succ-𝕋 neg-two-𝕋) = neg-two-𝕋 +truncadd-𝕋' neg-two-𝕋 (succ-𝕋 (succ-𝕋 l)) = l +truncadd-𝕋' (succ-𝕋 neg-two-𝕋) neg-two-𝕋 = neg-two-𝕋 +truncadd-𝕋' (succ-𝕋 neg-two-𝕋) (succ-𝕋 l) = l +truncadd-𝕋' (succ-𝕋 (succ-𝕋 k)) neg-two-𝕋 = k +truncadd-𝕋' (succ-𝕋 (succ-𝕋 k)) (succ-𝕋 l) = + succ-𝕋 (truncadd-𝕋' (succ-𝕋 k) (succ-𝕋 l)) + +truncadd-𝕋 : 𝕋 → 𝕋 → 𝕋 +truncadd-𝕋 k r = truncadd-𝕋' r k +``` + +Agda is not happy with the following definition due to the `--exact-split` flag. + +```text +truncadd-𝕋 : 𝕋 → 𝕋 → 𝕋 +truncadd-𝕋 neg-two-𝕋 neg-two-𝕋 = neg-two-𝕋 +truncadd-𝕋 (succ-𝕋 neg-two-𝕋) neg-two-𝕋 = neg-two-𝕋 +truncadd-𝕋 (succ-𝕋 (succ-𝕋 k)) neg-two-𝕋 = k +truncadd-𝕋 neg-two-𝕋 (succ-𝕋 neg-two-𝕋) = neg-two-𝕋 +truncadd-𝕋 (succ-𝕋 k) (succ-𝕋 neg-two-𝕋) = k +truncadd-𝕋 neg-two-𝕋 (succ-𝕋 (succ-𝕋 r)) = r +truncadd-𝕋 (succ-𝕋 k) (succ-𝕋 (succ-𝕋 r)) = + succ-𝕋 (truncadd-𝕋 (succ-𝕋 k) (succ-𝕋 r)) +``` + +### The binary action of truncated addition on identifications + +```agda +ap-binary-truncadd-𝕋 : + {m n m' n' : 𝕋} → m = m' → n = n' → truncadd-𝕋 m n = truncadd-𝕋 m' n' +ap-binary-truncadd-𝕋 p q = ap-binary truncadd-𝕋 p q +``` + +## Properties + +### Unit laws for addition of truncation levels + +```agda +left-unit-law-truncadd-𝕋 : (k : 𝕋) → truncadd-𝕋 zero-𝕋 k = k +left-unit-law-truncadd-𝕋 neg-two-𝕋 = refl +left-unit-law-truncadd-𝕋 (succ-𝕋 neg-two-𝕋) = refl +left-unit-law-truncadd-𝕋 (succ-𝕋 (succ-𝕋 k)) = + ap succ-𝕋 (left-unit-law-truncadd-𝕋 (succ-𝕋 k)) + +right-unit-law-truncadd-𝕋 : (k : 𝕋) → truncadd-𝕋 k zero-𝕋 = k +right-unit-law-truncadd-𝕋 neg-two-𝕋 = refl +right-unit-law-truncadd-𝕋 (succ-𝕋 neg-two-𝕋) = refl +right-unit-law-truncadd-𝕋 (succ-𝕋 (succ-𝕋 neg-two-𝕋)) = refl +right-unit-law-truncadd-𝕋 (succ-𝕋 (succ-𝕋 (succ-𝕋 k))) = refl +``` + +### Successor laws for addition of truncation levels + +```agda +right-successor-law-truncadd-𝕋 : + (n k : 𝕋) → + truncadd-𝕋 k (iterate-succ-𝕋 3 n) = succ-𝕋 (truncadd-𝕋 k (iterate-succ-𝕋 2 n)) +right-successor-law-truncadd-𝕋 n neg-two-𝕋 = refl +right-successor-law-truncadd-𝕋 n (succ-𝕋 k) = refl + +left-successor-law-truncadd-𝕋 : + (k n : 𝕋) → + truncadd-𝕋 (iterate-succ-𝕋 3 n) k = succ-𝕋 (truncadd-𝕋 (iterate-succ-𝕋 2 n) k) +left-successor-law-truncadd-𝕋 neg-two-𝕋 n = refl +left-successor-law-truncadd-𝕋 (succ-𝕋 neg-two-𝕋) n = refl +left-successor-law-truncadd-𝕋 (succ-𝕋 (succ-𝕋 k)) n = + ap succ-𝕋 (left-successor-law-truncadd-𝕋 (succ-𝕋 k) n) +``` + +### The balancing law of the successor function over addition + +```agda +balance-succ-truncadd-𝕋 : + (k r : 𝕋) → truncadd-𝕋 (succ-𝕋 k) r = truncadd-𝕋 k (succ-𝕋 r) +balance-succ-truncadd-𝕋 neg-two-𝕋 neg-two-𝕋 = refl +balance-succ-truncadd-𝕋 neg-two-𝕋 (succ-𝕋 neg-two-𝕋) = refl +balance-succ-truncadd-𝕋 neg-two-𝕋 (succ-𝕋 (succ-𝕋 r)) = + ap succ-𝕋 (balance-succ-truncadd-𝕋 neg-two-𝕋 (succ-𝕋 r)) +balance-succ-truncadd-𝕋 (succ-𝕋 k) neg-two-𝕋 = refl +balance-succ-truncadd-𝕋 (succ-𝕋 k) (succ-𝕋 neg-two-𝕋) = refl +balance-succ-truncadd-𝕋 (succ-𝕋 k) (succ-𝕋 (succ-𝕋 r)) = + ap succ-𝕋 (balance-succ-truncadd-𝕋 (succ-𝕋 k) (succ-𝕋 r)) + +abstract + balance-iterated-succ-truncadd-𝕋 : + (n : ℕ) (k r : 𝕋) → + truncadd-𝕋 (iterate-succ-𝕋 n k) r = truncadd-𝕋 k (iterate-succ-𝕋 n r) + balance-iterated-succ-truncadd-𝕋 zero-ℕ k r = refl + balance-iterated-succ-truncadd-𝕋 (succ-ℕ n) k r = + ( balance-iterated-succ-truncadd-𝕋 n (succ-𝕋 k) r) ∙ + ( balance-succ-truncadd-𝕋 k (iterate-succ-𝕋 n r)) ∙ + ( ap (truncadd-𝕋 k) (inv (reassociate-iterate-succ-𝕋 n r))) +``` + +### The double successor of addition is the double successor of addition + +```agda +abstract + compute-succ-succ-truncadd-𝕋 : + (k r : 𝕋) → add+2-𝕋 k r = truncadd-𝕋 (succ-𝕋 (succ-𝕋 k)) r + compute-succ-succ-truncadd-𝕋 k neg-two-𝕋 = refl + compute-succ-succ-truncadd-𝕋 k (succ-𝕋 neg-two-𝕋) = refl + compute-succ-succ-truncadd-𝕋 neg-two-𝕋 (succ-𝕋 (succ-𝕋 r)) = + left-unit-law-add+2-𝕋 (succ-𝕋 (succ-𝕋 r)) ∙ + inv (left-unit-law-truncadd-𝕋 (succ-𝕋 (succ-𝕋 r))) + compute-succ-succ-truncadd-𝕋 (succ-𝕋 k) (succ-𝕋 (succ-𝕋 r)) = + ap succ-𝕋 (compute-succ-succ-truncadd-𝕋 (succ-𝕋 k) (succ-𝕋 r)) + +abstract + compute-succ-succ-truncadd-𝕋' : + (k r : 𝕋) → add+2-𝕋 k r = truncadd-𝕋 k (succ-𝕋 (succ-𝕋 r)) + compute-succ-succ-truncadd-𝕋' k r = + compute-succ-succ-truncadd-𝕋 k r ∙ balance-iterated-succ-truncadd-𝕋 2 k r +``` + +### Addition is not associative + +```agda +example-not-associative-truncadd-𝕋 : + truncadd-𝕋 (truncadd-𝕋 neg-two-𝕋 neg-two-𝕋) one-𝕋 ≠ + truncadd-𝕋 neg-two-𝕋 (truncadd-𝕋 neg-two-𝕋 one-𝕋) +example-not-associative-truncadd-𝕋 () + +not-associative-truncadd-𝕋 : + ¬ ( (x y z : 𝕋) → + truncadd-𝕋 (truncadd-𝕋 x y) z = truncadd-𝕋 x (truncadd-𝕋 y z)) +not-associative-truncadd-𝕋 α = + example-not-associative-truncadd-𝕋 (α neg-two-𝕋 neg-two-𝕋 one-𝕋) +``` + +### Addition is commutative + +```agda +abstract + commutative-truncadd-𝕋 : (x y : 𝕋) → truncadd-𝕋 x y = truncadd-𝕋 y x + commutative-truncadd-𝕋 neg-two-𝕋 neg-two-𝕋 = refl + commutative-truncadd-𝕋 neg-two-𝕋 (succ-𝕋 neg-two-𝕋) = refl + commutative-truncadd-𝕋 neg-two-𝕋 (succ-𝕋 (succ-𝕋 y)) = refl + commutative-truncadd-𝕋 (succ-𝕋 neg-two-𝕋) neg-two-𝕋 = refl + commutative-truncadd-𝕋 (succ-𝕋 neg-two-𝕋) (succ-𝕋 neg-two-𝕋) = refl + commutative-truncadd-𝕋 (succ-𝕋 neg-two-𝕋) (succ-𝕋 (succ-𝕋 y)) = + ap succ-𝕋 (commutative-truncadd-𝕋 (succ-𝕋 neg-two-𝕋) (succ-𝕋 y)) + commutative-truncadd-𝕋 (succ-𝕋 (succ-𝕋 x)) neg-two-𝕋 = refl + commutative-truncadd-𝕋 (succ-𝕋 (succ-𝕋 x)) (succ-𝕋 neg-two-𝕋) = + ap succ-𝕋 (commutative-truncadd-𝕋 (succ-𝕋 x) (succ-𝕋 neg-two-𝕋)) + commutative-truncadd-𝕋 (succ-𝕋 (succ-𝕋 x)) (succ-𝕋 (succ-𝕋 y)) = + ap + ( succ-𝕋) + ( balance-succ-truncadd-𝕋 (succ-𝕋 x) (succ-𝕋 y) ∙ + commutative-truncadd-𝕋 (succ-𝕋 x) (succ-𝕋 (succ-𝕋 y))) +``` + +### Addition does not reflect inequality of truncation levels + +```agda +example-not-reflects-leq-left-truncadd-𝕋 : + (truncadd-𝕋 neg-one-𝕋 neg-two-𝕋) ≤-𝕋 (truncadd-𝕋 neg-two-𝕋 neg-two-𝕋) × + ¬ (neg-one-𝕋 ≤-𝕋 neg-two-𝕋) +example-not-reflects-leq-left-truncadd-𝕋 = (star , id) + +not-reflects-leq-left-truncadd-𝕋 : + ¬ ((k m n : 𝕋) → (truncadd-𝕋 m k) ≤-𝕋 (truncadd-𝕋 n k) → m ≤-𝕋 n) +not-reflects-leq-left-truncadd-𝕋 α = α neg-two-𝕋 neg-one-𝕋 neg-two-𝕋 star +``` + +## See also + +- [`iterated-successors-truncation-levels`](foundation.iterated-successors-truncation-levels.md) diff --git a/src/foundation/truncated-types.lagda.md b/src/foundation/truncated-types.lagda.md index d2248f9dab..e9737d2dde 100644 --- a/src/foundation/truncated-types.lagda.md +++ b/src/foundation/truncated-types.lagda.md @@ -13,6 +13,7 @@ open import elementary-number-theory.natural-numbers open import foundation.dependent-pair-types open import foundation.equivalences +open import foundation.iterated-successors-truncation-levels open import foundation.logical-equivalences open import foundation.subtype-identity-principle open import foundation.truncation-levels @@ -21,7 +22,6 @@ open import foundation.universe-levels open import foundation-core.embeddings open import foundation-core.identity-types -open import foundation-core.propositions open import foundation-core.subtypes open import foundation-core.torsorial-type-families ``` @@ -82,7 +82,7 @@ emb-type-Truncated-Type l k = emb-subtype (is-trunc-Prop k) abstract is-trunc-iterated-succ-is-trunc : (k : 𝕋) (r : ℕ) {l : Level} {A : UU l} → - is-trunc k A → is-trunc (iterated-succ-𝕋' k r) A + is-trunc k A → is-trunc (iterate-succ-𝕋' k r) A is-trunc-iterated-succ-is-trunc k zero-ℕ is-trunc-A = is-trunc-A is-trunc-iterated-succ-is-trunc k (succ-ℕ r) is-trunc-A = is-trunc-iterated-succ-is-trunc (succ-𝕋 k) r @@ -90,7 +90,7 @@ abstract truncated-type-iterated-succ-Truncated-Type : (k : 𝕋) (r : ℕ) {l : Level} → - Truncated-Type l k → Truncated-Type l (iterated-succ-𝕋' k r) + Truncated-Type l k → Truncated-Type l (iterate-succ-𝕋' k r) pr1 (truncated-type-iterated-succ-Truncated-Type k r A) = type-Truncated-Type A pr2 (truncated-type-iterated-succ-Truncated-Type k r A) = is-trunc-iterated-succ-is-trunc k r (is-trunc-type-Truncated-Type A) diff --git a/src/foundation/truncation-levels.lagda.md b/src/foundation/truncation-levels.lagda.md index 4b04872ae7..c7cfcb2b89 100644 --- a/src/foundation/truncation-levels.lagda.md +++ b/src/foundation/truncation-levels.lagda.md @@ -14,6 +14,7 @@ open import elementary-number-theory.natural-numbers open import foundation.action-on-identifications-functions open import foundation-core.function-types +open import foundation-core.homotopies open import foundation-core.identity-types ``` @@ -36,85 +37,10 @@ truncation-level-ℕ : ℕ → 𝕋 truncation-level-ℕ = succ-𝕋 ∘ truncation-level-minus-one-ℕ ``` -### Inclusion of the truncation levels into the natural numbers +### Inclusion of the double successors of truncation levels into the natural numbers ```agda -nat-succ-succ-𝕋 : 𝕋 → ℕ -nat-succ-succ-𝕋 neg-two-𝕋 = zero-ℕ -nat-succ-succ-𝕋 (succ-𝕋 k) = succ-ℕ (nat-succ-succ-𝕋 k) -``` - -### Addition of truncation levels - -```agda -add-𝕋 : 𝕋 → 𝕋 → 𝕋 -add-𝕋 neg-two-𝕋 neg-two-𝕋 = neg-two-𝕋 -add-𝕋 neg-two-𝕋 (succ-𝕋 neg-two-𝕋) = neg-two-𝕋 -add-𝕋 neg-two-𝕋 (succ-𝕋 (succ-𝕋 l)) = l -add-𝕋 (succ-𝕋 neg-two-𝕋) neg-two-𝕋 = neg-two-𝕋 -add-𝕋 (succ-𝕋 neg-two-𝕋) (succ-𝕋 l) = l -add-𝕋 (succ-𝕋 (succ-𝕋 k)) neg-two-𝕋 = k -add-𝕋 (succ-𝕋 (succ-𝕋 k)) (succ-𝕋 l) = succ-𝕋 (add-𝕋 (succ-𝕋 k) (succ-𝕋 l)) - -infixl 35 _+𝕋_ -_+𝕋_ = add-𝕋 -``` - -```agda -succ-succ-add-𝕋 : 𝕋 → 𝕋 → 𝕋 -succ-succ-add-𝕋 x neg-two-𝕋 = x -succ-succ-add-𝕋 x (succ-𝕋 y) = succ-𝕋 (succ-succ-add-𝕋 x y) -``` - -### Iterated successor functions on truncation levels - -Although we can define an addition operation on truncation levels, when it comes -to doing induction on them, it is more natural to speak in terms of an iterated -successor: - -```agda -iterated-succ-𝕋 : ℕ → 𝕋 → 𝕋 -iterated-succ-𝕋 zero-ℕ x = x -iterated-succ-𝕋 (succ-ℕ n) x = iterated-succ-𝕋 n (succ-𝕋 x) - -iterated-succ-𝕋' : 𝕋 → ℕ → 𝕋 -iterated-succ-𝕋' x n = iterated-succ-𝕋 n x -``` - -## Properties - -### Unit laws for addition of truncation levels - -```agda -left-unit-law-add-𝕋 : (k : 𝕋) → zero-𝕋 +𝕋 k = k -left-unit-law-add-𝕋 neg-two-𝕋 = refl -left-unit-law-add-𝕋 (succ-𝕋 neg-two-𝕋) = refl -left-unit-law-add-𝕋 (succ-𝕋 (succ-𝕋 neg-two-𝕋)) = refl -left-unit-law-add-𝕋 (succ-𝕋 (succ-𝕋 (succ-𝕋 k))) = refl - -right-unit-law-add-𝕋 : (k : 𝕋) → k +𝕋 zero-𝕋 = k -right-unit-law-add-𝕋 neg-two-𝕋 = refl -right-unit-law-add-𝕋 (succ-𝕋 neg-two-𝕋) = refl -right-unit-law-add-𝕋 (succ-𝕋 (succ-𝕋 k)) = - ap succ-𝕋 (right-unit-law-add-𝕋 (succ-𝕋 k)) -``` - -### Successor laws for addition of truncation levels - -```agda -left-successor-law-add-𝕋 : - (n k : 𝕋) → - (succ-𝕋 (succ-𝕋 (succ-𝕋 n))) +𝕋 k = - succ-𝕋 (add-𝕋 (succ-𝕋 (succ-𝕋 n)) k) -left-successor-law-add-𝕋 n neg-two-𝕋 = refl -left-successor-law-add-𝕋 n (succ-𝕋 k) = refl - -right-successor-law-add-𝕋 : - (k n : 𝕋) → - k +𝕋 (succ-𝕋 (succ-𝕋 (succ-𝕋 n))) = - succ-𝕋 (k +𝕋 (succ-𝕋 (succ-𝕋 n))) -right-successor-law-add-𝕋 neg-two-𝕋 n = refl -right-successor-law-add-𝕋 (succ-𝕋 neg-two-𝕋) n = refl -right-successor-law-add-𝕋 (succ-𝕋 (succ-𝕋 k)) n = - ap succ-𝕋 (right-successor-law-add-𝕋 (succ-𝕋 k) n) +nat+2-𝕋 : 𝕋 → ℕ +nat+2-𝕋 neg-two-𝕋 = zero-ℕ +nat+2-𝕋 (succ-𝕋 k) = succ-ℕ (nat+2-𝕋 k) ``` diff --git a/src/univalent-combinatorics.lagda.md b/src/univalent-combinatorics.lagda.md index 7d28a03d15..0975e705a7 100644 --- a/src/univalent-combinatorics.lagda.md +++ b/src/univalent-combinatorics.lagda.md @@ -118,6 +118,7 @@ open import univalent-combinatorics.sums-of-natural-numbers public open import univalent-combinatorics.surjective-maps public open import univalent-combinatorics.symmetric-difference public open import univalent-combinatorics.trivial-sigma-decompositions public +open import univalent-combinatorics.truncated-pi-finite-types public open import univalent-combinatorics.type-duality public open import univalent-combinatorics.unbounded-pi-finite-types public open import univalent-combinatorics.unions-subtypes public diff --git a/src/univalent-combinatorics/finitely-enumerable-types.lagda.md b/src/univalent-combinatorics/finitely-enumerable-types.lagda.md index bfb1910c4e..3b873c11a7 100644 --- a/src/univalent-combinatorics/finitely-enumerable-types.lagda.md +++ b/src/univalent-combinatorics/finitely-enumerable-types.lagda.md @@ -312,3 +312,7 @@ product-Finitely-Enumerable-Type (X , eX) (Y , eY) = - A [Kuratowski finite set](univalent-combinatorics.kuratowski-finite-sets.md) is precisely a finitely enumerable [set](foundation.sets.md). +- A type is finitely enumerable if and only if it has + [finitely many connected components](univalent-combinatorics.finitely-many-connected-components.md). +- Finitely enumerable types are precisely + [untruncated π₀-finite types](univalent-combinatorics.untruncated-pi-finite-types.md). diff --git a/src/univalent-combinatorics/main-classes-of-latin-hypercubes.lagda.md b/src/univalent-combinatorics/main-classes-of-latin-hypercubes.lagda.md index f88ff5969a..5922edfc09 100644 --- a/src/univalent-combinatorics/main-classes-of-latin-hypercubes.lagda.md +++ b/src/univalent-combinatorics/main-classes-of-latin-hypercubes.lagda.md @@ -24,8 +24,8 @@ open import univalent-combinatorics.complements-isolated-elements open import univalent-combinatorics.decidable-subtypes open import univalent-combinatorics.dependent-function-types open import univalent-combinatorics.finite-types -open import univalent-combinatorics.pi-finite-types open import univalent-combinatorics.standard-finite-types +open import univalent-combinatorics.truncated-pi-finite-types open import univalent-combinatorics.untruncated-pi-finite-types ``` @@ -190,10 +190,10 @@ is-untruncated-π-finite-Main-Class-Latin-Hypercube-of-Order k n m = ### The groupoid of main classes of Latin hypercubes of finite order is π₁-finite ```agda -is-π-finite-Main-Class-Latin-Hypercube-of-Order : - (n m : ℕ) → is-π-finite 1 (Main-Class-Latin-Hypercube-of-Order n m) -is-π-finite-Main-Class-Latin-Hypercube-of-Order n m = - is-π-finite-is-untruncated-π-finite 1 +is-truncated-π-finite-Main-Class-Latin-Hypercube-of-Order : + (n m : ℕ) → is-truncated-π-finite 1 (Main-Class-Latin-Hypercube-of-Order n m) +is-truncated-π-finite-Main-Class-Latin-Hypercube-of-Order n m = + is-truncated-π-finite-is-untruncated-π-finite 1 ( is-1-type-Main-Class-Latin-Hypercube-of-Order n m) ( is-untruncated-π-finite-Main-Class-Latin-Hypercube-of-Order 1 n m) ``` diff --git a/src/univalent-combinatorics/main-classes-of-latin-squares.lagda.md b/src/univalent-combinatorics/main-classes-of-latin-squares.lagda.md index 0f3d9410e3..538295848e 100644 --- a/src/univalent-combinatorics/main-classes-of-latin-squares.lagda.md +++ b/src/univalent-combinatorics/main-classes-of-latin-squares.lagda.md @@ -15,8 +15,8 @@ open import foundation.set-truncations open import foundation.universe-levels open import univalent-combinatorics.main-classes-of-latin-hypercubes -open import univalent-combinatorics.pi-finite-types open import univalent-combinatorics.standard-finite-types +open import univalent-combinatorics.truncated-pi-finite-types open import univalent-combinatorics.untruncated-pi-finite-types ``` @@ -66,10 +66,10 @@ is-untruncated-π-finite-Main-Class-Latin-Square-of-Order : is-untruncated-π-finite-Main-Class-Latin-Square-of-Order k = is-untruncated-π-finite-Main-Class-Latin-Hypercube-of-Order k 2 -is-π-finite-Main-Class-Latin-Square-of-Order : - (m : ℕ) → is-π-finite 1 (Main-Class-Latin-Square-of-Order m) -is-π-finite-Main-Class-Latin-Square-of-Order = - is-π-finite-Main-Class-Latin-Hypercube-of-Order 2 +is-truncated-π-finite-Main-Class-Latin-Square-of-Order : + (m : ℕ) → is-truncated-π-finite 1 (Main-Class-Latin-Square-of-Order m) +is-truncated-π-finite-Main-Class-Latin-Square-of-Order = + is-truncated-π-finite-Main-Class-Latin-Hypercube-of-Order 2 ``` ### The sequence of the number of main classes of latin squares of finite order diff --git a/src/univalent-combinatorics/pi-finite-types.lagda.md b/src/univalent-combinatorics/pi-finite-types.lagda.md index 5632fede24..d1aa9112d3 100644 --- a/src/univalent-combinatorics/pi-finite-types.lagda.md +++ b/src/univalent-combinatorics/pi-finite-types.lagda.md @@ -1,6 +1,8 @@ # π-finite types ```agda +{-# OPTIONS --guardedness #-} + module univalent-combinatorics.pi-finite-types where ``` @@ -9,16 +11,40 @@ module univalent-combinatorics.pi-finite-types where ```agda open import elementary-number-theory.natural-numbers +open import foundation.conjunction +open import foundation.contractible-types +open import foundation.coproduct-types +open import foundation.dependent-function-types open import foundation.dependent-pair-types +open import foundation.empty-types +open import foundation.equality-coproduct-types +open import foundation.equivalences +open import foundation.existential-quantification +open import foundation.finitely-truncated-types +open import foundation.function-extensionality +open import foundation.function-types +open import foundation.functoriality-dependent-pair-types open import foundation.identity-types +open import foundation.maybe +open import foundation.propositional-truncations open import foundation.propositions +open import foundation.retracts-of-types open import foundation.set-truncations +open import foundation.sets open import foundation.truncated-types open import foundation.truncation-levels +open import foundation.unit-type open import foundation.universe-levels +open import univalent-combinatorics.coproduct-types +open import univalent-combinatorics.counting +open import univalent-combinatorics.dependent-function-types open import univalent-combinatorics.finite-types open import univalent-combinatorics.finitely-many-connected-components +open import univalent-combinatorics.retracts-of-finite-types +open import univalent-combinatorics.standard-finite-types +open import univalent-combinatorics.truncated-pi-finite-types +open import univalent-combinatorics.unbounded-pi-finite-types open import univalent-combinatorics.untruncated-pi-finite-types ``` @@ -27,100 +53,242 @@ open import univalent-combinatorics.untruncated-pi-finite-types ## Idea A type is -{{#concept "πₙ-finite" Disambiguation="type" Agda=is-π-finite Agda=π-Finite-Type}} -if it has [finitely](univalent-combinatorics.finite-types.md) many -[connected components](foundation.connected-components.md), all of its homotopy -groups up to level `n` at all base points are finite, and all higher homotopy -groups are [trivial](group-theory.trivial-groups.md). A type is -{{#concept "π-finite"}} if it is πₙ-finite for some `n`. +{{#concept "π-finite" Disambiguation="type" Agda=is-π-finite Agda=π-Finite-Type}} +if it has +[finitely many connected components](univalent-combinatorics.finitely-many-connected-components.md), +all of its [homotopy groups](synthetic-homotopy-theory.homotopy-groups.md) are +[finite](univalent-combinatorics.finite-types.md), and it is $n$-truncated for +some $n$ {{#cite Anel24}}. However, formally we define a π-finite type to be a +[finitely truncated type](foundation.finitely-truncated-types.md) that is +[unbounded π-finite](univalent-combinatorics.unbounded-pi-finite-types.md). ## Definitions -### The πₙ-finiteness predicate +### The π-finiteness predicate ```agda -is-π-finite-Prop : {l : Level} (k : ℕ) → UU l → Prop l -is-π-finite-Prop zero-ℕ X = is-finite-Prop X -is-π-finite-Prop (succ-ℕ k) X = - product-Prop - ( has-finitely-many-connected-components-Prop X) - ( Π-Prop X - ( λ x → Π-Prop X (λ y → is-π-finite-Prop k (x = y)))) - -is-π-finite : {l : Level} (k : ℕ) → UU l → UU l -is-π-finite k A = - type-Prop (is-π-finite-Prop k A) +is-π-finite-Prop : {l : Level} → UU l → Prop l +is-π-finite-Prop A = + is-finitely-trunc-Prop A ∧ is-unbounded-π-finite-Prop' A + +is-π-finite : {l : Level} → UU l → UU l +is-π-finite A = type-Prop (is-π-finite-Prop A) is-prop-is-π-finite : - {l : Level} (k : ℕ) {A : UU l} → is-prop (is-π-finite k A) -is-prop-is-π-finite k {A} = - is-prop-type-Prop (is-π-finite-Prop k A) - -has-finitely-many-connected-components-is-π-finite : - {l : Level} (k : ℕ) {X : UU l} → - is-π-finite k X → has-finitely-many-connected-components X -has-finitely-many-connected-components-is-π-finite zero-ℕ = - has-finitely-many-connected-components-is-finite -has-finitely-many-connected-components-is-π-finite (succ-ℕ k) = pr1 + {l : Level} {A : UU l} → is-prop (is-π-finite A) +is-prop-is-π-finite {A = A} = + is-prop-type-Prop (is-π-finite-Prop A) + +module _ + {l : Level} {A : UU l} (H : is-π-finite A) + where + + is-finitely-trunc-is-π-finite : is-finitely-trunc A + is-finitely-trunc-is-π-finite = pr1 H + + is-unbounded-π-finite-is-π-finite : is-unbounded-π-finite' A + is-unbounded-π-finite-is-π-finite = pr2 H + + has-finitely-many-connected-components-is-π-finite : + has-finitely-many-connected-components A + has-finitely-many-connected-components-is-π-finite = + has-finitely-many-connected-components-is-untruncated-π-finite 0 + ( is-unbounded-π-finite-is-π-finite 0) ``` -### The subuniverse πₙ-finite types +### The subuniverse of π-finite types ```agda -π-Finite-Type : (l : Level) (k : ℕ) → UU (lsuc l) -π-Finite-Type l k = Σ (UU l) (is-π-finite k) +π-Finite-Type : (l : Level) → UU (lsuc l) +π-Finite-Type l = Σ (UU l) (is-π-finite) + +module _ + {l : Level} (A : π-Finite-Type l) + where -type-π-Finite-Type : - {l : Level} (k : ℕ) → π-Finite-Type l k → UU l -type-π-Finite-Type k = pr1 + type-π-Finite-Type : UU l + type-π-Finite-Type = pr1 A -is-π-finite-type-π-Finite-Type : - {l : Level} (k : ℕ) (A : π-Finite-Type l k) → - is-π-finite k (type-π-Finite-Type {l} k A) -is-π-finite-type-π-Finite-Type k = pr2 + is-π-finite-type-π-Finite-Type : is-π-finite type-π-Finite-Type + is-π-finite-type-π-Finite-Type = pr2 A + + is-finitely-trunc-type-π-Finite-Type : + is-finitely-trunc type-π-Finite-Type + is-finitely-trunc-type-π-Finite-Type = + is-finitely-trunc-is-π-finite is-π-finite-type-π-Finite-Type + + is-unbounded-π-finite-type-π-Finite-Type : + is-unbounded-π-finite' type-π-Finite-Type + is-unbounded-π-finite-type-π-Finite-Type = + is-unbounded-π-finite-is-π-finite is-π-finite-type-π-Finite-Type + + has-finitely-many-connected-components-type-π-Finite-Type : + has-finitely-many-connected-components type-π-Finite-Type + has-finitely-many-connected-components-type-π-Finite-Type = + has-finitely-many-connected-components-is-π-finite + is-π-finite-type-π-Finite-Type ``` ## Properties -### πₙ-finite types are n-truncated +### Truncated π-finite types are π-finite ```agda -is-trunc-is-π-finite : - {l : Level} (k : ℕ) {X : UU l} → - is-π-finite k X → is-trunc (truncation-level-ℕ k) X -is-trunc-is-π-finite zero-ℕ = is-set-is-finite -is-trunc-is-π-finite (succ-ℕ k) H x y = - is-trunc-is-π-finite k (pr2 H x y) +is-π-finite-is-truncated-π-finite : + {l : Level} (n : ℕ) {A : UU l} → is-truncated-π-finite n A → is-π-finite A +is-π-finite-is-truncated-π-finite n H = + ( intro-exists (truncation-level-ℕ n) (is-trunc-is-truncated-π-finite n H) , + is-unbounded-π-finite-is-truncated-π-finite' n H) ``` -### Untruncated πₙ-finite n-truncated types are πₙ-finite +### π-finite types are closed under retracts ```agda -is-π-finite-is-untruncated-π-finite : - {l : Level} (k : ℕ) {A : UU l} → is-trunc (truncation-level-ℕ k) A → - is-untruncated-π-finite k A → is-π-finite k A -is-π-finite-is-untruncated-π-finite zero-ℕ H K = - is-finite-is-untruncated-π-finite zero-ℕ H K -pr1 (is-π-finite-is-untruncated-π-finite (succ-ℕ k) H K) = pr1 K -pr2 (is-π-finite-is-untruncated-π-finite (succ-ℕ k) H K) x y = - is-π-finite-is-untruncated-π-finite k (H x y) (pr2 K x y) +is-π-finite-retract : + {l1 l2 : Level} {A : UU l1} {B : UU l2} → + A retract-of B → is-π-finite B → is-π-finite A +pr1 (is-π-finite-retract R H) = + is-finitely-trunc-retract-of R (is-finitely-trunc-is-π-finite H) +pr2 (is-π-finite-retract R H) n = + is-untruncated-π-finite-retract n R (is-unbounded-π-finite-is-π-finite H n) ``` -### πₙ-finite types are untruncated πₙ-finite +### π-finite types are closed under equivalences ```agda -is-untruncated-π-finite-is-π-finite : - {l : Level} (k : ℕ) {A : UU l} → - is-π-finite k A → is-untruncated-π-finite k A -is-untruncated-π-finite-is-π-finite zero-ℕ H = - is-finite-equiv - ( equiv-unit-trunc-Set (_ , (is-set-is-finite H))) - ( H) -pr1 (is-untruncated-π-finite-is-π-finite (succ-ℕ k) H) = pr1 H -pr2 (is-untruncated-π-finite-is-π-finite (succ-ℕ k) H) x y = - is-untruncated-π-finite-is-π-finite k (pr2 H x y) +is-π-finite-equiv : + {l1 l2 : Level} {A : UU l1} {B : UU l2} → + A ≃ B → is-π-finite B → is-π-finite A +is-π-finite-equiv e = + is-π-finite-retract (retract-equiv e) + +is-π-finite-equiv' : + {l1 l2 : Level} {A : UU l1} {B : UU l2} → + A ≃ B → is-π-finite A → is-π-finite B +is-π-finite-equiv' e = + is-π-finite-retract (retract-inv-equiv e) ``` +### Empty types are π-finite + +```agda +is-π-finite-empty : is-π-finite empty +is-π-finite-empty = + is-π-finite-is-truncated-π-finite 0 (is-truncated-π-finite-empty 0) + +empty-π-Finite-Type : π-Finite-Type lzero +empty-π-Finite-Type = (empty , is-π-finite-empty) + +is-π-finite-is-empty : + {l : Level} {A : UU l} → is-empty A → is-π-finite A +is-π-finite-is-empty H = + is-π-finite-is-truncated-π-finite 0 (is-truncated-π-finite-is-empty 0 H) +``` + +### Contractible types are π-finite + +```agda +is-π-finite-is-contr : + {l : Level} {A : UU l} → is-contr A → is-π-finite A +is-π-finite-is-contr H = + is-π-finite-is-truncated-π-finite 0 (is-truncated-π-finite-is-contr 0 H) + +is-π-finite-unit : is-π-finite unit +is-π-finite-unit = + is-π-finite-is-contr is-contr-unit + +unit-π-Finite-Type : π-Finite-Type lzero +unit-π-Finite-Type = + ( unit , is-π-finite-unit) +``` + +### Coproducts of π-finite types are π-finite + +```agda +is-π-finite-coproduct : + {l1 l2 : Level} {A : UU l1} {B : UU l2} → + is-π-finite A → is-π-finite B → + is-π-finite (A + B) +is-π-finite-coproduct hA hB = + ( ( is-finitely-trunc-coproduct + ( is-finitely-trunc-is-π-finite hA) + ( is-finitely-trunc-is-π-finite hB)) , + ( λ n → + is-untruncated-π-finite-coproduct n + ( is-unbounded-π-finite-is-π-finite hA n) + ( is-unbounded-π-finite-is-π-finite hB n))) + +coproduct-π-Finite-Type : + {l1 l2 : Level} → + π-Finite-Type l1 → π-Finite-Type l2 → π-Finite-Type (l1 ⊔ l2) +pr1 (coproduct-π-Finite-Type A B) = + type-π-Finite-Type A + type-π-Finite-Type B +pr2 (coproduct-π-Finite-Type A B) = + is-π-finite-coproduct + ( is-π-finite-type-π-Finite-Type A) + ( is-π-finite-type-π-Finite-Type B) +``` + +### `Maybe A` of any π-finite type `A` is π-finite + +```agda +is-π-finite-Maybe : + {l : Level} {A : UU l} → is-π-finite A → is-π-finite (Maybe A) +is-π-finite-Maybe H = is-π-finite-coproduct H (is-π-finite-unit) + +Maybe-π-Finite-Type : + {l : Level} → π-Finite-Type l → π-Finite-Type l +Maybe-π-Finite-Type (A , H) = (Maybe A , is-π-finite-Maybe H) +``` + +### Any standard finite type is π-finite + +```agda +is-π-finite-Fin : (n : ℕ) → is-π-finite (Fin n) +is-π-finite-Fin n = + is-π-finite-is-truncated-π-finite 0 (is-truncated-π-finite-Fin 0 n) + +Fin-π-Finite-Type : (n : ℕ) → π-Finite-Type lzero +Fin-π-Finite-Type n = (Fin n , is-π-finite-Fin n) +``` + +### Any type equipped with a counting is π-finite + +```agda +is-π-finite-count : {l : Level} {A : UU l} → count A → is-π-finite A +is-π-finite-count (n , e) = is-π-finite-equiv' e (is-π-finite-Fin n) +``` + +### Any finite type is π-finite + +```agda +is-π-finite-is-finite : + {l : Level} {A : UU l} → is-finite A → is-π-finite A +is-π-finite-is-finite {A = A} H = + apply-universal-property-trunc-Prop H + ( is-π-finite-Prop A) + ( is-π-finite-count) + +π-finite-Finite-Type : {l : Level} → Finite-Type l → π-Finite-Type l +π-finite-Finite-Type A = + ( type-Finite-Type A , is-π-finite-is-finite (is-finite-type-Finite-Type A)) +``` + +### π-finite sets are finite + +```agda +is-finite-is-π-finite : + {l : Level} {A : UU l} → is-set A → is-π-finite A → is-finite A +is-finite-is-π-finite H K = + is-finite-equiv' + ( equiv-unit-trunc-Set (_ , H)) + ( has-finitely-many-connected-components-is-π-finite K) +``` + +## References + +{{#bibliography}} + ## See also - [Unbounded π-finite types](univalent-combinatorics.unbounded-pi-finite-types.md) diff --git a/src/univalent-combinatorics/truncated-pi-finite-types.lagda.md b/src/univalent-combinatorics/truncated-pi-finite-types.lagda.md new file mode 100644 index 0000000000..17c0a8ef45 --- /dev/null +++ b/src/univalent-combinatorics/truncated-pi-finite-types.lagda.md @@ -0,0 +1,430 @@ +# Truncated π-finite types + +```agda +module univalent-combinatorics.truncated-pi-finite-types where +``` + +
Imports + +```agda +open import elementary-number-theory.natural-numbers + +open import foundation.contractible-types +open import foundation.coproduct-types +open import foundation.dependent-function-types +open import foundation.dependent-pair-types +open import foundation.empty-types +open import foundation.equality-coproduct-types +open import foundation.equivalences +open import foundation.function-extensionality +open import foundation.function-types +open import foundation.functoriality-dependent-pair-types +open import foundation.identity-types +open import foundation.maybe +open import foundation.propositional-truncations +open import foundation.propositions +open import foundation.retracts-of-types +open import foundation.set-truncations +open import foundation.sets +open import foundation.truncated-types +open import foundation.truncation-levels +open import foundation.unit-type +open import foundation.universe-levels + +open import univalent-combinatorics.coproduct-types +open import univalent-combinatorics.counting +open import univalent-combinatorics.dependent-function-types +open import univalent-combinatorics.finite-types +open import univalent-combinatorics.finitely-many-connected-components +open import univalent-combinatorics.retracts-of-finite-types +open import univalent-combinatorics.standard-finite-types +open import univalent-combinatorics.untruncated-pi-finite-types +``` + +
+ +## Idea + +A type is +{{#concept "πₙ-finite" Disambiguation="type" Agda=is-truncated-π-finite Agda=Truncated-π-Finite-Type}}, +or **n-truncated π-finite**, if it has +[finitely many connected components](univalent-combinatorics.finitely-many-connected-components.md), +all of its [homotopy groups](synthetic-homotopy-theory.homotopy-groups.md) up to +level `n` at all base points are finite, and all higher homotopy groups are +[trivial](group-theory.trivial-groups.md). Formally we define this condition +inductively: + +- A π₀-finite type is a [finite type](univalent-combinatorics.finite-types.md). +- A πₙ₊₁-finite type is a type with + [finitely many connected components](univalent-combinatorics.finitely-many-connected-components.md) + whose [identity types](foundation-core.identity-types.md) are πₙ-finite. + +## Definitions + +### The πₙ-finiteness predicate + +```agda +is-truncated-π-finite-Prop : {l : Level} (k : ℕ) → UU l → Prop l +is-truncated-π-finite-Prop zero-ℕ X = is-finite-Prop X +is-truncated-π-finite-Prop (succ-ℕ k) X = + product-Prop + ( has-finitely-many-connected-components-Prop X) + ( Π-Prop X (λ x → Π-Prop X (λ y → is-truncated-π-finite-Prop k (x = y)))) + +is-truncated-π-finite : {l : Level} (k : ℕ) → UU l → UU l +is-truncated-π-finite k A = + type-Prop (is-truncated-π-finite-Prop k A) + +is-prop-is-truncated-π-finite : + {l : Level} (k : ℕ) {A : UU l} → is-prop (is-truncated-π-finite k A) +is-prop-is-truncated-π-finite k {A} = + is-prop-type-Prop (is-truncated-π-finite-Prop k A) + +has-finitely-many-connected-components-is-truncated-π-finite : + {l : Level} (k : ℕ) {X : UU l} → + is-truncated-π-finite k X → has-finitely-many-connected-components X +has-finitely-many-connected-components-is-truncated-π-finite zero-ℕ = + has-finitely-many-connected-components-is-finite +has-finitely-many-connected-components-is-truncated-π-finite (succ-ℕ k) = pr1 + +is-truncated-π-finite-Id : + {l : Level} (k : ℕ) {X : UU l} → + is-truncated-π-finite (succ-ℕ k) X → + (x y : X) → is-truncated-π-finite k (x = y) +is-truncated-π-finite-Id k = pr2 +``` + +### πₙ-finite types are n-truncated + +```agda +is-trunc-is-truncated-π-finite : + {l : Level} (k : ℕ) {X : UU l} → + is-truncated-π-finite k X → is-trunc (truncation-level-ℕ k) X +is-trunc-is-truncated-π-finite zero-ℕ = is-set-is-finite +is-trunc-is-truncated-π-finite (succ-ℕ k) H x y = + is-trunc-is-truncated-π-finite k (is-truncated-π-finite-Id k H x y) +``` + +### πₙ-finite types are untruncated πₙ-finite + +```agda +is-untruncated-π-finite-is-truncated-π-finite : + {l : Level} (k : ℕ) {A : UU l} → + is-truncated-π-finite k A → is-untruncated-π-finite k A +is-untruncated-π-finite-is-truncated-π-finite zero-ℕ H = + is-finite-equiv + ( equiv-unit-trunc-Set (_ , (is-set-is-finite H))) + ( H) +pr1 (is-untruncated-π-finite-is-truncated-π-finite (succ-ℕ k) H) = + has-finitely-many-connected-components-is-truncated-π-finite (succ-ℕ k) H +pr2 (is-untruncated-π-finite-is-truncated-π-finite (succ-ℕ k) H) x y = + is-untruncated-π-finite-is-truncated-π-finite k + ( is-truncated-π-finite-Id k H x y) +``` + +### The subuniverse of πₙ-finite types + +```agda +Truncated-π-Finite-Type : (l : Level) (k : ℕ) → UU (lsuc l) +Truncated-π-Finite-Type l k = Σ (UU l) (is-truncated-π-finite k) + +module _ + {l : Level} (k : ℕ) (A : Truncated-π-Finite-Type l k) + where + + type-Truncated-π-Finite-Type : UU l + type-Truncated-π-Finite-Type = pr1 A + + is-truncated-π-finite-type-Truncated-π-Finite-Type : + is-truncated-π-finite k type-Truncated-π-Finite-Type + is-truncated-π-finite-type-Truncated-π-Finite-Type = pr2 A + + is-trunc-type-Truncated-π-Finite-Type : + is-trunc (truncation-level-ℕ k) type-Truncated-π-Finite-Type + is-trunc-type-Truncated-π-Finite-Type = + is-trunc-is-truncated-π-finite k + ( is-truncated-π-finite-type-Truncated-π-Finite-Type) + + is-untruncated-π-finite-type-Truncated-π-Finite-Type : + is-untruncated-π-finite k type-Truncated-π-Finite-Type + is-untruncated-π-finite-type-Truncated-π-Finite-Type = + is-untruncated-π-finite-is-truncated-π-finite k + ( is-truncated-π-finite-type-Truncated-π-Finite-Type) +``` + +## Properties + +### Untruncated πₙ-finite n-truncated types are πₙ-finite + +```agda +is-truncated-π-finite-is-untruncated-π-finite : + {l : Level} (k : ℕ) {A : UU l} → is-trunc (truncation-level-ℕ k) A → + is-untruncated-π-finite k A → is-truncated-π-finite k A +is-truncated-π-finite-is-untruncated-π-finite zero-ℕ H K = + is-finite-is-untruncated-π-finite zero-ℕ H K +pr1 (is-truncated-π-finite-is-untruncated-π-finite (succ-ℕ k) H K) = pr1 K +pr2 (is-truncated-π-finite-is-untruncated-π-finite (succ-ℕ k) H K) x y = + is-truncated-π-finite-is-untruncated-π-finite k + ( H x y) + ( is-untruncated-π-finite-Id k K x y) +``` + +### πₙ-finite types are closed under retracts + +```agda +is-truncated-π-finite-retract : + {l1 l2 : Level} (k : ℕ) {A : UU l1} {B : UU l2} → + A retract-of B → is-truncated-π-finite k B → is-truncated-π-finite k A +is-truncated-π-finite-retract zero-ℕ = is-finite-retract +pr1 (is-truncated-π-finite-retract (succ-ℕ k) r H) = + has-finitely-many-connected-components-retract r + ( has-finitely-many-connected-components-is-truncated-π-finite (succ-ℕ k) H) +pr2 (is-truncated-π-finite-retract (succ-ℕ k) r H) x y = + is-truncated-π-finite-retract k + ( retract-eq r x y) + ( is-truncated-π-finite-Id k H + ( inclusion-retract r x) + ( inclusion-retract r y)) +``` + +### πₙ-finite types are closed under equivalences + +```agda +is-truncated-π-finite-equiv : + {l1 l2 : Level} (k : ℕ) {A : UU l1} {B : UU l2} → + A ≃ B → is-truncated-π-finite k B → is-truncated-π-finite k A +is-truncated-π-finite-equiv k e = + is-truncated-π-finite-retract k (retract-equiv e) + +is-truncated-π-finite-equiv' : + {l1 l2 : Level} (k : ℕ) {A : UU l1} {B : UU l2} → + A ≃ B → is-truncated-π-finite k A → is-truncated-π-finite k B +is-truncated-π-finite-equiv' k e = + is-truncated-π-finite-retract k (retract-inv-equiv e) +``` + +### Empty types are πₙ-finite + +```agda +is-truncated-π-finite-empty : (k : ℕ) → is-truncated-π-finite k empty +is-truncated-π-finite-empty zero-ℕ = is-finite-empty +is-truncated-π-finite-empty (succ-ℕ k) = + ( has-finitely-many-connected-components-empty , ind-empty) + +empty-Truncated-π-Finite-Type : (k : ℕ) → Truncated-π-Finite-Type lzero k +empty-Truncated-π-Finite-Type k = (empty , is-truncated-π-finite-empty k) + +is-truncated-π-finite-is-empty : + {l : Level} (k : ℕ) {A : UU l} → is-empty A → is-truncated-π-finite k A +is-truncated-π-finite-is-empty zero-ℕ = is-finite-is-empty +is-truncated-π-finite-is-empty (succ-ℕ k) f = + ( has-finitely-many-connected-components-is-empty f , ex-falso ∘ f) +``` + +### Contractible types are πₙ-finite + +```agda +is-truncated-π-finite-is-contr : + {l : Level} (k : ℕ) {A : UU l} → is-contr A → is-truncated-π-finite k A +is-truncated-π-finite-is-contr zero-ℕ = + is-finite-is-contr +pr1 (is-truncated-π-finite-is-contr (succ-ℕ k) H) = + has-finitely-many-connected-components-is-contr H +pr2 (is-truncated-π-finite-is-contr (succ-ℕ k) H) x y = + is-truncated-π-finite-is-contr k (is-prop-is-contr H x y) + +is-truncated-π-finite-unit : (k : ℕ) → is-truncated-π-finite k unit +is-truncated-π-finite-unit k = + is-truncated-π-finite-is-contr k is-contr-unit + +unit-Truncated-π-Finite-Type : (k : ℕ) → Truncated-π-Finite-Type lzero k +unit-Truncated-π-Finite-Type k = + ( unit , is-truncated-π-finite-unit k) +``` + +### Coproducts of πₙ-finite types are πₙ-finite + +```agda +is-truncated-π-finite-coproduct : + {l1 l2 : Level} (k : ℕ) {A : UU l1} {B : UU l2} → + is-truncated-π-finite k A → is-truncated-π-finite k B → + is-truncated-π-finite k (A + B) +is-truncated-π-finite-coproduct k hA hB = + is-truncated-π-finite-is-untruncated-π-finite k + ( is-trunc-coproduct + ( truncation-level-minus-two-ℕ k) + ( is-trunc-is-truncated-π-finite k hA) + ( is-trunc-is-truncated-π-finite k hB)) + ( is-untruncated-π-finite-coproduct k + ( is-untruncated-π-finite-is-truncated-π-finite k hA) + ( is-untruncated-π-finite-is-truncated-π-finite k hB)) + +coproduct-Truncated-π-Finite-Type : + {l1 l2 : Level} (k : ℕ) → + Truncated-π-Finite-Type l1 k → + Truncated-π-Finite-Type l2 k → + Truncated-π-Finite-Type (l1 ⊔ l2) k +pr1 (coproduct-Truncated-π-Finite-Type k A B) = + type-Truncated-π-Finite-Type k A + type-Truncated-π-Finite-Type k B +pr2 (coproduct-Truncated-π-Finite-Type k A B) = + is-truncated-π-finite-coproduct k + ( is-truncated-π-finite-type-Truncated-π-Finite-Type k A) + ( is-truncated-π-finite-type-Truncated-π-Finite-Type k B) +``` + +### `Maybe A` of any πₙ-finite type `A` is πₙ-finite + +```agda +is-truncated-π-finite-Maybe : + {l : Level} (k : ℕ) {A : UU l} → + is-truncated-π-finite k A → is-truncated-π-finite k (Maybe A) +is-truncated-π-finite-Maybe k H = + is-truncated-π-finite-coproduct k H (is-truncated-π-finite-unit k) + +Maybe-Truncated-π-Finite-Type : + {l : Level} (k : ℕ) → + Truncated-π-Finite-Type l k → Truncated-π-Finite-Type l k +Maybe-Truncated-π-Finite-Type k (A , H) = + ( Maybe A , is-truncated-π-finite-Maybe k H) +``` + +### Any standard finite type is πₙ-finite + +```agda +is-truncated-π-finite-Fin : (k n : ℕ) → is-truncated-π-finite k (Fin n) +is-truncated-π-finite-Fin k zero-ℕ = is-truncated-π-finite-empty k +is-truncated-π-finite-Fin k (succ-ℕ n) = + is-truncated-π-finite-Maybe k (is-truncated-π-finite-Fin k n) + +Fin-Truncated-π-Finite-Type : (k : ℕ) (n : ℕ) → Truncated-π-Finite-Type lzero k +Fin-Truncated-π-Finite-Type k n = (Fin n , is-truncated-π-finite-Fin k n) +``` + +### Any type equipped with a counting is πₙ-finite + +```agda +is-truncated-π-finite-count : + {l : Level} (k : ℕ) {A : UU l} → count A → is-truncated-π-finite k A +is-truncated-π-finite-count k (n , e) = + is-truncated-π-finite-equiv' k e (is-truncated-π-finite-Fin k n) +``` + +### Any finite type is πₙ-finite + +```agda +is-truncated-π-finite-is-finite : + {l : Level} (k : ℕ) {A : UU l} → is-finite A → is-truncated-π-finite k A +is-truncated-π-finite-is-finite k {A} H = + apply-universal-property-trunc-Prop H + ( is-truncated-π-finite-Prop k A) + ( is-truncated-π-finite-count k) + +truncated-π-finite-type-Finite-Type : + {l : Level} (k : ℕ) → Finite-Type l → Truncated-π-Finite-Type l k +truncated-π-finite-type-Finite-Type k A = + ( type-Finite-Type A , + is-truncated-π-finite-is-finite k (is-finite-type-Finite-Type A)) +``` + +### πₙ-finite sets are finite + +```agda +is-finite-is-truncated-π-finite : + {l : Level} (k : ℕ) {A : UU l} → + is-set A → is-truncated-π-finite k A → is-finite A +is-finite-is-truncated-π-finite k H K = + is-finite-equiv' + ( equiv-unit-trunc-Set (_ , H)) + ( has-finitely-many-connected-components-is-truncated-π-finite k K) +``` + +### πₙ-finite types are πₙ₊₁-finite + +```agda +is-truncated-π-finite-succ-is-truncated-π-finite : + {l : Level} (k : ℕ) {A : UU l} → + is-truncated-π-finite k A → is-truncated-π-finite (succ-ℕ k) A +is-truncated-π-finite-succ-is-truncated-π-finite zero-ℕ = + is-truncated-π-finite-is-finite 1 +is-truncated-π-finite-succ-is-truncated-π-finite (succ-ℕ k) (H , K) = + ( H , (λ x y → is-truncated-π-finite-succ-is-truncated-π-finite k (K x y))) +``` + +### The type of all `n`-element types in `UU l` is π₁-finite + +```agda +is-truncated-π-finite-Type-With-Cardinality-ℕ : + {l : Level} (n : ℕ) → is-truncated-π-finite 1 (Type-With-Cardinality-ℕ l n) +is-truncated-π-finite-Type-With-Cardinality-ℕ n = + is-truncated-π-finite-is-untruncated-π-finite 1 + ( is-1-type-Type-With-Cardinality-ℕ n) + ( is-untruncated-π-finite-Type-With-Cardinality-ℕ 1 n) + +Type-With-Cardinality-ℕ-Truncated-π-Finite-Type : + (l : Level) (n : ℕ) → Truncated-π-Finite-Type (lsuc l) 1 +Type-With-Cardinality-ℕ-Truncated-π-Finite-Type l n = + ( Type-With-Cardinality-ℕ l n , + is-truncated-π-finite-Type-With-Cardinality-ℕ n) +``` + +### Finite products of πₙ-finite types are πₙ-finite + +```agda +is-truncated-π-finite-Π : + {l1 l2 : Level} (k : ℕ) {A : UU l1} {B : A → UU l2} → + is-finite A → ((a : A) → is-truncated-π-finite k (B a)) → + is-truncated-π-finite k ((a : A) → B a) +is-truncated-π-finite-Π k hA hB = + is-truncated-π-finite-is-untruncated-π-finite k + ( is-trunc-Π (truncation-level-ℕ k) (is-trunc-is-truncated-π-finite k ∘ hB)) + ( is-untruncated-π-finite-Π k hA + ( is-untruncated-π-finite-is-truncated-π-finite k ∘ hB)) + +finite-Π-Truncated-π-Finite-Type : + {l1 l2 : Level} (k : ℕ) (A : Finite-Type l1) + (B : type-Finite-Type A → Truncated-π-Finite-Type l2 k) → + Truncated-π-Finite-Type (l1 ⊔ l2) k +pr1 (finite-Π-Truncated-π-Finite-Type k A B) = + (x : type-Finite-Type A) → (type-Truncated-π-Finite-Type k (B x)) +pr2 (finite-Π-Truncated-π-Finite-Type k A B) = + is-truncated-π-finite-Π k + ( is-finite-type-Finite-Type A) + ( λ x → is-truncated-π-finite-type-Truncated-π-Finite-Type k (B x)) +``` + +### Dependent sums of πₙ-finite types are πₙ-finite + +```agda +is-truncated-π-finite-Σ : + {l1 l2 : Level} (k : ℕ) {A : UU l1} {B : A → UU l2} → + is-truncated-π-finite k A → ((a : A) → is-truncated-π-finite k (B a)) → + is-truncated-π-finite k (Σ A B) +is-truncated-π-finite-Σ k hA hB = + is-truncated-π-finite-is-untruncated-π-finite k + ( is-trunc-Σ + ( is-trunc-is-truncated-π-finite k hA) + ( is-trunc-is-truncated-π-finite k ∘ hB)) + ( is-untruncated-π-finite-Σ k + ( is-untruncated-π-finite-is-truncated-π-finite (succ-ℕ k) + ( is-truncated-π-finite-succ-is-truncated-π-finite k hA)) + ( is-untruncated-π-finite-is-truncated-π-finite k ∘ hB)) + +Σ-Truncated-π-Finite-Type : + {l1 l2 : Level} (k : ℕ) (A : Truncated-π-Finite-Type l1 k) + (B : type-Truncated-π-Finite-Type k A → Truncated-π-Finite-Type l2 k) → + Truncated-π-Finite-Type (l1 ⊔ l2) k +pr1 (Σ-Truncated-π-Finite-Type k A B) = + Σ (type-Truncated-π-Finite-Type k A) (type-Truncated-π-Finite-Type k ∘ B) +pr2 (Σ-Truncated-π-Finite-Type k A B) = + is-truncated-π-finite-Σ k + ( is-truncated-π-finite-type-Truncated-π-Finite-Type k A) + ( is-truncated-π-finite-type-Truncated-π-Finite-Type k ∘ B) +``` + +## See also + +- [Unbounded π-finite types](univalent-combinatorics.unbounded-pi-finite-types.md) + +## External links + +- [pi-finite type](https://ncatlab.org/nlab/show/pi-finite+type) at $n$Lab diff --git a/src/univalent-combinatorics/unbounded-pi-finite-types.lagda.md b/src/univalent-combinatorics/unbounded-pi-finite-types.lagda.md index 57a35f5a39..7ddf3e0635 100644 --- a/src/univalent-combinatorics/unbounded-pi-finite-types.lagda.md +++ b/src/univalent-combinatorics/unbounded-pi-finite-types.lagda.md @@ -21,6 +21,7 @@ open import foundation.equivalences open import foundation.function-types open import foundation.identity-types open import foundation.maybe +open import foundation.propositions open import foundation.retracts-of-types open import foundation.set-truncations open import foundation.sets @@ -32,8 +33,8 @@ open import univalent-combinatorics.equality-finite-types open import univalent-combinatorics.finite-types open import univalent-combinatorics.finitely-many-connected-components open import univalent-combinatorics.function-types -open import univalent-combinatorics.pi-finite-types open import univalent-combinatorics.standard-finite-types +open import univalent-combinatorics.truncated-pi-finite-types open import univalent-combinatorics.untruncated-pi-finite-types ``` @@ -44,10 +45,15 @@ open import univalent-combinatorics.untruncated-pi-finite-types A type is {{#concept "unbounded π-finite" Disambiguation="type" Agda=is-unbounded-π-finite Agda=Unbounded-Unbounded-π-Finite-Type}} if it has [finitely](univalent-combinatorics.finite-types.md) many -[connected components](foundation.connected-components.md) and all of its -homotopy groups at all base points and all dimensions are finite. Unbounded -π-finiteness can be understood as an ∞-dimensional analog of -[Kuratowski finitneness](univalent-combinatorics.kuratowski-finite-sets.md) +[connected components](foundation.connected-components.md) and, coinductively, +all of its [identity types](foundation-core.identity-types.md) are unbounded +π-finite. In other words, an unbounded π-finite type is a type that has +[finitely](univalent-combinatorics.finite-types.md) many +[connected components](foundation.connected-components.md) such that the +[homotopy groups](synthetic-homotopy-theory.homotopy-groups.md) at all base +points and all dimensions are finite. Unbounded π-finiteness can be understood +as an ∞-dimensional analog of +[Kuratowski finiteness](univalent-combinatorics.kuratowski-finite-sets.md) {{#cite Anel24}}. ## Definitions @@ -68,6 +74,25 @@ record is-unbounded-π-finite {l : Level} (X : UU l) : UU l open is-unbounded-π-finite public ``` +### The alternative predicate on types of being unbounded π-finite + +```agda +module _ + {l : Level} (A : UU l) + where + + is-unbounded-π-finite' : UU l + is-unbounded-π-finite' = (n : ℕ) → is-untruncated-π-finite n A + + is-prop-is-unbounded-π-finite' : is-prop is-unbounded-π-finite' + is-prop-is-unbounded-π-finite' = + is-prop-Π (λ n → is-prop-is-untruncated-π-finite n A) + + is-unbounded-π-finite-Prop' : Prop l + is-unbounded-π-finite-Prop' = + Π-Prop ℕ (λ n → is-untruncated-π-finite-Prop n A) +``` + ### The type of unbounded π-finite types ```agda @@ -343,57 +368,62 @@ is-finite-is-unbounded-π-finite H K = ( has-finitely-many-connected-components-is-unbounded-π-finite K) ``` -### π-finite types are unbounded π-finite - -```agda -is-unbounded-π-finite-is-π-finite : - {l : Level} (k : ℕ) {A : UU l} → - is-π-finite k A → is-unbounded-π-finite A -is-unbounded-π-finite-is-π-finite zero-ℕ = - is-unbounded-π-finite-is-finite -is-unbounded-π-finite-is-π-finite (succ-ℕ k) H = - λ where - .has-finitely-many-connected-components-is-unbounded-π-finite → - pr1 H - .is-unbounded-π-finite-Id-is-unbounded-π-finite x y → - is-unbounded-π-finite-is-π-finite k (pr2 H x y) -``` - ### Unbounded π-finite types are types that are untruncated πₙ-finite for all `n` ```agda is-unbounded-π-finite-Id-is-unbounded-π-finite' : {l : Level} {A : UU l} → - ((k : ℕ) → is-untruncated-π-finite k A) → - (x y : A) → - (k : ℕ) → is-untruncated-π-finite k (x = y) + is-unbounded-π-finite' A → (x y : A) → is-unbounded-π-finite' (x = y) is-unbounded-π-finite-Id-is-unbounded-π-finite' H x y k = pr2 (H (succ-ℕ k)) x y -is-unbounded-π-finite-is-untruncated-π-finite : +is-unbounded-π-finite-is-unbounded-π-finite' : {l : Level} {A : UU l} → - ((k : ℕ) → is-untruncated-π-finite k A) → + is-unbounded-π-finite' A → is-unbounded-π-finite A -is-unbounded-π-finite-is-untruncated-π-finite H = +is-unbounded-π-finite-is-unbounded-π-finite' H = λ where .has-finitely-many-connected-components-is-unbounded-π-finite → H 0 .is-unbounded-π-finite-Id-is-unbounded-π-finite x y → - is-unbounded-π-finite-is-untruncated-π-finite + is-unbounded-π-finite-is-unbounded-π-finite' ( is-unbounded-π-finite-Id-is-unbounded-π-finite' H x y) -is-untruncated-π-finite-is-unbounded-π-finite : +is-unbounded-π-finite'-is-unbounded-π-finite : {l : Level} {A : UU l} → is-unbounded-π-finite A → - (k : ℕ) → is-untruncated-π-finite k A -is-untruncated-π-finite-is-unbounded-π-finite H zero-ℕ = + is-unbounded-π-finite' A +is-unbounded-π-finite'-is-unbounded-π-finite H 0 = has-finitely-many-connected-components-is-unbounded-π-finite H -pr1 (is-untruncated-π-finite-is-unbounded-π-finite H (succ-ℕ k)) = - is-untruncated-π-finite-is-unbounded-π-finite H zero-ℕ -pr2 (is-untruncated-π-finite-is-unbounded-π-finite H (succ-ℕ k)) x y = - is-untruncated-π-finite-is-unbounded-π-finite +pr1 (is-unbounded-π-finite'-is-unbounded-π-finite H (succ-ℕ k)) = + is-unbounded-π-finite'-is-unbounded-π-finite H 0 +pr2 (is-unbounded-π-finite'-is-unbounded-π-finite H (succ-ℕ k)) x y = + is-unbounded-π-finite'-is-unbounded-π-finite ( is-unbounded-π-finite-Id-is-unbounded-π-finite H x y) ( k) ``` +### πₙ-finite types are unbounded π-finite + +```agda +is-unbounded-π-finite-is-truncated-π-finite : + {l : Level} (k : ℕ) {A : UU l} → + is-truncated-π-finite k A → is-unbounded-π-finite A +is-unbounded-π-finite-is-truncated-π-finite zero-ℕ = + is-unbounded-π-finite-is-finite +is-unbounded-π-finite-is-truncated-π-finite (succ-ℕ k) H = + λ where + .has-finitely-many-connected-components-is-unbounded-π-finite → + pr1 H + .is-unbounded-π-finite-Id-is-unbounded-π-finite x y → + is-unbounded-π-finite-is-truncated-π-finite k (pr2 H x y) + +is-unbounded-π-finite-is-truncated-π-finite' : + {l : Level} (k : ℕ) {A : UU l} → + is-truncated-π-finite k A → is-unbounded-π-finite' A +is-unbounded-π-finite-is-truncated-π-finite' k H = + is-unbounded-π-finite'-is-unbounded-π-finite + ( is-unbounded-π-finite-is-truncated-π-finite k H) +``` + ### Finite products of unbounded π-finite types are unbounded π-finite Agda is not convinced that the following proof is productive. @@ -426,10 +456,10 @@ is-unbounded-π-finite-Π : is-finite A → ((a : A) → is-unbounded-π-finite (B a)) → is-unbounded-π-finite ((a : A) → B a) is-unbounded-π-finite-Π H K = - is-unbounded-π-finite-is-untruncated-π-finite + is-unbounded-π-finite-is-unbounded-π-finite' ( λ k → is-untruncated-π-finite-Π k H - ( λ a → is-untruncated-π-finite-is-unbounded-π-finite (K a) k)) + ( λ a → is-unbounded-π-finite'-is-unbounded-π-finite (K a) k)) ``` ### Dependent sums of unbounded π-finite types are unbounded π-finite @@ -444,17 +474,16 @@ abstract is-unbounded-π-finite A → ((x : A) → is-unbounded-π-finite (B x)) → is-unbounded-π-finite (Σ A B) is-unbounded-π-finite-Σ H K = - is-unbounded-π-finite-is-untruncated-π-finite + is-unbounded-π-finite-is-unbounded-π-finite' ( λ k → is-untruncated-π-finite-Σ k - ( is-untruncated-π-finite-is-unbounded-π-finite H (succ-ℕ k)) - ( λ x → is-untruncated-π-finite-is-unbounded-π-finite (K x) k)) + ( is-unbounded-π-finite'-is-unbounded-π-finite H (succ-ℕ k)) + ( λ x → is-unbounded-π-finite'-is-unbounded-π-finite (K x) k)) ``` ## References -The category of unbounded π-finite spaces is considered in great detail in -{{#cite Anel24}}. +The category of unbounded π-finite spaces is studied in {{#cite Anel24}}. {{#bibliography}} diff --git a/src/univalent-combinatorics/untruncated-pi-finite-types.lagda.md b/src/univalent-combinatorics/untruncated-pi-finite-types.lagda.md index 63f9ba773a..716344eb21 100644 --- a/src/univalent-combinatorics/untruncated-pi-finite-types.lagda.md +++ b/src/univalent-combinatorics/untruncated-pi-finite-types.lagda.md @@ -65,9 +65,16 @@ open import univalent-combinatorics.standard-finite-types A type is {{#concept "untruncated πₙ-finite" Disambiguation="type" Agda=is-untruncated-π-finite Agda=Untruncated-π-Finite-Type}} -if it has [finitely](univalent-combinatorics.finite-types.md) many -[connected components](foundation.connected-components.md) and all of its -homotopy groups up to level `n` at all base points are finite. +if it has +[finitely many connected components](univalent-combinatorics.finitely-many-connected-components.md) +and all of its [homotopy groups](synthetic-homotopy-theory.homotopy-groups.md) +up to level `n` at all base points are +[finite](univalent-combinatorics.finite-types.md). However, formally we define +the condition inductively: + +- A type is untruncated π₀-finite if it has finitely many connected components. +- A type is untruncated πₙ₊₁-finite if it is untruncated π₀-finite and all its + [identity types](foundation-core.identity-types.md) are untruncated πₙ-finite. ## Definitions @@ -96,6 +103,12 @@ has-finitely-many-connected-components-is-untruncated-π-finite : has-finitely-many-connected-components-is-untruncated-π-finite zero-ℕ H = H has-finitely-many-connected-components-is-untruncated-π-finite (succ-ℕ k) H = pr1 H + +is-untruncated-π-finite-Id : + {l : Level} (k : ℕ) {A : UU l} → + is-untruncated-π-finite (succ-ℕ k) A → + (x y : A) → is-untruncated-π-finite k (x = y) +is-untruncated-π-finite-Id k = pr2 ``` ### The subuniverse untruncated πₙ-finite types @@ -116,29 +129,7 @@ is-untruncated-π-finite-type-Untruncated-π-Finite-Type k = pr2 ## Properties -### Untruncated π-finite types are closed under equivalences - -```agda -is-untruncated-π-finite-equiv : - {l1 l2 : Level} (k : ℕ) {A : UU l1} {B : UU l2} → - A ≃ B → is-untruncated-π-finite k B → is-untruncated-π-finite k A -is-untruncated-π-finite-equiv zero-ℕ = - has-finitely-many-connected-components-equiv' -pr1 (is-untruncated-π-finite-equiv (succ-ℕ k) e H) = - is-untruncated-π-finite-equiv zero-ℕ e (pr1 H) -pr2 (is-untruncated-π-finite-equiv (succ-ℕ k) e H) a b = - is-untruncated-π-finite-equiv k - ( equiv-ap e a b) - ( pr2 H (map-equiv e a) (map-equiv e b)) - -is-untruncated-π-finite-equiv' : - {l1 l2 : Level} (k : ℕ) {A : UU l1} {B : UU l2} → - A ≃ B → is-untruncated-π-finite k A → is-untruncated-π-finite k B -is-untruncated-π-finite-equiv' k e = - is-untruncated-π-finite-equiv k (inv-equiv e) -``` - -### Untruncated π-finite types are closed under retracts +### Untruncated πₙ-finite types are closed under retracts ```agda is-untruncated-π-finite-retract : @@ -154,33 +145,48 @@ pr1 (is-untruncated-π-finite-retract (succ-ℕ k) r H) = pr2 (is-untruncated-π-finite-retract (succ-ℕ k) r H) x y = is-untruncated-π-finite-retract k ( retract-eq r x y) - ( pr2 H (inclusion-retract r x) (inclusion-retract r y)) + ( is-untruncated-π-finite-Id k H + ( inclusion-retract r x) + ( inclusion-retract r y)) ``` -### Empty types are untruncated π-finite +### Untruncated πₙ-finite types are closed under equivalences + +```agda +is-untruncated-π-finite-equiv : + {l1 l2 : Level} (k : ℕ) {A : UU l1} {B : UU l2} → + A ≃ B → is-untruncated-π-finite k B → is-untruncated-π-finite k A +is-untruncated-π-finite-equiv k e = + is-untruncated-π-finite-retract k (retract-equiv e) + +is-untruncated-π-finite-equiv' : + {l1 l2 : Level} (k : ℕ) {A : UU l1} {B : UU l2} → + A ≃ B → is-untruncated-π-finite k A → is-untruncated-π-finite k B +is-untruncated-π-finite-equiv' k e = + is-untruncated-π-finite-retract k (retract-inv-equiv e) +``` + +### Empty types are untruncated πₙ-finite ```agda is-untruncated-π-finite-empty : (k : ℕ) → is-untruncated-π-finite k empty is-untruncated-π-finite-empty zero-ℕ = has-finitely-many-connected-components-empty -pr1 (is-untruncated-π-finite-empty (succ-ℕ k)) = - is-untruncated-π-finite-empty zero-ℕ -pr2 (is-untruncated-π-finite-empty (succ-ℕ k)) = ind-empty +is-untruncated-π-finite-empty (succ-ℕ k) = + ( is-untruncated-π-finite-empty zero-ℕ , ind-empty) empty-Untruncated-π-Finite-Type : (k : ℕ) → Untruncated-π-Finite-Type lzero k -pr1 (empty-Untruncated-π-Finite-Type k) = empty -pr2 (empty-Untruncated-π-Finite-Type k) = is-untruncated-π-finite-empty k +empty-Untruncated-π-Finite-Type k = (empty , is-untruncated-π-finite-empty k) is-untruncated-π-finite-is-empty : {l : Level} (k : ℕ) {A : UU l} → is-empty A → is-untruncated-π-finite k A is-untruncated-π-finite-is-empty zero-ℕ = has-finitely-many-connected-components-is-empty -pr1 (is-untruncated-π-finite-is-empty (succ-ℕ k) f) = - is-untruncated-π-finite-is-empty zero-ℕ f -pr2 (is-untruncated-π-finite-is-empty (succ-ℕ k) f) a = ex-falso (f a) +is-untruncated-π-finite-is-empty (succ-ℕ k) f = + ( is-untruncated-π-finite-is-empty zero-ℕ f , ex-falso ∘ f) ``` -### Contractible types are untruncated π-finite +### Contractible types are untruncated πₙ-finite ```agda is-untruncated-π-finite-is-contr : @@ -190,18 +196,18 @@ is-untruncated-π-finite-is-contr zero-ℕ = pr1 (is-untruncated-π-finite-is-contr (succ-ℕ k) H) = is-untruncated-π-finite-is-contr zero-ℕ H pr2 (is-untruncated-π-finite-is-contr (succ-ℕ k) H) x y = - is-untruncated-π-finite-is-contr k ( is-prop-is-contr H x y) + is-untruncated-π-finite-is-contr k (is-prop-is-contr H x y) is-untruncated-π-finite-unit : (k : ℕ) → is-untruncated-π-finite k unit is-untruncated-π-finite-unit k = is-untruncated-π-finite-is-contr k is-contr-unit unit-Untruncated-π-Finite-Type : (k : ℕ) → Untruncated-π-Finite-Type lzero k -pr1 (unit-Untruncated-π-Finite-Type k) = unit -pr2 (unit-Untruncated-π-Finite-Type k) = is-untruncated-π-finite-unit k +unit-Untruncated-π-Finite-Type k = + ( unit , is-untruncated-π-finite-unit k) ``` -### Coproducts of untruncated π-finite types are untruncated π-finite +### Coproducts of untruncated πₙ-finite types are untruncated πₙ-finite ```agda is-untruncated-π-finite-coproduct : @@ -215,7 +221,7 @@ pr1 (is-untruncated-π-finite-coproduct (succ-ℕ k) H K) = pr2 (is-untruncated-π-finite-coproduct (succ-ℕ k) H K) (inl x) (inl y) = is-untruncated-π-finite-equiv k ( compute-eq-coproduct-inl-inl x y) - ( pr2 H x y) + ( is-untruncated-π-finite-Id k H x y) pr2 (is-untruncated-π-finite-coproduct (succ-ℕ k) H K) (inl x) (inr y) = is-untruncated-π-finite-equiv k ( compute-eq-coproduct-inl-inr x y) @@ -227,7 +233,7 @@ pr2 (is-untruncated-π-finite-coproduct (succ-ℕ k) H K) (inr x) (inl y) = pr2 (is-untruncated-π-finite-coproduct (succ-ℕ k) H K) (inr x) (inr y) = is-untruncated-π-finite-equiv k ( compute-eq-coproduct-inr-inr x y) - ( pr2 K x y) + ( is-untruncated-π-finite-Id k K x y) coproduct-Untruncated-π-Finite-Type : {l1 l2 : Level} (k : ℕ) → @@ -242,24 +248,24 @@ pr2 (coproduct-Untruncated-π-Finite-Type k A B) = ( is-untruncated-π-finite-type-Untruncated-π-Finite-Type k B) ``` -### `Maybe A` of any untruncated π-finite type `A` is untruncated π-finite +### `Maybe A` of any untruncated πₙ-finite type `A` is untruncated πₙ-finite ```agda +is-untruncated-π-finite-Maybe : + {l : Level} (k : ℕ) {A : UU l} → + is-untruncated-π-finite k A → is-untruncated-π-finite k (Maybe A) +is-untruncated-π-finite-Maybe k H = + is-untruncated-π-finite-coproduct k H (is-untruncated-π-finite-unit k) + Maybe-Untruncated-π-Finite-Type : {l : Level} (k : ℕ) → Untruncated-π-Finite-Type l k → Untruncated-π-Finite-Type l k Maybe-Untruncated-π-Finite-Type k A = coproduct-Untruncated-π-Finite-Type k A (unit-Untruncated-π-Finite-Type k) - -is-untruncated-π-finite-Maybe : - {l : Level} (k : ℕ) {A : UU l} → - is-untruncated-π-finite k A → is-untruncated-π-finite k (Maybe A) -is-untruncated-π-finite-Maybe k H = - is-untruncated-π-finite-coproduct k H (is-untruncated-π-finite-unit k) ``` -### Any stanadard finite type is untruncated π-finite +### Any standard finite type is untruncated πₙ-finite ```agda is-untruncated-π-finite-Fin : @@ -271,11 +277,10 @@ is-untruncated-π-finite-Fin k (succ-ℕ n) = Fin-Untruncated-π-Finite-Type : (k : ℕ) (n : ℕ) → Untruncated-π-Finite-Type lzero k -pr1 (Fin-Untruncated-π-Finite-Type k n) = Fin n -pr2 (Fin-Untruncated-π-Finite-Type k n) = is-untruncated-π-finite-Fin k n +Fin-Untruncated-π-Finite-Type k n = (Fin n , is-untruncated-π-finite-Fin k n) ``` -### Any type equipped with a counting is untruncated π-finite +### Types equipped with a counting are untruncated πₙ-finite ```agda is-untruncated-π-finite-count : @@ -284,7 +289,7 @@ is-untruncated-π-finite-count k (n , e) = is-untruncated-π-finite-equiv' k e (is-untruncated-π-finite-Fin k n) ``` -### Any finite type is untruncated π-finite +### Finite types are untruncated πₙ-finite ```agda is-untruncated-π-finite-is-finite : @@ -294,14 +299,14 @@ is-untruncated-π-finite-is-finite k {A} H = ( is-untruncated-π-finite-Prop k A) ( is-untruncated-π-finite-count k) -π-finite-type-Finite-Type : +untruncated-π-finite-type-Finite-Type : {l : Level} (k : ℕ) → Finite-Type l → Untruncated-π-Finite-Type l k -pr1 (π-finite-type-Finite-Type k A) = type-Finite-Type A -pr2 (π-finite-type-Finite-Type k A) = +pr1 (untruncated-π-finite-type-Finite-Type k A) = type-Finite-Type A +pr2 (untruncated-π-finite-type-Finite-Type k A) = is-untruncated-π-finite-is-finite k (is-finite-type-Finite-Type A) ``` -### The type of all `n`-element types in `UU l` is untruncated π-finite +### The type of all `n`-element types in `UU l` is untruncated πₙ-finite ```agda is-untruncated-π-finite-Type-With-Cardinality-ℕ : @@ -318,6 +323,12 @@ pr2 (is-untruncated-π-finite-Type-With-Cardinality-ℕ (succ-ℕ k) n) x y = ( is-finite-type-equiv ( is-finite-has-finite-cardinality (n , pr2 x)) ( is-finite-has-finite-cardinality (n , pr2 y)))) + +Type-With-Cardinality-ℕ-Untruncated-π-Finite-Type : + (l : Level) (k n : ℕ) → Untruncated-π-Finite-Type (lsuc l) k +Type-With-Cardinality-ℕ-Untruncated-π-Finite-Type l k n = + ( Type-With-Cardinality-ℕ l n , + is-untruncated-π-finite-Type-With-Cardinality-ℕ k n) ``` ### Untruncated πₙ₊₁-finite types are untruncated πₙ-finite @@ -333,7 +344,14 @@ pr1 (is-untruncated-π-finite-is-untruncated-π-finite-succ-ℕ (succ-ℕ k) H) ( succ-ℕ (succ-ℕ k)) ( H) pr2 (is-untruncated-π-finite-is-untruncated-π-finite-succ-ℕ (succ-ℕ k) H) x y = - is-untruncated-π-finite-is-untruncated-π-finite-succ-ℕ k (pr2 H x y) + is-untruncated-π-finite-is-untruncated-π-finite-succ-ℕ k + ( is-untruncated-π-finite-Id (succ-ℕ k) H x y) + +untruncated-π-finite-type-succ-Untruncated-π-Finite-Type : + {l : Level} (k : ℕ) → + Untruncated-π-Finite-Type l (succ-ℕ k) → Untruncated-π-Finite-Type l k +untruncated-π-finite-type-succ-Untruncated-π-Finite-Type k = + tot (λ A → is-untruncated-π-finite-is-untruncated-π-finite-succ-ℕ k) ``` ### Untruncated πₙ₊₁-finite types are untruncated π₁-finite @@ -360,7 +378,7 @@ is-finite-is-untruncated-π-finite k H K = ( has-finitely-many-connected-components-is-untruncated-π-finite k K) ``` -### Finite products of untruncated π-finite types are untruncated π-finite +### Finite products of untruncated πₙ-finite types are untruncated πₙ-finite ```agda is-untruncated-π-finite-Π : @@ -374,15 +392,16 @@ pr1 (is-untruncated-π-finite-Π (succ-ℕ k) H K) = pr2 (is-untruncated-π-finite-Π (succ-ℕ k) H K) f g = is-untruncated-π-finite-equiv k ( equiv-funext) - ( is-untruncated-π-finite-Π k H (λ a → pr2 (K a) (f a) (g a))) + ( is-untruncated-π-finite-Π k H + ( λ a → is-untruncated-π-finite-Id k (K a) (f a) (g a))) -Untruncated-π-Finite-Type-Π : +finite-Π-Untruncated-π-Finite-Type : {l1 l2 : Level} (k : ℕ) (A : Finite-Type l1) (B : type-Finite-Type A → Untruncated-π-Finite-Type l2 k) → Untruncated-π-Finite-Type (l1 ⊔ l2) k -pr1 (Untruncated-π-Finite-Type-Π k A B) = - (x : type-Finite-Type A) → (type-Untruncated-π-Finite-Type k (B x)) -pr2 (Untruncated-π-Finite-Type-Π k A B) = +pr1 (finite-Π-Untruncated-π-Finite-Type k A B) = + (x : type-Finite-Type A) → type-Untruncated-π-Finite-Type k (B x) +pr2 (finite-Π-Untruncated-π-Finite-Type k A B) = is-untruncated-π-finite-Π k ( is-finite-type-Finite-Type A) ( λ x → is-untruncated-π-finite-type-Untruncated-π-Finite-Type k (B x)) @@ -633,7 +652,7 @@ abstract h = i , (is-equiv-is-emb-is-surjective is-surjective-i is-emb-i) ``` -### Dependent sums of untruncated π-finite types +### Dependent sums of untruncated πₙ-finite types The dependent sum of a family of untruncated πₙ-finite types over a untruncated πₙ₊₁-finite base is untruncated πₙ-finite. @@ -649,7 +668,9 @@ has-finitely-many-connected-components-Σ {A = A} {B} H K = ( pr1 H) ( has-finitely-many-connected-components-Prop (Σ A B)) ( λ (k , e) → - has-finitely-many-connected-components-Σ' k e (λ x y → pr2 H x y) K) + has-finitely-many-connected-components-Σ' k e + ( λ x y → is-untruncated-π-finite-Id 0 H x y) + ( K)) abstract is-untruncated-π-finite-Σ : @@ -670,19 +691,19 @@ abstract is-untruncated-π-finite-equiv k ( equiv-pair-eq-Σ (x , u) (y , v)) ( is-untruncated-π-finite-Σ k - ( pr2 H x y) - ( λ where refl → pr2 (K x) u v)) + ( is-untruncated-π-finite-Id (succ-ℕ k) H x y) + ( λ where refl → is-untruncated-π-finite-Id k (K x) u v)) -Untruncated-π-Finite-Type-Σ : +Σ-Untruncated-π-Finite-Type : {l1 l2 : Level} (k : ℕ) (A : Untruncated-π-Finite-Type l1 (succ-ℕ k)) (B : (x : type-Untruncated-π-Finite-Type (succ-ℕ k) A) → Untruncated-π-Finite-Type l2 k) → Untruncated-π-Finite-Type (l1 ⊔ l2) k -pr1 (Untruncated-π-Finite-Type-Σ k A B) = +pr1 (Σ-Untruncated-π-Finite-Type k A B) = Σ ( type-Untruncated-π-Finite-Type (succ-ℕ k) A) ( λ x → type-Untruncated-π-Finite-Type k (B x)) -pr2 (Untruncated-π-Finite-Type-Σ k A B) = +pr2 (Σ-Untruncated-π-Finite-Type k A B) = is-untruncated-π-finite-Σ k ( is-untruncated-π-finite-type-Untruncated-π-Finite-Type (succ-ℕ k) A) ( λ x → is-untruncated-π-finite-type-Untruncated-π-Finite-Type k (B x)) From 19f4f99bfdffefadefd1987c708b3dac9d61f88a Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sat, 30 Aug 2025 16:07:23 +0200 Subject: [PATCH 23/97] Fix typos in `subfinite-indexing` (#1498) --- .../subfinite-indexing.lagda.md | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/src/univalent-combinatorics/subfinite-indexing.lagda.md b/src/univalent-combinatorics/subfinite-indexing.lagda.md index 99594b4f72..4be08e1dd4 100644 --- a/src/univalent-combinatorics/subfinite-indexing.lagda.md +++ b/src/univalent-combinatorics/subfinite-indexing.lagda.md @@ -46,7 +46,8 @@ open import univalent-combinatorics.subcounting A {{#concept "subfinite indexing" Agda=subfinite-indexing}} of a type `X` is the data of a type `D` [equipped](foundation.structure.md) with a -[subcounting](univalent-combinatorics.subcounting.md) `D ↪ Fin n` and a +[subcounting](univalent-combinatorics.subcounting.md), i.e., an +[embedding](foundation-core.embeddings.md) `D ↪ Fin n`, and a [surjection](foundation.surjective-maps.md) `D ↠ X`. Note that the subcounting of `D` is _proof-relevant_, and hence having a @@ -287,28 +288,32 @@ factorization system is stable, so are the surjections. ■ > This remains to be formalized. -### Types equipped with subfinite indexings are Dedekind finite +### Types equipped with subfinite indexings are Dedekind finite {#MO433318} We reproduce a proof given by [Gro-Tsen](https://mathoverflow.net/users/17064/gro-tsen) in this MathOverflow answer: . -**Proof.** Let $X$ be a subfinitely enumerable type, witnessed by -$Fin n ↩ D ↠ X$ where $h$ is the surjection. We wish to show $X$ is Dedekind -finite, so let $f : X ↪ X$ be an arbitrary self-embedding. To conclude $f$ is an -equivalence it suffices to prove $f$ is surjective, so assume given an arbitrary -$x : X$ where we want to show there exists $z : X$ such that $f(z) = x$. - -The mapping $i ↦ fⁱ(x)$ defines a sequence of elements of $X$. By surjectivity -of $h$ each $fⁱ(x)$ merely has a representative in $D$, so by -[finite choice](univalent-combinatorics.finite-choice.md) there exists a -sequence $x₋ : D^{\operatorname{Fin}n}$ lifting $x,f(x),…,f^{n-1}(x)$. - -Now, the standard pigeonhole principle applies to $\operatorname{Fin}n$, so -there has to be $i < j$ in $\operatorname{Fin}n$ such that $xᵢ = xⱼ$, and in -particular $h(xᵢ) = h(xⱼ)$, i.e., $fⁱ(x) = fʲ(x)$. By injectivity of $f$ we can -cancel $i$ applications to obtain $x = f(f^{j-i-1}(x))$, and so $f^{j-i-1}(x)$ -is the desired preimage. ∎ +**Proof.** Let $X$ be a subfinitely indexed type, witnessed by +$\operatorname{Fin}n ↩ D ↠ X$ where $h$ is the surjection. We wish to show $X$ +is [Dedekind finite](univalent-combinatorics.dedekind-finite-types.md), so let +$f : X ↪ X$ be an arbitrary self-embedding. To conclude $f$ is an +[equivalence](foundation-core.equivalences.md) it suffices to prove $f$ is +surjective, so we want to show that given an arbitrary $x : X$ there exists a +$z : X$ such that $x = f(z)$. + +The mapping $i ↦ fⁱ(x)$ defines a [sequence](foundation.sequences.md) of +elements of $X$. By surjectivity of $h$ each $fⁱ(x)$ merely has a representative +in $D$, so by [finite choice](univalent-combinatorics.finite-choice.md) there +exists a [finite sequence](lists.finite-sequences.md) +$y₋ : \operatorname{Fin}n → D$ lifting $x,f(x),…,f^{n-1}(x)$. + +Now, the [pigeonhole principle](univalent-combinatorics.pigeonhole-principle.md) +applies to $\operatorname{Fin}n$, so there has to be $i < j$ in +$\operatorname{Fin}n$ such that $yᵢ = yⱼ$, and in particular $h(yᵢ) = h(yⱼ)$, +i.e., $fⁱ(x) = fʲ(x)$. By [injectivity](foundation-core.injective-maps.md) of +$f$ we can cancel $i$ applications to obtain $x = f(fʲ⁻ⁱ⁻¹(x))$, and so +$fʲ⁻ⁱ⁻¹(x)$ is the desired preimage. ∎ ```agda module _ @@ -428,7 +433,7 @@ module _ ## References -{{#bibliograhy}} +{{#bibliography}} ## See also From 5a609514341d4ad0a50733a5a20018a6dadc5984 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sat, 30 Aug 2025 16:09:36 +0200 Subject: [PATCH 24/97] Rebrand from "1000plus" to "Wikipedia's list of theorems" (#1356) --- references.bib | 3 +- src/literature.lagda.md | 2 +- src/literature/100-theorems.lagda.md | 9 +++-- ...md => wikipedia-list-of-theorems.lagda.md} | 36 ++++++++----------- 4 files changed, 21 insertions(+), 29 deletions(-) rename src/literature/{1000plus-theorems.lagda.md => wikipedia-list-of-theorems.lagda.md} (84%) diff --git a/references.bib b/references.bib index 3d13f5b933..86e8369e56 100644 --- a/references.bib +++ b/references.bib @@ -1,7 +1,8 @@ @online{1000+theorems, title = {1000+ theorems}, - author = {Freek Wiedijk}, + author = {1000plus}, url = {https://1000-plus.github.io/}, + citeas = {1000+}, } @online{100theorems, diff --git a/src/literature.lagda.md b/src/literature.lagda.md index 97fa876ae4..de00a4a807 100644 --- a/src/literature.lagda.md +++ b/src/literature.lagda.md @@ -10,11 +10,11 @@ module literature where open import literature.100-theorems public -open import literature.1000plus-theorems public open import literature.idempotents-in-intensional-type-theory public open import literature.introduction-to-homotopy-type-theory public open import literature.oeis public open import literature.sequential-colimits-in-homotopy-type-theory public +open import literature.wikipedia-list-of-theorems public ``` ## References diff --git a/src/literature/100-theorems.lagda.md b/src/literature/100-theorems.lagda.md index e1415c75dc..e8ffeaa895 100644 --- a/src/literature/100-theorems.lagda.md +++ b/src/literature/100-theorems.lagda.md @@ -1,9 +1,9 @@ -# Freek Wiedijk's 100 Theorems +# Wiedijk's 100 Theorems This file records formalized results from [Freek Wiedijk](http://www.cs.ru.nl/F.Wiedijk/)'s -[_Formalizing 100 Theorems_](https://www.cs.ru.nl/~freek/100/). -{{#cite 100theorems}} +[_Formalizing 100 Theorems_](https://www.cs.ru.nl/~freek/100/) +{{#cite 100theorems}}. ```agda module literature.100-theorems where @@ -155,8 +155,7 @@ open import real-numbers.distance-real-numbers using ## See also -- The spiritual successor to _Formalizing 100 Theorems_ is - [_1000+ theorems_](literature.1000plus-theorems.md), also due to Freek Wiedijk +- The spiritual successor to _Formalizing 100 Theorems_ is _1000+ theorems_ {{#cite 1000+theorems}}. ## References diff --git a/src/literature/1000plus-theorems.lagda.md b/src/literature/wikipedia-list-of-theorems.lagda.md similarity index 84% rename from src/literature/1000plus-theorems.lagda.md rename to src/literature/wikipedia-list-of-theorems.lagda.md index 2257a9effc..3677061e2a 100644 --- a/src/literature/1000plus-theorems.lagda.md +++ b/src/literature/wikipedia-list-of-theorems.lagda.md @@ -1,20 +1,20 @@ -# 1000+ theorems +# Wikipedia's list of theorems -On this page, we record formalized results in the agda-unimath library following -[Freek Wiedijk](http://www.cs.ru.nl/F.Wiedijk/) and -[collaborators](https://github.com/1000-plus)' -[_1000+ theorems_](https://1000-plus.github.io/) project -{{#cite 1000+theorems}}. This project records the formalization status of -theorems in mathematics that have their own Wikipedia entry. We welcome any -contribution to this list! +On this page, we record formalized results in the agda-unimath library that are +on Wikipedia's +[list of theorems](https://en.wikipedia.org/wiki/List_of_theorems) or have a +Wikidata entry listed as an instance of a +[theorem](https://www.wikidata.org/wiki/Q65943). Additions to this list are very +welcome! ```agda -module literature.1000plus-theorems where +module literature.wikipedia-list-of-theorems where ``` ## Formalized theorems -The theorems are ordered alphabetically, omitting definite articles ("the"). +The theorems are ordered alphabetically, omitting leading definite articles +("the"). ### Bézout's lemma {#Q513028} @@ -159,19 +159,11 @@ open import category-theory.yoneda-lemma-precategories using ( lemma-yoneda-Precategory) ``` -## See also - -- The spiritual predecessor of _1000+ theorems_ is - [_Formalizing 100 Theorems_](literature.100-theorems.md), also due to Freek - Wiedijk {{#cite 100theorems}}. - -## References - -{{#bibliography}} - ## External links - [List of theorems](https://en.wikipedia.org/wiki/List_of_theorems) on Wikipedia -- [1000+ theorems](https://1000-plus.github.io/) -- [1000-plus](https://github.com/1000-plus/1000-plus.github.io) on GitHub +- The [1000plus project](https://github.com/1000-plus)'s + [_1000+ theorems_](https://1000-plus.github.io/) aims to record formalized + results from Wikipedia's list of theorems in the 6 proof assistants Isabelle, + HOL Light, Coq/Rocq, Lean, Metamath, and Mizar. From 4191b62e8a60e882807234d8e62e6a09fca677cc Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Sat, 30 Aug 2025 07:25:11 -0700 Subject: [PATCH 25/97] Topology in metric spaces (#1474) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduces many concepts from topology, approximately following section 2.2 "Metric Spaces" of Techniques of Constructive Analysis by Bridges and Vîță but also thinking about HoTT 11.5 "Compactness of the interval," because Bridges assumes countable choice and we'd like to minimize that. Open, closed, dense, compact, totally bounded, and while we're at it a locatedness condition that allows you to turn our rational neighborhood relation based metric spaces into real-valued metric functions. Depends on #1473 and #1450 . Actual use of compactness, especially to define suprema and infima, will come later. --- references.bib | 9 + src/foundation.lagda.md | 3 + .../cartesian-products-subtypes.lagda.md | 33 ++ .../dependent-products-subtypes.lagda.md | 33 ++ src/foundation/disjoint-subtypes.lagda.md | 6 +- src/foundation/empty-subtypes.lagda.md | 103 +++++++ .../intersections-subtypes.lagda.md | 25 +- src/metric-spaces.lagda.md | 15 + ...roximations-located-metric-spaces.lagda.md | 71 +++++ .../approximations-metric-spaces.lagda.md | 79 +++++ .../cartesian-products-metric-spaces.lagda.md | 150 ++++++++++ ...sed-subsets-located-metric-spaces.lagda.md | 51 ++++ .../closed-subsets-metric-spaces.lagda.md | 282 ++++++++++++++++++ .../closure-subsets-metric-spaces.lagda.md | 123 ++++++++ .../compact-metric-spaces.lagda.md | 46 +++ .../dense-subsets-metric-spaces.lagda.md | 64 ++++ ...at-bounded-distance-metric-spaces.lagda.md | 60 ++++ .../interior-subsets-metric-spaces.lagda.md | 94 ++++++ .../located-metric-spaces.lagda.md | 180 +++++++++++ src/metric-spaces/metric-spaces.lagda.md | 10 + .../nets-located-metric-spaces.lagda.md | 55 ++++ src/metric-spaces/nets-metric-spaces.lagda.md | 53 ++++ ...pen-subsets-located-metric-spaces.lagda.md | 83 ++++++ .../open-subsets-metric-spaces.lagda.md | 280 +++++++++++++++++ .../pseudometric-spaces.lagda.md | 15 + .../subspaces-metric-spaces.lagda.md | 12 + .../totally-bounded-metric-spaces.lagda.md | 46 +++ 27 files changed, 1976 insertions(+), 5 deletions(-) create mode 100644 src/foundation/cartesian-products-subtypes.lagda.md create mode 100644 src/foundation/dependent-products-subtypes.lagda.md create mode 100644 src/foundation/empty-subtypes.lagda.md create mode 100644 src/metric-spaces/approximations-located-metric-spaces.lagda.md create mode 100644 src/metric-spaces/approximations-metric-spaces.lagda.md create mode 100644 src/metric-spaces/cartesian-products-metric-spaces.lagda.md create mode 100644 src/metric-spaces/closed-subsets-located-metric-spaces.lagda.md create mode 100644 src/metric-spaces/closed-subsets-metric-spaces.lagda.md create mode 100644 src/metric-spaces/closure-subsets-metric-spaces.lagda.md create mode 100644 src/metric-spaces/compact-metric-spaces.lagda.md create mode 100644 src/metric-spaces/dense-subsets-metric-spaces.lagda.md create mode 100644 src/metric-spaces/interior-subsets-metric-spaces.lagda.md create mode 100644 src/metric-spaces/located-metric-spaces.lagda.md create mode 100644 src/metric-spaces/nets-located-metric-spaces.lagda.md create mode 100644 src/metric-spaces/nets-metric-spaces.lagda.md create mode 100644 src/metric-spaces/open-subsets-located-metric-spaces.lagda.md create mode 100644 src/metric-spaces/open-subsets-metric-spaces.lagda.md create mode 100644 src/metric-spaces/totally-bounded-metric-spaces.lagda.md diff --git a/references.bib b/references.bib index 86e8369e56..da0e6f65ee 100644 --- a/references.bib +++ b/references.bib @@ -179,6 +179,15 @@ @book{BSCS05 langid = {hungarian}, } +@book{BV06, + title = {Techniques of Constructive Analysis}, + author = {Bridges, Douglas S. and Vîţă, Luminiţa Simona}, + year = 2006, + publisher = {Springer-Verlag New York}, + isbn = {978-0-387-33646-6}, + langid = {english}, +} + @inproceedings{BvDR18, title = {Higher {{Groups}} in {{Homotopy Type Theory}}}, author = {Buchholtz, Ulrik and van Doorn, Floris and Rijke, Egbert}, diff --git a/src/foundation.lagda.md b/src/foundation.lagda.md index 7bb7da9770..468f95fd14 100644 --- a/src/foundation.lagda.md +++ b/src/foundation.lagda.md @@ -54,6 +54,7 @@ open import foundation.cartesian-morphisms-arrows public open import foundation.cartesian-morphisms-span-diagrams public open import foundation.cartesian-product-types public open import foundation.cartesian-products-set-quotients public +open import foundation.cartesian-products-subtypes public open import foundation.category-of-families-of-sets public open import foundation.category-of-sets public open import foundation.choice-of-representatives-equivalence-relation public @@ -125,6 +126,7 @@ open import foundation.dependent-identifications public open import foundation.dependent-inverse-sequential-diagrams public open import foundation.dependent-pair-types public open import foundation.dependent-products-pullbacks public +open import foundation.dependent-products-subtypes public open import foundation.dependent-sequences public open import foundation.dependent-sums-pullbacks public open import foundation.dependent-telescopes public @@ -158,6 +160,7 @@ open import foundation.double-powersets public open import foundation.dubuc-penon-compact-types public open import foundation.effective-maps-equivalence-relations public open import foundation.embeddings public +open import foundation.empty-subtypes public open import foundation.empty-types public open import foundation.endomorphisms public open import foundation.epimorphisms public diff --git a/src/foundation/cartesian-products-subtypes.lagda.md b/src/foundation/cartesian-products-subtypes.lagda.md new file mode 100644 index 0000000000..a9a160b7be --- /dev/null +++ b/src/foundation/cartesian-products-subtypes.lagda.md @@ -0,0 +1,33 @@ +# Cartesian products of subtypes + +```agda +module foundation.cartesian-products-subtypes where +``` + +
Imports + +```agda +open import foundation.cartesian-product-types +open import foundation.conjunction +open import foundation.dependent-pair-types +open import foundation.subtypes +open import foundation.universe-levels +``` + +
+ +## Idea + +Given types `A` and `B` and subtypes `S ⊆ A` and `T ⊆ B`, a pair +`(a , b) : A × B` is in the +{{#concept "Cartesian product" disambiguation="of subtypes" WDID=Q173740 WD="Cartesian product" Agda=product-subtype}} +of `S` and `T` if `a ∈ S` and `b ∈ T`. + +## Definition + +```agda +product-subtype : + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} → + subtype l3 A → subtype l4 B → subtype (l3 ⊔ l4) (A × B) +product-subtype P Q (a , b) = P a ∧ Q b +``` diff --git a/src/foundation/dependent-products-subtypes.lagda.md b/src/foundation/dependent-products-subtypes.lagda.md new file mode 100644 index 0000000000..33e4aeca6b --- /dev/null +++ b/src/foundation/dependent-products-subtypes.lagda.md @@ -0,0 +1,33 @@ +# Dependent products of subtypes + +```agda +module foundation.dependent-products-subtypes where +``` + +
Imports + +```agda +open import foundation.propositions +open import foundation.subtypes +open import foundation.universe-levels +``` + +
+ +## Idea + +Given an indexing type `I`, a type `Aᵢ` for each `i : I`, and a +[subtype](foundation.subtypes.md) `Sᵢ ⊆ Aᵢ` for each `i : I`, a function +`f : (i : I) → Aᵢ` is in the +{{#concept "dependent product" disambiguation="of subtypes" Agda=Π-subtype}} of +the subtypes `S` if for each `i`, `f i ∈ Sᵢ`. + +## Definition + +```agda +Π-subtype : + {l1 l2 l3 : Level} {I : UU l1} {A : I → UU l2} → + ((i : I) → subtype l3 (A i)) → + subtype (l1 ⊔ l3) ((i : I) → A i) +Π-subtype {I = I} S f = Π-Prop I (λ i → S i (f i)) +``` diff --git a/src/foundation/disjoint-subtypes.lagda.md b/src/foundation/disjoint-subtypes.lagda.md index 77b37edb06..ff97abc6de 100644 --- a/src/foundation/disjoint-subtypes.lagda.md +++ b/src/foundation/disjoint-subtypes.lagda.md @@ -9,6 +9,7 @@ module foundation.disjoint-subtypes where ```agda open import foundation.cartesian-product-types open import foundation.dependent-pair-types +open import foundation.empty-subtypes open import foundation.empty-types open import foundation.intersections-subtypes open import foundation.propositions @@ -23,7 +24,7 @@ open import foundation.universe-levels Two [subtypes](foundation-core.subtypes.md) are {{#concept "disjoint" WDID=Q215382 WD="disjoint sets" Agda=disjoint-subtype}} if their [intersection](foundation.intersections-subtypes.md) is -[empty](foundation.empty-types.md). +[empty](foundation.empty-subtypes.md). ## Definition @@ -33,8 +34,7 @@ module _ where disjoint-subtype-Prop : Prop (l1 ⊔ l2 ⊔ l3) - disjoint-subtype-Prop = - Π-Prop A (λ a → is-empty-Prop (is-in-subtype B a × is-in-subtype C a)) + disjoint-subtype-Prop = is-empty-prop-subtype (intersection-subtype B C) disjoint-subtype : UU (l1 ⊔ l2 ⊔ l3) disjoint-subtype = type-Prop disjoint-subtype-Prop diff --git a/src/foundation/empty-subtypes.lagda.md b/src/foundation/empty-subtypes.lagda.md new file mode 100644 index 0000000000..5544ebeddc --- /dev/null +++ b/src/foundation/empty-subtypes.lagda.md @@ -0,0 +1,103 @@ +# Empty subtypes + +```agda +module foundation.empty-subtypes where +``` + +
Imports + +```agda +open import foundation.cartesian-product-types +open import foundation.contractible-types +open import foundation.dependent-pair-types +open import foundation.empty-types +open import foundation.equality-dependent-pair-types +open import foundation.function-extensionality +open import foundation.function-types +open import foundation.intersections-subtypes +open import foundation.negation +open import foundation.propositional-truncations +open import foundation.propositions +open import foundation.raising-universe-levels +open import foundation.subtypes +open import foundation.torsorial-type-families +open import foundation.univalence +open import foundation.universe-levels +``` + +
+ +## Idea + +A [subtype](foundation-core.subtypes.md) is an +{{#concept "empty" WDID=Q226183 WD="empty set" Agda=is-empty-subtype}} subtype +if is is [empty](foundation.empty-types.md) as a type. + +## Definition + +```agda +module _ + {l1 l2 : Level} {X : UU l1} (S : subtype l2 X) + where + + is-empty-prop-subtype : Prop (l1 ⊔ l2) + is-empty-prop-subtype = Π-Prop X (λ x → ¬' (S x)) + + is-empty-subtype : UU (l1 ⊔ l2) + is-empty-subtype = type-Prop is-empty-prop-subtype + +empty-subtype : {l : Level} (l2 : Level) (X : UU l) → subtype l2 X +empty-subtype l2 _ _ = raise-empty-Prop l2 + +is-empty-subtype-empty-subtype : + {l1 l2 : Level} (X : UU l1) → is-empty-subtype (empty-subtype l2 X) +is-empty-subtype-empty-subtype X x = map-inv-raise +``` + +## Properties + +### A subtype is empty iff its type is empty + +```agda +module _ + {l1 l2 : Level} {X : UU l1} (S : subtype l2 X) + where + + is-empty-type-empty-subtype : is-empty-subtype S → is-empty (type-subtype S) + is-empty-type-empty-subtype is-empty-S (x , x∈S) = is-empty-S x x∈S + + is-empty-subtype-is-empty-type-subtype : + is-empty (type-subtype S) → is-empty-subtype S + is-empty-subtype-is-empty-type-subtype is-empty-type-S x x∈S = + is-empty-type-S (x , x∈S) +``` + +### Empty subtypes at a given level are torsorial + +```agda +module _ + {l1 : Level} (l2 : Level) (X : UU l1) + where + + abstract + is-torsorial-is-empty-subtype : + is-torsorial (is-empty-subtype {l2 = l2} {X = X}) + is-torsorial-is-empty-subtype = + ( (empty-subtype l2 X , is-empty-subtype-empty-subtype X) , + λ (S , is-empty-S) → + eq-pair-Σ + ( eq-has-same-elements-subtype _ _ + ( λ x → (ex-falso ∘ map-inv-raise , map-raise ∘ is-empty-S x))) + ( eq-is-prop (is-prop-type-Prop (is-empty-prop-subtype {X = X} S)))) +``` + +### The empty subtype is contained in all other subtypes + +```agda +module _ + {l1 l2 : Level} (l3 : Level) {X : UU l1} (S : subtype l2 X) + where + + empty-subtype-leq-subtype : empty-subtype l3 X ⊆ S + empty-subtype-leq-subtype x (map-raise ⊥) = ex-falso ⊥ +``` diff --git a/src/foundation/intersections-subtypes.lagda.md b/src/foundation/intersections-subtypes.lagda.md index 3ff9cc3f3b..a540dc76d6 100644 --- a/src/foundation/intersections-subtypes.lagda.md +++ b/src/foundation/intersections-subtypes.lagda.md @@ -10,6 +10,7 @@ module foundation.intersections-subtypes where open import foundation.conjunction open import foundation.decidable-subtypes open import foundation.dependent-pair-types +open import foundation.inhabited-subtypes open import foundation.large-locale-of-subtypes open import foundation.powersets open import foundation.universe-levels @@ -25,8 +26,14 @@ open import order-theory.greatest-lower-bounds-large-posets ## Idea -The intersection of two subtypes `A` and `B` is the subtype that contains the -elements that are in `A` and in `B`. +The +{{#concept "intersection" disambiguation="of two subtypes" WDID=Q185837 WD="intersection" Agda=intersection-subtype}} +of two [subtypes](foundation.subtypes.md) `A` and `B` is the subtype that +contains the elements that are in `A` [and](foundation.conjunction.md) in `B`. + +Two subtypes +{{#concept "intersect" disambiguation="subtypes" Agda=intersect-subtype}} if +their intersection is [inhabited](foundation.inhabited-subtypes.md). ## Definition @@ -85,3 +92,17 @@ module _ {I : UU l2} (P : I → subtype l3 X) → subtype (l2 ⊔ l3) X intersection-family-of-subtypes {I} P x = Π-Prop I (λ i → P i x) ``` + +### Whether two subtypes intersect + +```agda +module _ + {l1 l2 l3 : Level} {X : UU l1} (P : subtype l2 X) (Q : subtype l3 X) + where + + intersect-prop-subtype : Prop (l1 ⊔ l2 ⊔ l3) + intersect-prop-subtype = is-inhabited-subtype-Prop (intersection-subtype P Q) + + intersect-subtype : UU (l1 ⊔ l2 ⊔ l3) + intersect-subtype = type-Prop intersect-prop-subtype +``` diff --git a/src/metric-spaces.lagda.md b/src/metric-spaces.lagda.md index 63dca9f747..4fb7769770 100644 --- a/src/metric-spaces.lagda.md +++ b/src/metric-spaces.lagda.md @@ -45,16 +45,24 @@ property of **indistinguishability of identicals** ```agda module metric-spaces where +open import metric-spaces.approximations-located-metric-spaces public +open import metric-spaces.approximations-metric-spaces public +open import metric-spaces.cartesian-products-metric-spaces public open import metric-spaces.category-of-metric-spaces-and-isometries public open import metric-spaces.category-of-metric-spaces-and-short-functions public open import metric-spaces.cauchy-approximations-metric-spaces public open import metric-spaces.cauchy-approximations-pseudometric-spaces public open import metric-spaces.cauchy-sequences-complete-metric-spaces public open import metric-spaces.cauchy-sequences-metric-spaces public +open import metric-spaces.closed-subsets-located-metric-spaces public +open import metric-spaces.closed-subsets-metric-spaces public +open import metric-spaces.closure-subsets-metric-spaces public +open import metric-spaces.compact-metric-spaces public open import metric-spaces.complete-metric-spaces public open import metric-spaces.continuous-functions-metric-spaces public open import metric-spaces.convergent-cauchy-approximations-metric-spaces public open import metric-spaces.convergent-sequences-metric-spaces public +open import metric-spaces.dense-subsets-metric-spaces public open import metric-spaces.dependent-products-metric-spaces public open import metric-spaces.discrete-metric-spaces public open import metric-spaces.elements-at-bounded-distance-metric-spaces public @@ -66,6 +74,7 @@ open import metric-spaces.functions-pseudometric-spaces public open import metric-spaces.functor-category-set-functions-isometry-metric-spaces public open import metric-spaces.functor-category-short-isometry-metric-spaces public open import metric-spaces.indexed-sums-metric-spaces public +open import metric-spaces.interior-subsets-metric-spaces public open import metric-spaces.isometries-metric-spaces public open import metric-spaces.isometries-pseudometric-spaces public open import metric-spaces.limits-of-cauchy-approximations-metric-spaces public @@ -74,6 +83,7 @@ open import metric-spaces.limits-of-functions-metric-spaces public open import metric-spaces.limits-of-sequences-metric-spaces public open import metric-spaces.lipschitz-functions-metric-spaces public open import metric-spaces.locally-constant-functions-metric-spaces public +open import metric-spaces.located-metric-spaces public open import metric-spaces.metric-space-of-cauchy-approximations-complete-metric-spaces public open import metric-spaces.metric-space-of-cauchy-approximations-metric-spaces public open import metric-spaces.metric-space-of-convergent-cauchy-approximations-metric-spaces public @@ -85,6 +95,10 @@ open import metric-spaces.metric-space-of-rational-numbers public open import metric-spaces.metric-space-of-short-functions-metric-spaces public open import metric-spaces.metric-spaces public open import metric-spaces.monotonic-rational-neighborhood-relations public +open import metric-spaces.nets-located-metric-spaces public +open import metric-spaces.nets-metric-spaces public +open import metric-spaces.open-subsets-located-metric-spaces public +open import metric-spaces.open-subsets-metric-spaces public open import metric-spaces.poset-of-rational-neighborhood-relations public open import metric-spaces.precategory-of-metric-spaces-and-functions public open import metric-spaces.precategory-of-metric-spaces-and-isometries public @@ -103,6 +117,7 @@ open import metric-spaces.short-functions-pseudometric-spaces public open import metric-spaces.similarity-of-elements-pseudometric-spaces public open import metric-spaces.subspaces-metric-spaces public open import metric-spaces.symmetric-rational-neighborhood-relations public +open import metric-spaces.totally-bounded-metric-spaces public open import metric-spaces.triangular-rational-neighborhood-relations public open import metric-spaces.uniformly-continuous-functions-metric-spaces public ``` diff --git a/src/metric-spaces/approximations-located-metric-spaces.lagda.md b/src/metric-spaces/approximations-located-metric-spaces.lagda.md new file mode 100644 index 0000000000..de883b20ad --- /dev/null +++ b/src/metric-spaces/approximations-located-metric-spaces.lagda.md @@ -0,0 +1,71 @@ +# Approximations in located metric spaces + +```agda +module metric-spaces.approximations-located-metric-spaces where +``` + +
Imports + +```agda +open import elementary-number-theory.positive-rational-numbers + +open import foundation.dependent-pair-types +open import foundation.full-subtypes +open import foundation.propositions +open import foundation.subtypes +open import foundation.unions-subtypes +open import foundation.universe-levels + +open import metric-spaces.approximations-metric-spaces +open import metric-spaces.located-metric-spaces +open import metric-spaces.metric-spaces +open import metric-spaces.subspaces-metric-spaces +``` + +
+ +## Idea + +For an `ε : ℚ⁺`, an +`ε`-{{#concept "approximation" disambiguation="of a located metric space" Agda=approximation-Located-Metric-Space}} +of a [located metric space](metric-spaces.located-metric-spaces.md) `X` is an +[`ε`-approximation](metric-spaces.approximations-metric-spaces.md) in the +corresponding [metric space](metric-spaces.metric-spaces.md) + +## Definition + +```agda +module _ + {l1 l2 l3 : Level} (X : Located-Metric-Space l1 l2) (ε : ℚ⁺) + (S : subset-Located-Metric-Space l3 X) + where + + is-approximation-prop-Located-Metric-Space : Prop (l1 ⊔ l2 ⊔ l3) + is-approximation-prop-Located-Metric-Space = + is-approximation-prop-Metric-Space + ( metric-space-Located-Metric-Space X) + ( ε) + ( S) + + is-approximation-Located-Metric-Space : UU (l1 ⊔ l2 ⊔ l3) + is-approximation-Located-Metric-Space = + type-Prop is-approximation-prop-Located-Metric-Space + +approximation-Located-Metric-Space : + {l1 l2 : Level} (l3 : Level) (X : Located-Metric-Space l1 l2) (ε : ℚ⁺) → + UU (l1 ⊔ l2 ⊔ lsuc l3) +approximation-Located-Metric-Space l3 X = + approximation-Metric-Space l3 (metric-space-Located-Metric-Space X) + +module _ + {l1 l2 l3 : Level} (X : Located-Metric-Space l1 l2) (ε : ℚ⁺) + (S : approximation-Located-Metric-Space l3 X ε) + where + + subset-approximation-Located-Metric-Space : subset-Located-Metric-Space l3 X + subset-approximation-Located-Metric-Space = pr1 S + + type-approximation-Located-Metric-Space : UU (l1 ⊔ l3) + type-approximation-Located-Metric-Space = + type-subtype subset-approximation-Located-Metric-Space +``` diff --git a/src/metric-spaces/approximations-metric-spaces.lagda.md b/src/metric-spaces/approximations-metric-spaces.lagda.md new file mode 100644 index 0000000000..894203a484 --- /dev/null +++ b/src/metric-spaces/approximations-metric-spaces.lagda.md @@ -0,0 +1,79 @@ +# Approximations in metric spaces + +```agda +module metric-spaces.approximations-metric-spaces where +``` + +
Imports + +```agda +open import elementary-number-theory.positive-rational-numbers + +open import foundation.dependent-pair-types +open import foundation.full-subtypes +open import foundation.propositions +open import foundation.subtypes +open import foundation.unions-subtypes +open import foundation.universe-levels + +open import metric-spaces.located-metric-spaces +open import metric-spaces.metric-spaces +open import metric-spaces.subspaces-metric-spaces +``` + +
+ +## Idea + +For an `ε : ℚ⁺`, an +`ε`-{{#concept "approximation" disambiguation="of a metric space" Agda=approximation-Metric-Space}} +of a [metric space](metric-spaces.metric-spaces.md) `X` is a +[subset](foundation.subtypes.md) `S` of `X` such that every point in `X` is in +an `ε`-neighborhood of some `s ∈ S`. + +This terminology is taken from {{#cite BV06}} section 2.2. + +A [finitely enumerable](univalent-combinatorics.finitely-enumerable-types.md) +`ε`-approximation is called an [`ε`-net](metric-spaces.nets-metric-spaces.md). + +## Definitions + +```agda +module _ + {l1 l2 l3 : Level} (X : Metric-Space l1 l2) (ε : ℚ⁺) + (S : subset-Metric-Space l3 X) + where + + is-approximation-prop-Metric-Space : Prop (l1 ⊔ l2 ⊔ l3) + is-approximation-prop-Metric-Space = + is-full-subtype-Prop + ( union-family-of-subtypes + { I = type-subtype S} + ( λ (s , s∈S) → neighborhood-prop-Metric-Space X ε s)) + + is-approximation-Metric-Space : UU (l1 ⊔ l2 ⊔ l3) + is-approximation-Metric-Space = + type-Prop is-approximation-prop-Metric-Space + +approximation-Metric-Space : + {l1 l2 : Level} (l3 : Level) (X : Metric-Space l1 l2) (ε : ℚ⁺) → + UU (l1 ⊔ l2 ⊔ lsuc l3) +approximation-Metric-Space l3 X ε = + type-subtype (is-approximation-prop-Metric-Space {l3 = l3} X ε) + +module _ + {l1 l2 l3 : Level} (X : Metric-Space l1 l2) (ε : ℚ⁺) + (S : approximation-Metric-Space l3 X ε) + where + + subset-approximation-Metric-Space : subset-Metric-Space l3 X + subset-approximation-Metric-Space = pr1 S + + type-approximation-Metric-Space : UU (l1 ⊔ l3) + type-approximation-Metric-Space = + type-subtype subset-approximation-Metric-Space +``` + +## References + +{{#bibliography}} diff --git a/src/metric-spaces/cartesian-products-metric-spaces.lagda.md b/src/metric-spaces/cartesian-products-metric-spaces.lagda.md new file mode 100644 index 0000000000..db8afa4be6 --- /dev/null +++ b/src/metric-spaces/cartesian-products-metric-spaces.lagda.md @@ -0,0 +1,150 @@ +# Cartesian products of metric spaces + +```agda +module metric-spaces.cartesian-products-metric-spaces where +``` + +
Imports + +```agda +open import foundation.cartesian-product-types +open import foundation.conjunction +open import foundation.dependent-pair-types +open import foundation.equality-cartesian-product-types +open import foundation.evaluation-functions +open import foundation.function-extensionality +open import foundation.function-types +open import foundation.functoriality-cartesian-product-types +open import foundation.propositions +open import foundation.sets +open import foundation.universe-levels + +open import metric-spaces.cauchy-approximations-metric-spaces +open import metric-spaces.complete-metric-spaces +open import metric-spaces.convergent-cauchy-approximations-metric-spaces +open import metric-spaces.extensionality-pseudometric-spaces +open import metric-spaces.limits-of-cauchy-approximations-metric-spaces +open import metric-spaces.metric-spaces +open import metric-spaces.monotonic-rational-neighborhood-relations +open import metric-spaces.pseudometric-spaces +open import metric-spaces.rational-neighborhood-relations +open import metric-spaces.reflexive-rational-neighborhood-relations +open import metric-spaces.saturated-rational-neighborhood-relations +open import metric-spaces.short-functions-metric-spaces +open import metric-spaces.symmetric-rational-neighborhood-relations +open import metric-spaces.triangular-rational-neighborhood-relations +``` + +
+ +## Idea + +For any two [metric spaces](metric-spaces.metric-spaces.md) `X`, `Y`, there is a +{{#concept "cartesian product metric space" Agda=product-Metric-Space}} `X × Y`. +Pairs `(x₁ , y₁)` and `(x₂ , y₂)` are in a +[`d`-neighborhood](metric-spaces.rational-neighborhood-relations.md) in the +product structure if `x₁` and `x₂` are in a `d`-neighborhood and `y₁` and `y₂` +are in a `d`-neighborhood. + +This metric is not canonical, but is consistent with the +[dependent product of metric spaces](metric-spaces.dependent-products-metric-spaces.md). + +## Definition + +```agda +module _ + {l1 l2 l3 l4 : Level} (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) + where + + type-product-Metric-Space : UU (l1 ⊔ l3) + type-product-Metric-Space = type-Metric-Space X × type-Metric-Space Y + + neighborhood-prop-product-Metric-Space : + Rational-Neighborhood-Relation (l2 ⊔ l4) type-product-Metric-Space + neighborhood-prop-product-Metric-Space ε (x₁ , y₁) (x₂ , y₂) = + neighborhood-prop-Metric-Space X ε x₁ x₂ ∧ + neighborhood-prop-Metric-Space Y ε y₁ y₂ + + refl-neighborhood-product-Metric-Space : + is-reflexive-Rational-Neighborhood-Relation + neighborhood-prop-product-Metric-Space + refl-neighborhood-product-Metric-Space ε (x , y) = + refl-neighborhood-Metric-Space X ε x , + refl-neighborhood-Metric-Space Y ε y + + symmetric-neighborhood-product-Metric-Space : + is-symmetric-Rational-Neighborhood-Relation + neighborhood-prop-product-Metric-Space + symmetric-neighborhood-product-Metric-Space + ε (x₁ , y₁) (x₂ , y₂) = + map-product + ( symmetric-neighborhood-Metric-Space X ε x₁ x₂) + ( symmetric-neighborhood-Metric-Space Y ε y₁ y₂) + + triangular-neighborhood-product-Metric-Space : + is-triangular-Rational-Neighborhood-Relation + neighborhood-prop-product-Metric-Space + triangular-neighborhood-product-Metric-Space + (x₁ , y₁) (x₂ , y₂) (x₃ , y₃) d12 d23 (Ndx23 , Ndy23) (Ndx12 , Ndy12) = + triangular-neighborhood-Metric-Space X x₁ x₂ x₃ d12 d23 Ndx23 Ndx12 , + triangular-neighborhood-Metric-Space Y y₁ y₂ y₃ d12 d23 Ndy23 Ndy12 + + saturated-neighborhood-product-Metric-Space : + is-saturated-Rational-Neighborhood-Relation + neighborhood-prop-product-Metric-Space + saturated-neighborhood-product-Metric-Space ε (x₁ , y₁) (x₂ , y₂) H = + saturated-neighborhood-Metric-Space X ε x₁ x₂ (pr1 ∘ H) , + saturated-neighborhood-Metric-Space Y ε y₁ y₂ (pr2 ∘ H) + + pseudometric-space-product-Metric-Space : + Pseudometric-Space (l1 ⊔ l3) (l2 ⊔ l4) + pseudometric-space-product-Metric-Space = + type-product-Metric-Space , + neighborhood-prop-product-Metric-Space , + refl-neighborhood-product-Metric-Space , + symmetric-neighborhood-product-Metric-Space , + triangular-neighborhood-product-Metric-Space , + saturated-neighborhood-product-Metric-Space + + is-extensional-pseudometric-space-product-Metric-Space : + is-extensional-Pseudometric-Space + pseudometric-space-product-Metric-Space + is-extensional-pseudometric-space-product-Metric-Space = + is-extensional-is-tight-Pseudometric-Space + ( pseudometric-space-product-Metric-Space) + ( λ (x₁ , y₁) (x₂ , y₂) H → + eq-pair + ( eq-sim-Metric-Space X x₁ x₂ (pr1 ∘ H)) + ( eq-sim-Metric-Space Y y₁ y₂ (pr2 ∘ H))) + + product-Metric-Space : Metric-Space (l1 ⊔ l3) (l2 ⊔ l4) + product-Metric-Space = + make-Metric-Space + type-product-Metric-Space + neighborhood-prop-product-Metric-Space + refl-neighborhood-product-Metric-Space + symmetric-neighborhood-product-Metric-Space + triangular-neighborhood-product-Metric-Space + saturated-neighborhood-product-Metric-Space + is-extensional-pseudometric-space-product-Metric-Space +``` + +## Properties + +### The projection maps are short + +```agda + is-short-pr1-product-Metric-Space : + is-short-function-Metric-Space + ( product-Metric-Space) + ( X) + ( pr1) + is-short-pr1-product-Metric-Space _ _ _ = pr1 + + is-short-pr2-product-Metric-Space : + is-short-function-Metric-Space + ( product-Metric-Space) + ( Y) + ( pr2) + is-short-pr2-product-Metric-Space _ _ _ = pr2 +``` diff --git a/src/metric-spaces/closed-subsets-located-metric-spaces.lagda.md b/src/metric-spaces/closed-subsets-located-metric-spaces.lagda.md new file mode 100644 index 0000000000..59906ef209 --- /dev/null +++ b/src/metric-spaces/closed-subsets-located-metric-spaces.lagda.md @@ -0,0 +1,51 @@ +# Closed subsets of located metric spaces + +```agda +module metric-spaces.closed-subsets-located-metric-spaces where +``` + +
Imports + +```agda +open import foundation.propositions +open import foundation.universe-levels + +open import metric-spaces.closed-subsets-metric-spaces +open import metric-spaces.located-metric-spaces +open import metric-spaces.metric-spaces +``` + +
+ +## Idea + +A [subset](foundation.subtypes.md) `S` of a +[located metric space](metric-spaces.located-metric-spaces.md) `X` is +{{#concept "closed" disambiguation="subset of a located metric space" WDID=Q320357 WD="closed set" Agda=is-closed-subset-Located-Metric-Space}} +if it is a [closed subset](metric-spaces.closed-subsets-metric-spaces.md) of the +underlying [metric space](metric-spaces.metric-spaces.md) + +## Definition + +```agda +module _ + {l1 l2 l3 : Level} + (X : Located-Metric-Space l1 l2) (S : subset-Located-Metric-Space l3 X) + where + + is-closed-prop-subset-Located-Metric-Space : Prop (l1 ⊔ l2 ⊔ l3) + is-closed-prop-subset-Located-Metric-Space = + is-closed-prop-subset-Metric-Space + ( metric-space-Located-Metric-Space X) + ( S) + + is-closed-subset-Located-Metric-Space : UU (l1 ⊔ l2 ⊔ l3) + is-closed-subset-Located-Metric-Space = + type-Prop is-closed-prop-subset-Located-Metric-Space + +closed-subset-Located-Metric-Space : + {l1 l2 : Level} (l3 : Level) + (X : Located-Metric-Space l1 l2) → UU (l1 ⊔ l2 ⊔ lsuc l3) +closed-subset-Located-Metric-Space l3 X = + closed-subset-Metric-Space l3 (metric-space-Located-Metric-Space X) +``` diff --git a/src/metric-spaces/closed-subsets-metric-spaces.lagda.md b/src/metric-spaces/closed-subsets-metric-spaces.lagda.md new file mode 100644 index 0000000000..f4eb5e1a66 --- /dev/null +++ b/src/metric-spaces/closed-subsets-metric-spaces.lagda.md @@ -0,0 +1,282 @@ +# Closed subsets of metric spaces + +```agda +module metric-spaces.closed-subsets-metric-spaces where +``` + +
Imports + +```agda +open import elementary-number-theory.positive-rational-numbers + +open import foundation.complements-subtypes +open import foundation.dependent-pair-types +open import foundation.dependent-products-subtypes +open import foundation.disjunction +open import foundation.empty-types +open import foundation.existential-quantification +open import foundation.function-types +open import foundation.intersections-subtypes +open import foundation.propositional-truncations +open import foundation.propositions +open import foundation.raising-universe-levels +open import foundation.sets +open import foundation.subtypes +open import foundation.transport-along-identifications +open import foundation.unit-type +open import foundation.universe-levels + +open import logic.functoriality-existential-quantification + +open import metric-spaces.cauchy-approximations-metric-spaces +open import metric-spaces.closure-subsets-metric-spaces +open import metric-spaces.complete-metric-spaces +open import metric-spaces.dense-subsets-metric-spaces +open import metric-spaces.dependent-products-metric-spaces +open import metric-spaces.discrete-metric-spaces +open import metric-spaces.metric-spaces +open import metric-spaces.open-subsets-metric-spaces +open import metric-spaces.subspaces-metric-spaces +``` + +
+ +## Idea + +A [subset](foundation.subtypes.md) `S` of a +[metric space](metric-spaces.metric-spaces.md) `X` is +{{#concept "closed" disambiguation="subset of a metric space" WDID=Q320357 WD="closed set" Agda=is-closed-subset-Metric-Space}} +if its [closure](metric-spaces.closure-subsets-metric-spaces.md) is a subset of +`S`. + +## Definition + +```agda +module _ + {l1 l2 l3 : Level} (X : Metric-Space l1 l2) (S : subset-Metric-Space l3 X) + where + + is-closed-prop-subset-Metric-Space : Prop (l1 ⊔ l2 ⊔ l3) + is-closed-prop-subset-Metric-Space = + leq-prop-subtype (closure-subset-Metric-Space X S) S + + is-closed-subset-Metric-Space : UU (l1 ⊔ l2 ⊔ l3) + is-closed-subset-Metric-Space = type-Prop is-closed-prop-subset-Metric-Space + +closed-subset-Metric-Space : + {l1 l2 : Level} (l3 : Level) (X : Metric-Space l1 l2) → UU (l1 ⊔ l2 ⊔ lsuc l3) +closed-subset-Metric-Space l3 X = + type-subtype (is-closed-prop-subset-Metric-Space {l3 = l3} X) + +module _ + {l1 l2 l3 : Level} (X : Metric-Space l1 l2) + (S : closed-subset-Metric-Space l3 X) + where + + subset-closed-subset-Metric-Space : subset-Metric-Space l3 X + subset-closed-subset-Metric-Space = pr1 S + + is-closed-subset-closed-subset-Metric-Space : + is-closed-subset-Metric-Space X subset-closed-subset-Metric-Space + is-closed-subset-closed-subset-Metric-Space = pr2 S +``` + +## Properties + +### If a set is closed, its closure has the same elements as itself + +```agda +module _ + {l1 l2 : Level} (X : Metric-Space l1 l2) + where + + has-same-elements-closure-closed-subset-Metric-Space : + {l3 : Level} (S : closed-subset-Metric-Space l3 X) → + has-same-elements-subtype + ( subset-closed-subset-Metric-Space X S) + ( closure-subset-Metric-Space X (subset-closed-subset-Metric-Space X S)) + pr1 (has-same-elements-closure-closed-subset-Metric-Space (S , closed-S) x) = + is-subset-closure-subset-Metric-Space X S x + pr2 (has-same-elements-closure-closed-subset-Metric-Space (S , closed-S) x) = + closed-S x +``` + +### The empty set is closed + +```agda +module _ + {l1 l2 : Level} (X : Metric-Space l1 l2) + where + + is-closed-empty-subset-Metric-Space : + is-closed-subset-Metric-Space X (empty-subset-Metric-Space X) + is-closed-empty-subset-Metric-Space x x∈closure = + map-raise (is-empty-closure-empty-subset-Metric-Space X x x∈closure) +``` + +### A metric space is closed in itself + +```agda + is-closed-full-subset-Metric-Space : + is-closed-subset-Metric-Space X (full-subset-Metric-Space X) + is-closed-full-subset-Metric-Space x _ = map-raise star +``` + +### Every subset of a discrete metric space is closed + +```agda +module _ + {l1 l2 l3 : Level} (X : Discrete-Metric-Space l1 l2) + where + + is-closed-subset-Discrete-Metric-Space : + (S : subtype l3 (type-Discrete-Metric-Space X)) → + is-closed-subset-Metric-Space + ( metric-space-Discrete-Metric-Space X) + ( S) + is-closed-subset-Discrete-Metric-Space S x x∈closure = + let open do-syntax-trunc-Prop (S x) + in do + (y , y∈N1x , y∈S) ← x∈closure one-ℚ⁺ + inv-tr + ( type-Prop ∘ S) + ( is-discrete-metric-space-Discrete-Metric-Space X one-ℚ⁺ x y y∈N1x) + ( y∈S) +``` + +### The intersection of a family of closed subsets is closed + +```agda +module _ + {l1 l2 l3 l4 : Level} (X : Metric-Space l1 l2) + {I : UU l3} (F : I → closed-subset-Metric-Space l4 X) + where + + subset-intersection-family-closed-subset-Metric-Space : + subset-Metric-Space (l3 ⊔ l4) X + subset-intersection-family-closed-subset-Metric-Space = + intersection-family-of-subtypes + ( λ i → subset-closed-subset-Metric-Space X (F i)) + + abstract + is-closed-subset-intersection-family-closed-subset-Metric-Space : + is-closed-subset-Metric-Space + ( X) + ( subset-intersection-family-closed-subset-Metric-Space) + is-closed-subset-intersection-family-closed-subset-Metric-Space x x∈cl i = + is-closed-subset-closed-subset-Metric-Space X (F i) x + ( λ ε → map-tot-exists (λ _ (y∈Nεx , y∈F) → (y∈Nεx , y∈F i)) (x∈cl ε)) + + intersection-family-closed-subset-Metric-Space : + closed-subset-Metric-Space (l3 ⊔ l4) X + intersection-family-closed-subset-Metric-Space = + ( subset-intersection-family-closed-subset-Metric-Space , + is-closed-subset-intersection-family-closed-subset-Metric-Space) +``` + +### If the union of two closed sets is always closed, then LLPO holds + +This has yet to be formalized. + +### In a metric space, the complement of an open metric space is closed + +```agda +module _ + {l1 l2 l3 : Level} (X : Metric-Space l1 l2) + (S : open-subset-Metric-Space l3 X) + where + + subset-complement-open-subset-Metric-Space : + subset-Metric-Space l3 X + subset-complement-open-subset-Metric-Space = + complement-subtype (subset-open-subset-Metric-Space X S) + + is-closed-subset-complement-open-subset-Metric-Space : + is-closed-subset-Metric-Space + ( X) + ( subset-complement-open-subset-Metric-Space) + is-closed-subset-complement-open-subset-Metric-Space x x∈cl-¬S x∈S = + let open do-syntax-trunc-Prop empty-Prop + in do + (ε , Nεx⊆S) ← is-open-subset-open-subset-Metric-Space X S x x∈S + (y , y∈Nεx , y∈¬S) ← x∈cl-¬S ε + y∈¬S (Nεx⊆S y y∈Nεx) +``` + +To prove: the converse implies a constructive taboo. + +### The dependent product of closed subsets is closed in the product metric space + +```agda +module _ + {l1 l2 l3 l4 : Level} {I : UU l1} (X : I → Metric-Space l2 l3) + (C : (i : I) → closed-subset-Metric-Space l4 (X i)) + where + + subset-Π-closed-subset-Metric-Space : + subset-Metric-Space (l1 ⊔ l4) (Π-Metric-Space I X) + subset-Π-closed-subset-Metric-Space = + Π-subtype (λ i → subset-closed-subset-Metric-Space (X i) (C i)) + + is-closed-subset-Π-closed-subset-Metric-Space : + is-closed-subset-Metric-Space + ( Π-Metric-Space I X) + ( subset-Π-closed-subset-Metric-Space) + is-closed-subset-Π-closed-subset-Metric-Space f f∈ΠC i = + is-closed-subset-closed-subset-Metric-Space + ( X i) + ( C i) + ( f i) + ( λ ε → + rec-trunc-Prop + ( trunc-Prop + ( type-subtype + ( intersection-subtype + ( neighborhood-prop-Metric-Space (X i) ε (f i)) + ( subset-closed-subset-Metric-Space (X i) (C i))))) + ( λ ( g , g∈Nεf , k) → unit-trunc-Prop (g i , g∈Nεf i , k i)) + ( f∈ΠC ε)) +``` + +### A closed subset of a complete metric space is complete + +```agda +module _ + {l1 l2 l3 : Level} (X : Complete-Metric-Space l1 l2) + (C : closed-subset-Metric-Space l3 (metric-space-Complete-Metric-Space X)) + where + + is-complete-closed-subspace-Complete-Metric-Space : + is-complete-Metric-Space + ( subspace-Metric-Space + ( metric-space-Complete-Metric-Space X) + ( subset-closed-subset-Metric-Space + ( metric-space-Complete-Metric-Space X) + ( C))) + is-complete-closed-subspace-Complete-Metric-Space x = + ( ( lim-x , + is-closed-subset-closed-subset-Metric-Space + ( X') + ( C) + ( lim-x) + ( in-closure-limit-cauchy-approximation-subset-Metric-Space X' + ( subset-closed-subset-Metric-Space X' C) + ( convergent-cauchy-approximation-Complete-Metric-Space X x') + ( λ ε → pr2 (pr1 x ε)))) , + is-limit-limit-cauchy-approximation-Complete-Metric-Space X x') + where + X' = metric-space-Complete-Metric-Space X + x' : cauchy-approximation-Metric-Space X' + x' = pr1 ∘ pr1 x , pr2 x + lim-x = limit-cauchy-approximation-Complete-Metric-Space X x' + + complete-closed-subspace-Complete-Metric-Space : + Complete-Metric-Space (l1 ⊔ l3) l2 + complete-closed-subspace-Complete-Metric-Space = + ( subspace-Metric-Space + ( metric-space-Complete-Metric-Space X) + ( subset-closed-subset-Metric-Space + ( metric-space-Complete-Metric-Space X) + ( C)) , + is-complete-closed-subspace-Complete-Metric-Space) +``` diff --git a/src/metric-spaces/closure-subsets-metric-spaces.lagda.md b/src/metric-spaces/closure-subsets-metric-spaces.lagda.md new file mode 100644 index 0000000000..dfa0b934bb --- /dev/null +++ b/src/metric-spaces/closure-subsets-metric-spaces.lagda.md @@ -0,0 +1,123 @@ +# The closure of subsets of metric spaces + +```agda +module metric-spaces.closure-subsets-metric-spaces where +``` + +
Imports + +```agda +open import elementary-number-theory.positive-rational-numbers + +open import foundation.dependent-pair-types +open import foundation.empty-subtypes +open import foundation.empty-types +open import foundation.existential-quantification +open import foundation.identity-types +open import foundation.images +open import foundation.intersections-subtypes +open import foundation.propositional-truncations +open import foundation.propositions +open import foundation.raising-universe-levels +open import foundation.subtypes +open import foundation.universe-levels + +open import metric-spaces.cauchy-approximations-metric-spaces +open import metric-spaces.convergent-cauchy-approximations-metric-spaces +open import metric-spaces.metric-spaces +open import metric-spaces.subspaces-metric-spaces +``` + +
+ +## Idea + +A +{{#concept "limit point" disambiguation="of a subset of a metric space" WDID=Q858223 WD="limit point" Agda=is-limit-point-subset-Metric-Space}} +of a [subset](foundation.subtypes.md) `S` of a +[metric space](metric-spaces.metric-spaces.md) `X` is a point `x` of `X` where +every neighborhood of `x` [intersects](foundation.intersections-subtypes.md) +`S`. + +The +{{#concept "closure" disambiguation="of a subset of a metric space" WDID=Q320346 WD="closure" Agda=closure-subset-Metric-Space}} +of `S` is the set of limit points of `S`. + +## Definition + +```agda +module _ + {l1 l2 l3 : Level} (X : Metric-Space l1 l2) (S : subset-Metric-Space l3 X) + where + + closure-subset-Metric-Space : subset-Metric-Space (l1 ⊔ l2 ⊔ l3) X + closure-subset-Metric-Space x = + Π-Prop + ( ℚ⁺) + ( λ ε → intersect-prop-subtype (neighborhood-prop-Metric-Space X ε x) S) + + is-limit-point-subset-Metric-Space : type-Metric-Space X → UU (l1 ⊔ l2 ⊔ l3) + is-limit-point-subset-Metric-Space = + is-in-subtype closure-subset-Metric-Space +``` + +## Properties + +### `S` is a subset of its closure + +```agda +module _ + {l1 l2 l3 : Level} (X : Metric-Space l1 l2) (S : subset-Metric-Space l3 X) + where + + is-subset-closure-subset-Metric-Space : S ⊆ closure-subset-Metric-Space X S + is-subset-closure-subset-Metric-Space x x∈S ε = + intro-exists x (refl-neighborhood-Metric-Space X ε x , x∈S) +``` + +### The closure of the empty set is empty + +```agda +module _ + {l1 l2 : Level} (X : Metric-Space l1 l2) + where + + is-empty-closure-empty-subset-Metric-Space : + is-empty-subtype + ( closure-subset-Metric-Space X (empty-subset-Metric-Space X)) + is-empty-closure-empty-subset-Metric-Space x x∈closure-∅ = + let open do-syntax-trunc-Prop empty-Prop + in do + (s , s∈N1x , s∈∅) ← x∈closure-∅ one-ℚ⁺ + map-inv-raise s∈∅ +``` + +### If a Cauchy approximation in `S ⊆ X` has a limit in `X`, the limit is in the closure of `S` + +```agda +module _ + {l1 l2 l3 : Level} (X : Metric-Space l1 l2) (S : subset-Metric-Space l3 X) + where + + in-closure-limit-cauchy-approximation-subset-Metric-Space : + (x : convergent-cauchy-approximation-Metric-Space X) → + (x⊆S : + (ε : ℚ⁺) → + type-Prop (S (map-convergent-cauchy-approximation-Metric-Space X x ε))) → + type-Prop + (closure-subset-Metric-Space + ( X) + ( S) + ( limit-convergent-cauchy-approximation-Metric-Space X x)) + in-closure-limit-cauchy-approximation-subset-Metric-Space + (x , lim-x , is-lim-lim-x) x⊆S ε = + let xε = map-cauchy-approximation-Metric-Space X x ε + in + intro-exists + ( xε) + ( saturated-neighborhood-Metric-Space X ε lim-x xε + ( λ δ → + symmetric-neighborhood-Metric-Space X _ xε lim-x + ( is-lim-lim-x ε δ)) , + x⊆S ε) +``` diff --git a/src/metric-spaces/compact-metric-spaces.lagda.md b/src/metric-spaces/compact-metric-spaces.lagda.md new file mode 100644 index 0000000000..d262bbdebb --- /dev/null +++ b/src/metric-spaces/compact-metric-spaces.lagda.md @@ -0,0 +1,46 @@ +# Compact metric spaces + +```agda +module metric-spaces.compact-metric-spaces where +``` + +
Imports + +```agda +open import foundation.conjunction +open import foundation.propositions +open import foundation.subtypes +open import foundation.universe-levels + +open import metric-spaces.complete-metric-spaces +open import metric-spaces.metric-spaces +open import metric-spaces.totally-bounded-metric-spaces +``` + +
+ +## Idea + +A [metric space](metric-spaces.metric-spaces.md) is +{{#concept "compact" WDID=Q381892 WD="compact space" Agda=is-compact-Metric-Space}} +if it is [totally bounded](metric-spaces.totally-bounded-metric-spaces.md) and +[complete](metric-spaces.complete-metric-spaces.md). + +## Definition + +```agda +module _ + {l1 l2 : Level} (X : Metric-Space l1 l2) + where + + is-compact-prop-Metric-Space : Prop (lsuc l1 ⊔ lsuc l2) + is-compact-prop-Metric-Space = + is-totally-bounded-prop-Metric-Space X ∧ is-complete-prop-Metric-Space X + + is-compact-Metric-Space : UU (lsuc l1 ⊔ lsuc l2) + is-compact-Metric-Space = type-Prop is-compact-prop-Metric-Space + +Compact-Metric-Space : (l1 l2 : Level) → UU (lsuc l1 ⊔ lsuc l2) +Compact-Metric-Space l1 l2 = + type-subtype (is-compact-prop-Metric-Space {l1} {l2}) +``` diff --git a/src/metric-spaces/dense-subsets-metric-spaces.lagda.md b/src/metric-spaces/dense-subsets-metric-spaces.lagda.md new file mode 100644 index 0000000000..307f182990 --- /dev/null +++ b/src/metric-spaces/dense-subsets-metric-spaces.lagda.md @@ -0,0 +1,64 @@ +# Dense subsets of metric spaces + +```agda +module metric-spaces.dense-subsets-metric-spaces where +``` + +
Imports + +```agda +open import elementary-number-theory.positive-rational-numbers + +open import foundation.dependent-pair-types +open import foundation.existential-quantification +open import foundation.full-subtypes +open import foundation.propositions +open import foundation.raising-universe-levels +open import foundation.subtypes +open import foundation.unit-type +open import foundation.universe-levels + +open import metric-spaces.closure-subsets-metric-spaces +open import metric-spaces.metric-spaces +open import metric-spaces.subspaces-metric-spaces +``` + +
+ +## Idea + +A [subset](foundation.subtypes.md) `S` of a +[metric space](metric-spaces.metric-spaces.md) is +{{#concept "dense" disambiguation="in a metric space" WDID=Q673444 WD="dense set" Agda=is-dense-subset-Metric-Space}} +if its [closure](metric-spaces.closure-subsets-metric-spaces.md) is +[full](foundation.full-subtypes.md). + +## Definition + +```agda +module _ + {l1 l2 l3 : Level} (X : Metric-Space l1 l2) (S : subset-Metric-Space l3 X) + where + + is-dense-prop-subset-Metric-Space : Prop (l1 ⊔ l2 ⊔ l3) + is-dense-prop-subset-Metric-Space = + is-full-subtype-Prop (closure-subset-Metric-Space X S) + + is-dense-subset-Metric-Space : UU (l1 ⊔ l2 ⊔ l3) + is-dense-subset-Metric-Space = type-Prop is-dense-prop-subset-Metric-Space +``` + +## Properties + +### A metric space is dense in itself + +```agda +module _ + {l1 l2 : Level} (X : Metric-Space l1 l2) + where + + is-dense-full-subset-Metric-Space : + is-dense-subset-Metric-Space X (full-subset-Metric-Space X) + is-dense-full-subset-Metric-Space x ε = + intro-exists x (refl-neighborhood-Metric-Space X ε x , map-raise star) +``` diff --git a/src/metric-spaces/elements-at-bounded-distance-metric-spaces.lagda.md b/src/metric-spaces/elements-at-bounded-distance-metric-spaces.lagda.md index b566ef434d..22848a33d8 100644 --- a/src/metric-spaces/elements-at-bounded-distance-metric-spaces.lagda.md +++ b/src/metric-spaces/elements-at-bounded-distance-metric-spaces.lagda.md @@ -7,13 +7,20 @@ module metric-spaces.elements-at-bounded-distance-metric-spaces where
Imports ```agda +open import elementary-number-theory.addition-rational-numbers +open import elementary-number-theory.inequality-rational-numbers open import elementary-number-theory.positive-rational-numbers +open import elementary-number-theory.rational-numbers +open import elementary-number-theory.strict-inequality-rational-numbers open import foundation.dependent-pair-types +open import foundation.empty-types open import foundation.equivalence-relations open import foundation.existential-quantification open import foundation.function-types open import foundation.functoriality-propositional-truncation +open import foundation.logical-equivalences +open import foundation.negation open import foundation.propositional-truncations open import foundation.propositions open import foundation.subtypes @@ -24,6 +31,11 @@ open import logic.functoriality-existential-quantification open import metric-spaces.metric-spaces open import order-theory.preorders + +open import real-numbers.inequality-upper-dedekind-real-numbers +open import real-numbers.minimum-upper-dedekind-real-numbers +open import real-numbers.rational-upper-dedekind-real-numbers +open import real-numbers.upper-dedekind-real-numbers ```
@@ -176,3 +188,51 @@ module _ ( symmetric-bounded-dist-Metric-Space A) , ( transitive-bounded-dist-Metric A) ``` + +### Elements at bounded distance can be assigned an upper real distance + +```agda +module _ + {l1 l2 : Level} (M : Metric-Space l1 l2) + (x y : type-Metric-Space M) (B : bounded-dist-Metric-Space M x y) + where + + upper-real-dist-Metric-Space : upper-ℝ l2 + upper-real-dist-Metric-Space = + min-upper-ℝ + ( type-subtype (λ ε → neighborhood-prop-Metric-Space M ε x y)) + ( B) + ( upper-real-ℚ ∘ rational-ℚ⁺ ∘ pr1) + + abstract + leq-upper-real-dist-Metric-Space : + (ε : ℚ⁺) → + leq-upper-ℝ upper-real-dist-Metric-Space (upper-real-ℚ (rational-ℚ⁺ ε)) ↔ + neighborhood-Metric-Space M ε x y + pr1 (leq-upper-real-dist-Metric-Space ε⁺@(ε , _)) d≤ε = + saturated-neighborhood-Metric-Space M ε⁺ x y + ( λ δ⁺@(δ , _) → + let + open + do-syntax-trunc-Prop + ( neighborhood-prop-Metric-Space M (ε⁺ +ℚ⁺ δ⁺) x y) + in do + ((θ , Nθxy) , θ<ε+δ) ← d≤ε (ε +ℚ δ) (le-right-add-rational-ℚ⁺ ε δ⁺) + monotonic-neighborhood-Metric-Space M x y θ (ε⁺ +ℚ⁺ δ⁺) θ<ε+δ Nθxy) + pr2 (leq-upper-real-dist-Metric-Space ε⁺) Nεxy _ = intro-exists (ε⁺ , Nεxy) + + leq-zero-not-in-cut-upper-real-dist-Metric-Space : + (q : ℚ) → leq-ℚ q zero-ℚ → + ¬ (is-in-cut-upper-ℝ upper-real-dist-Metric-Space q) + leq-zero-not-in-cut-upper-real-dist-Metric-Space q q≤0 q∈U = + let open do-syntax-trunc-Prop empty-Prop + in do + ((ε⁺@(ε , is-pos-ε) , Nεxy) , εImports + +```agda +open import elementary-number-theory.positive-rational-numbers + +open import foundation.dependent-pair-types +open import foundation.empty-subtypes +open import foundation.empty-types +open import foundation.existential-quantification +open import foundation.full-subtypes +open import foundation.propositional-truncations +open import foundation.propositions +open import foundation.raising-universe-levels +open import foundation.subtypes +open import foundation.unions-subtypes +open import foundation.unit-type +open import foundation.universe-levels + +open import metric-spaces.metric-spaces +open import metric-spaces.subspaces-metric-spaces +``` + + + +## Idea + +The +{{#concept "interior" disambiguation="of a subset of a metric space" WDID=Q862761 WD="interior" Agda=interior-subset-Metric-Space}} +of a [subset](foundation.subtypes.md) `S` of a +[metric space](metric-spaces.metric-spaces.md) `X` is the set of points `x` of +`X` where some neighborhood of `x` is contained in `S`. + +## Definition + +```agda +module _ + {l1 l2 l3 : Level} (X : Metric-Space l1 l2) (S : subset-Metric-Space l3 X) + where + + interior-subset-Metric-Space : subset-Metric-Space (l1 ⊔ l2 ⊔ l3) X + interior-subset-Metric-Space x = + ∃ ℚ⁺ (λ ε → leq-prop-subtype (neighborhood-prop-Metric-Space X ε x) S) +``` + +## Properties + +### The interior of `S` is a subset of `S` + +```agda +module _ + {l1 l2 l3 : Level} (X : Metric-Space l1 l2) (S : subset-Metric-Space l3 X) + where + + is-subset-interior-subset-Metric-Space : + interior-subset-Metric-Space X S ⊆ S + is-subset-interior-subset-Metric-Space x ∃ε = + let open do-syntax-trunc-Prop (S x) + in do + (ε , Nεx⊆S) ← ∃ε + Nεx⊆S x (refl-neighborhood-Metric-Space X ε x) +``` + +### The interior of the empty subset is empty + +```agda +module _ + {l1 l2 : Level} (X : Metric-Space l1 l2) + where + + is-empty-interior-empty-subset-Metric-Space : + is-empty-subtype + ( interior-subset-Metric-Space X (empty-subset-Metric-Space X)) + is-empty-interior-empty-subset-Metric-Space x ∃ε = + let open do-syntax-trunc-Prop empty-Prop + in do + (ε , Nεx⊆∅) ← ∃ε + map-inv-raise (Nεx⊆∅ x (refl-neighborhood-Metric-Space X ε x)) +``` + +### The interior of the entire metric space is the metric space + +```agda + is-full-interior-full-subset-Metric-Space : + is-full-subtype + ( interior-subset-Metric-Space X (full-subset-Metric-Space X)) + is-full-interior-full-subset-Metric-Space x = + intro-exists one-ℚ⁺ (λ _ _ → map-raise star) +``` diff --git a/src/metric-spaces/located-metric-spaces.lagda.md b/src/metric-spaces/located-metric-spaces.lagda.md new file mode 100644 index 0000000000..e2dbee1c06 --- /dev/null +++ b/src/metric-spaces/located-metric-spaces.lagda.md @@ -0,0 +1,180 @@ +# Located metric spaces + +```agda +module metric-spaces.located-metric-spaces where +``` + +
Imports + +```agda +open import elementary-number-theory.inequality-rational-numbers +open import elementary-number-theory.positive-rational-numbers +open import elementary-number-theory.rational-numbers +open import elementary-number-theory.strict-inequality-rational-numbers + +open import foundation.coproduct-types +open import foundation.dependent-pair-types +open import foundation.disjunction +open import foundation.empty-types +open import foundation.existential-quantification +open import foundation.function-types +open import foundation.functoriality-disjunction +open import foundation.logical-equivalences +open import foundation.negation +open import foundation.propositional-truncations +open import foundation.propositions +open import foundation.sets +open import foundation.subtypes +open import foundation.universe-levels + +open import metric-spaces.elements-at-bounded-distance-metric-spaces +open import metric-spaces.metric-spaces +open import metric-spaces.subspaces-metric-spaces + +open import real-numbers.dedekind-real-numbers +open import real-numbers.inequality-real-numbers +open import real-numbers.rational-real-numbers +open import real-numbers.real-numbers-from-upper-dedekind-real-numbers +open import real-numbers.upper-dedekind-real-numbers +``` + +
+ +## Idea + +A [metric space](metric-spaces.metric-spaces.md) is +{{#concept "located" Disambiguation="metric space" Agda=is-located-Metric-Space}} +if for any `x` and `y` in the metric space, and `δ ε : ℚ⁺` with `δ < ε`, merely +`x` and `y` are [not](foundation.negation.md) in a `δ`-neighborhood +[or](foundation.disjunction.md) `x` and `y` are in an `ε`-neighborhood. + +If `x` and `y` are +[at bounded distance](metric-spaces.elements-at-bounded-distance-metric-spaces.md), +then this suffices to define a +[real number](real-numbers.dedekind-real-numbers.md) `d` such that for all +`ε : ℚ⁺`, `d ≤ ε` [if and only if](foundation.logical-equivalences.md) `x` and +`y` are in an `ε`-neighborhood of each other. + +## Definition + +```agda +module _ + {l1 l2 : Level} (M : Metric-Space l1 l2) + where + + is-located-prop-Metric-Space : Prop (l1 ⊔ l2) + is-located-prop-Metric-Space = + Π-Prop + ( type-Metric-Space M) + ( λ x → + Π-Prop + ( type-Metric-Space M) + ( λ y → + Π-Prop + ( ℚ⁺) + ( λ δ → + Π-Prop + ( ℚ⁺) + ( λ ε → + hom-Prop + ( le-prop-ℚ⁺ δ ε) + ( ¬' (neighborhood-prop-Metric-Space M δ x y) ∨ + neighborhood-prop-Metric-Space M ε x y))))) + + is-located-Metric-Space : UU (l1 ⊔ l2) + is-located-Metric-Space = type-Prop is-located-prop-Metric-Space + +Located-Metric-Space : (l1 l2 : Level) → UU (lsuc l1 ⊔ lsuc l2) +Located-Metric-Space l1 l2 = + type-subtype (is-located-prop-Metric-Space {l1} {l2}) + +module _ + {l1 l2 : Level} (X : Located-Metric-Space l1 l2) + where + + metric-space-Located-Metric-Space : Metric-Space l1 l2 + metric-space-Located-Metric-Space = pr1 X + + type-Located-Metric-Space : UU l1 + type-Located-Metric-Space = + type-Metric-Space metric-space-Located-Metric-Space + + is-located-metric-space-Located-Metric-Space : + is-located-Metric-Space metric-space-Located-Metric-Space + is-located-metric-space-Located-Metric-Space = pr2 X + + set-Located-Metric-Space : Set l1 + set-Located-Metric-Space = set-Metric-Space metric-space-Located-Metric-Space + +subset-Located-Metric-Space : + {l1 l2 : Level} (l3 : Level) (X : Located-Metric-Space l1 l2) → + UU (l1 ⊔ lsuc l3) +subset-Located-Metric-Space l3 X = + subset-Metric-Space l3 (metric-space-Located-Metric-Space X) +``` + +## Properties + +### Elements at bounded distance in a located metric space can be assigned a real distance + +```agda +module _ + {l1 l2 : Level} (M : Metric-Space l1 l2) (L : is-located-Metric-Space M) + (x y : type-Metric-Space M) (B : bounded-dist-Metric-Space M x y) + where + + abstract + is-located-dist-located-Metric-Space : + (p q : ℚ) → le-ℚ p q → + type-disjunction-Prop + ( ¬' (cut-upper-ℝ (upper-real-dist-Metric-Space M x y B) p)) + ( cut-upper-ℝ (upper-real-dist-Metric-Space M x y B) q) + is-located-dist-located-Metric-Space p q pImports + +```agda +open import elementary-number-theory.natural-numbers +open import elementary-number-theory.positive-rational-numbers + +open import foundation.dependent-pair-types +open import foundation.empty-types +open import foundation.existential-quantification +open import foundation.propositional-truncations +open import foundation.propositions +open import foundation.raising-universe-levels +open import foundation.singleton-subtypes +open import foundation.subtypes +open import foundation.surjective-maps +open import foundation.torsorial-type-families +open import foundation.universe-levels + +open import metric-spaces.approximations-metric-spaces +open import metric-spaces.located-metric-spaces +open import metric-spaces.metric-spaces +open import metric-spaces.nets-metric-spaces + +open import univalent-combinatorics.finite-subtypes +open import univalent-combinatorics.finite-types +open import univalent-combinatorics.finitely-enumerable-subtypes +open import univalent-combinatorics.finitely-enumerable-types +open import univalent-combinatorics.standard-finite-types +``` + + + +## Idea + +For an `ε : ℚ⁺`, an +`ε`-{{#concept "net" disambiguation="in a located metric space" Agda=net-Located-Metric-Space}} +to a [located metric space](metric-spaces.located-metric-spaces.md) `X` is an +[`ε`-net](metric-spaces.nets-metric-spaces.md) in the underlying +[metric space](metric-spaces.metric-spaces.md). + +## Definition + +```agda +net-Located-Metric-Space : + {l1 l2 : Level} (l3 : Level) → Located-Metric-Space l1 l2 → ℚ⁺ → + UU (l1 ⊔ l2 ⊔ lsuc l3) +net-Located-Metric-Space l3 X = + net-Metric-Space l3 (metric-space-Located-Metric-Space X) +``` diff --git a/src/metric-spaces/nets-metric-spaces.lagda.md b/src/metric-spaces/nets-metric-spaces.lagda.md new file mode 100644 index 0000000000..6af769a5ea --- /dev/null +++ b/src/metric-spaces/nets-metric-spaces.lagda.md @@ -0,0 +1,53 @@ +# Nets in metric spaces + +```agda +module metric-spaces.nets-metric-spaces where +``` + +
Imports + +```agda +open import elementary-number-theory.positive-rational-numbers + +open import foundation.propositions +open import foundation.subtypes +open import foundation.universe-levels + +open import metric-spaces.approximations-metric-spaces +open import metric-spaces.metric-spaces + +open import univalent-combinatorics.finitely-enumerable-subtypes +open import univalent-combinatorics.finitely-enumerable-types +``` + +
+ +## Idea + +For an `ε : ℚ⁺`, an `ε`-{{#concept "net" disambiguation="in a metric space"}} to +a [metric space](metric-spaces.metric-spaces.md) `X` is a +[finitely enumerable](univalent-combinatorics.finitely-enumerable-subtypes.md) +ε-[approximation](metric-spaces.approximations-metric-spaces.md) of `X`. + +## Definition + +```agda +module _ + {l1 l2 l3 : Level} (X : Metric-Space l1 l2) (ε : ℚ⁺) + (S : finitely-enumerable-subtype l3 (type-Metric-Space X)) + where + + is-net-prop-Metric-Space : Prop (l1 ⊔ l2 ⊔ l3) + is-net-prop-Metric-Space = + is-approximation-prop-Metric-Space X ε + ( subtype-finitely-enumerable-subtype S) + + is-net-Metric-Space : UU (l1 ⊔ l2 ⊔ l3) + is-net-Metric-Space = type-Prop is-net-prop-Metric-Space + +net-Metric-Space : + {l1 l2 : Level} (l3 : Level) → Metric-Space l1 l2 → ℚ⁺ → + UU (l1 ⊔ l2 ⊔ lsuc l3) +net-Metric-Space l3 X ε = + type-subtype (is-net-prop-Metric-Space {l3 = l3} X ε) +``` diff --git a/src/metric-spaces/open-subsets-located-metric-spaces.lagda.md b/src/metric-spaces/open-subsets-located-metric-spaces.lagda.md new file mode 100644 index 0000000000..c0ec5bb99b --- /dev/null +++ b/src/metric-spaces/open-subsets-located-metric-spaces.lagda.md @@ -0,0 +1,83 @@ +# Open subsets of located metric spaces + +```agda +module metric-spaces.open-subsets-located-metric-spaces where +``` + +
Imports + +```agda +open import elementary-number-theory.minimum-rational-numbers +open import elementary-number-theory.positive-rational-numbers + +open import foundation.cartesian-products-subtypes +open import foundation.dependent-pair-types +open import foundation.empty-types +open import foundation.existential-quantification +open import foundation.function-types +open import foundation.intersections-subtypes +open import foundation.propositional-truncations +open import foundation.propositions +open import foundation.raising-universe-levels +open import foundation.subtypes +open import foundation.transport-along-identifications +open import foundation.unions-subtypes +open import foundation.universe-levels + +open import metric-spaces.cartesian-products-metric-spaces +open import metric-spaces.discrete-metric-spaces +open import metric-spaces.interior-subsets-metric-spaces +open import metric-spaces.located-metric-spaces +open import metric-spaces.metric-spaces +open import metric-spaces.open-subsets-metric-spaces +open import metric-spaces.subspaces-metric-spaces +``` + +
+ +## Idea + +A [subset](foundation.subtypes.md) `S` of a +[located metric space](metric-spaces.located-metric-spaces.md) `X` is +{{#concept "open" disambiguation="in a located metric space" WDID=Q213363 WD="open set" Agda=is-open-subset-Located-Metric-Space}} +if it is an [open subset](metric-spaces.open-subsets-metric-spaces.md) of the +corresponding [metric space](metric-spaces.metric-spaces.md). + +## Definition + +```agda +module _ + {l1 l2 l3 : Level} + (X : Located-Metric-Space l1 l2) (S : subset-Located-Metric-Space l3 X) + where + + is-open-prop-subset-Located-Metric-Space : Prop (l1 ⊔ l2 ⊔ l3) + is-open-prop-subset-Located-Metric-Space = + is-open-prop-subset-Metric-Space + ( metric-space-Located-Metric-Space X) + ( S) + + is-open-subset-Located-Metric-Space : UU (l1 ⊔ l2 ⊔ l3) + is-open-subset-Located-Metric-Space = + type-Prop is-open-prop-subset-Located-Metric-Space + +open-subset-Located-Metric-Space : + {l1 l2 : Level} (l3 : Level) + (X : Located-Metric-Space l1 l2) → UU (l1 ⊔ l2 ⊔ lsuc l3) +open-subset-Located-Metric-Space l3 X = + open-subset-Metric-Space l3 (metric-space-Located-Metric-Space X) + +module _ + {l1 l2 l3 : Level} (X : Located-Metric-Space l1 l2) + (S : open-subset-Located-Metric-Space l3 X) + where + + subset-open-subset-Located-Metric-Space : subset-Located-Metric-Space l3 X + subset-open-subset-Located-Metric-Space = pr1 S + + is-open-subset-open-subset-Located-Metric-Space : + is-open-subset-Located-Metric-Space + ( X) + ( subset-open-subset-Located-Metric-Space) + is-open-subset-open-subset-Located-Metric-Space = pr2 S +``` diff --git a/src/metric-spaces/open-subsets-metric-spaces.lagda.md b/src/metric-spaces/open-subsets-metric-spaces.lagda.md new file mode 100644 index 0000000000..a432331b93 --- /dev/null +++ b/src/metric-spaces/open-subsets-metric-spaces.lagda.md @@ -0,0 +1,280 @@ +# Open subsets of metric spaces + +```agda +module metric-spaces.open-subsets-metric-spaces where +``` + +
Imports + +```agda +open import elementary-number-theory.minimum-rational-numbers +open import elementary-number-theory.positive-rational-numbers + +open import foundation.cartesian-products-subtypes +open import foundation.dependent-pair-types +open import foundation.empty-types +open import foundation.existential-quantification +open import foundation.function-types +open import foundation.intersections-subtypes +open import foundation.propositional-truncations +open import foundation.propositions +open import foundation.raising-universe-levels +open import foundation.subtypes +open import foundation.transport-along-identifications +open import foundation.unions-subtypes +open import foundation.universe-levels + +open import metric-spaces.cartesian-products-metric-spaces +open import metric-spaces.discrete-metric-spaces +open import metric-spaces.interior-subsets-metric-spaces +open import metric-spaces.metric-spaces +open import metric-spaces.subspaces-metric-spaces +``` + +
+ +## Idea + +A [subset](foundation.subtypes.md) `S` of a +[metric space](metric-spaces.metric-spaces.md) `X` is +{{#concept "open" disambiguation="in a metric space" WDID=Q213363 WD="open set" Agda=is-open-subset-Metric-Space}} +if it is a subset of its +[interior](metric-spaces.interior-subsets-metric-spaces.md). + +## Definition + +```agda +module _ + {l1 l2 l3 : Level} (X : Metric-Space l1 l2) (S : subset-Metric-Space l3 X) + where + + is-open-prop-subset-Metric-Space : Prop (l1 ⊔ l2 ⊔ l3) + is-open-prop-subset-Metric-Space = + leq-prop-subtype S (interior-subset-Metric-Space X S) + + is-open-subset-Metric-Space : UU (l1 ⊔ l2 ⊔ l3) + is-open-subset-Metric-Space = type-Prop is-open-prop-subset-Metric-Space + +open-subset-Metric-Space : + {l1 l2 : Level} (l3 : Level) (X : Metric-Space l1 l2) → UU (l1 ⊔ l2 ⊔ lsuc l3) +open-subset-Metric-Space l3 X = + type-subtype (is-open-prop-subset-Metric-Space {l3 = l3} X) + +module _ + {l1 l2 l3 : Level} (X : Metric-Space l1 l2) + where + + subset-open-subset-Metric-Space : + open-subset-Metric-Space l3 X → subset-Metric-Space l3 X + subset-open-subset-Metric-Space = pr1 + + is-open-subset-open-subset-Metric-Space : + (O : open-subset-Metric-Space l3 X) → + is-open-subset-Metric-Space X (subset-open-subset-Metric-Space O) + is-open-subset-open-subset-Metric-Space = pr2 +``` + +## Properties + +### An open subset has the same elements as its interior + +```agda +module _ + {l1 l2 : Level} (X : Metric-Space l1 l2) + where + + has-same-elements-interior-open-subset-Metric-Space : + {l3 : Level} (S : open-subset-Metric-Space l3 X) → + has-same-elements-subtype + ( subset-open-subset-Metric-Space X S) + ( interior-subset-Metric-Space + ( X) + ( subset-open-subset-Metric-Space X S)) + pr1 (has-same-elements-interior-open-subset-Metric-Space (S , is-open-S) x) = + is-open-S x + pr2 (has-same-elements-interior-open-subset-Metric-Space (S , is-open-S) x) = + is-subset-interior-subset-Metric-Space X S x +``` + +### The empty subset is open + +```agda +module _ + {l1 l2 : Level} (X : Metric-Space l1 l2) + where + + is-open-empty-subset-Metric-Space : + is-open-subset-Metric-Space X (empty-subset-Metric-Space X) + is-open-empty-subset-Metric-Space x (map-raise ⊥) = ex-falso ⊥ +``` + +### The full subset is open + +```agda +module _ + {l1 l2 : Level} (X : Metric-Space l1 l2) + where + + is-open-full-subset-Metric-Space : + is-open-subset-Metric-Space X (full-subset-Metric-Space X) + is-open-full-subset-Metric-Space x _ = + is-full-interior-full-subset-Metric-Space X x +``` + +### Every subset of a discrete metric space is open + +```agda +module _ + {l1 l2 : Level} (X : Discrete-Metric-Space l1 l2) + where + + is-open-subset-Discrete-Metric-Space : + {l3 : Level} (S : subtype l3 (type-Discrete-Metric-Space X)) → + is-open-subset-Metric-Space + ( metric-space-Discrete-Metric-Space X) + ( S) + is-open-subset-Discrete-Metric-Space S x x∈S = + intro-exists + ( one-ℚ⁺) + ( λ y N1xy → + tr + ( type-Prop ∘ S) + ( is-discrete-metric-space-Discrete-Metric-Space X one-ℚ⁺ x y N1xy) + ( x∈S)) +``` + +### The intersection of two open subsets is open + +```agda +module _ + {l1 l2 l3 l4 : Level} (X : Metric-Space l1 l2) + (S : open-subset-Metric-Space l3 X) (T : open-subset-Metric-Space l4 X) + where + + subset-intersection-open-subset-Metric-Space : + subset-Metric-Space (l3 ⊔ l4) X + subset-intersection-open-subset-Metric-Space = + intersection-subtype + ( subset-open-subset-Metric-Space X S) + ( subset-open-subset-Metric-Space X T) + + is-open-subset-intersection-open-subset-Metric-Space : + is-open-subset-Metric-Space + ( X) + ( subset-intersection-open-subset-Metric-Space) + is-open-subset-intersection-open-subset-Metric-Space x (x∈S , x∈T) = + let + open + do-syntax-trunc-Prop + ( interior-subset-Metric-Space + ( X) + ( subset-intersection-open-subset-Metric-Space) + ( x)) + in do + (εS , NεSx⊆S) ← + is-open-subset-open-subset-Metric-Space X S x x∈S + (εT , NεTx⊆T) ← + is-open-subset-open-subset-Metric-Space X T x x∈T + let εmin = min-ℚ⁺ εS εT + intro-exists + ( εmin) + ( λ y y∈Nεminx → + ( NεSx⊆S + ( y) + ( weakly-monotonic-neighborhood-Metric-Space X x y + ( εmin) + ( εS) + ( leq-left-min-ℚ⁺ εS εT) + ( y∈Nεminx)) , + NεTx⊆T + ( y) + ( weakly-monotonic-neighborhood-Metric-Space X x y + ( εmin) + ( εT) + ( leq-right-min-ℚ⁺ εS εT) + ( y∈Nεminx)))) +``` + +### Unions of a family of open subsets are open + +```agda +module _ + {l1 l2 l3 l4 : Level} (X : Metric-Space l1 l2) {I : UU l3} + (F : I → open-subset-Metric-Space l4 X) + where + + subset-union-family-open-subset-Metric-Space : subset-Metric-Space (l3 ⊔ l4) X + subset-union-family-open-subset-Metric-Space = + union-family-of-subtypes (λ i → subset-open-subset-Metric-Space X (F i)) + + abstract + is-open-subset-union-family-open-subset-Metric-Space : + is-open-subset-Metric-Space + ( X) + ( subset-union-family-open-subset-Metric-Space) + is-open-subset-union-family-open-subset-Metric-Space x x∈union = + let + open + do-syntax-trunc-Prop + ( interior-subset-Metric-Space + ( X) + ( subset-union-family-open-subset-Metric-Space) + ( x)) + in do + (i , x∈Fi) ← x∈union + (ε , Nεx⊆Fi) ← is-open-subset-open-subset-Metric-Space X (F i) x x∈Fi + intro-exists ε (λ y y∈Nεx → intro-exists i (Nεx⊆Fi y y∈Nεx)) + + union-family-open-subset-Metric-Space : + open-subset-Metric-Space (l3 ⊔ l4) X + union-family-open-subset-Metric-Space = + ( subset-union-family-open-subset-Metric-Space , + is-open-subset-union-family-open-subset-Metric-Space) +``` + +### The Cartesian product of two open subsets is open + +```agda +module _ + {l1 l2 l3 l4 l5 l6 : Level} (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) + (Ox : open-subset-Metric-Space l5 X) (Oy : open-subset-Metric-Space l6 Y) + where + + abstract + is-open-subset-product-open-subset-Metric-Space : + is-open-subset-Metric-Space + ( product-Metric-Space X Y) + ( product-subtype (pr1 Ox) (pr1 Oy)) + is-open-subset-product-open-subset-Metric-Space (x , y) (x∈Ox , y∈Oy) = + let + open + do-syntax-trunc-Prop + ( interior-subset-Metric-Space + ( product-Metric-Space X Y) + ( product-subtype (pr1 Ox) (pr1 Oy)) + ( x , y)) + in do + (δ , Nδx⊆Ox) ← is-open-subset-open-subset-Metric-Space X Ox x x∈Ox + (ε , Nεy⊆Oy) ← is-open-subset-open-subset-Metric-Space Y Oy y y∈Oy + intro-exists + ( min-ℚ⁺ δ ε) + ( λ (x' , y') (Nminxx' , Nminyy') → + ( Nδx⊆Ox x' + ( weakly-monotonic-neighborhood-Metric-Space X x x' + ( min-ℚ⁺ δ ε) + ( δ) + ( leq-left-min-ℚ⁺ δ ε) + ( Nminxx')) , + Nεy⊆Oy y' + ( weakly-monotonic-neighborhood-Metric-Space Y y y' + ( min-ℚ⁺ δ ε) + ( ε) + ( leq-right-min-ℚ⁺ δ ε) + ( Nminyy')))) + + product-open-subset-Metric-Space : + open-subset-Metric-Space (l5 ⊔ l6) (product-Metric-Space X Y) + product-open-subset-Metric-Space = + product-subtype (pr1 Ox) (pr1 Oy) , + is-open-subset-product-open-subset-Metric-Space +``` diff --git a/src/metric-spaces/pseudometric-spaces.lagda.md b/src/metric-spaces/pseudometric-spaces.lagda.md index 97072105e1..6209bdb36e 100644 --- a/src/metric-spaces/pseudometric-spaces.lagda.md +++ b/src/metric-spaces/pseudometric-spaces.lagda.md @@ -8,6 +8,7 @@ module metric-spaces.pseudometric-spaces where ```agda open import elementary-number-theory.positive-rational-numbers +open import elementary-number-theory.strict-inequality-rational-numbers open import foundation.binary-relations open import foundation.cartesian-product-types @@ -231,6 +232,20 @@ module _ refl-neighborhood-Pseudometric-Space triangular-neighborhood-Pseudometric-Space + abstract + weakly-monotonic-neighborhood-Pseudometric-Space : + (x y : type-Pseudometric-Space) (d₁ d₂ : ℚ⁺) → + leq-ℚ⁺ d₁ d₂ → + neighborhood-Pseudometric-Space d₁ x y → + neighborhood-Pseudometric-Space d₂ x y + weakly-monotonic-neighborhood-Pseudometric-Space x y d₁ d₂ d₁≤d₂ Nd₁xy = + trichotomy-le-ℚ (rational-ℚ⁺ d₁) (rational-ℚ⁺ d₂) + ( λ d₁Imports + +```agda +open import elementary-number-theory.positive-rational-numbers + +open import foundation.propositional-truncations +open import foundation.propositions +open import foundation.universe-levels + +open import metric-spaces.metric-spaces +open import metric-spaces.nets-metric-spaces +``` + + + +## Idea + +A [metric space](metric-spaces.metric-spaces.md) is +{{#concept "totally bounded" WDID=Q1362228 WD="totally bounded space" Agda=is-totally-bounded-Metric-Space}} +if for every `ε : ℚ⁺`, it has an `ε`-[net](metric-spaces.nets-metric-spaces.md). + +## Definition + +```agda +module _ + {l1 l2 : Level} (X : Metric-Space l1 l2) + where + + modulus-of-total-boundedness-Metric-Space : UU (lsuc l1 ⊔ lsuc l2) + modulus-of-total-boundedness-Metric-Space = + (ε : ℚ⁺) → net-Metric-Space (l1 ⊔ l2) X ε + + is-totally-bounded-prop-Metric-Space : Prop (lsuc l1 ⊔ lsuc l2) + is-totally-bounded-prop-Metric-Space = + trunc-Prop modulus-of-total-boundedness-Metric-Space + + is-totally-bounded-Metric-Space : UU (lsuc l1 ⊔ lsuc l2) + is-totally-bounded-Metric-Space = + type-Prop is-totally-bounded-prop-Metric-Space +``` From d9b6a639b004c954735712b250786cbe3b92c7f9 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Sat, 30 Aug 2025 07:33:10 -0700 Subject: [PATCH 26/97] Minimum and maximum for total orders (#1490) Resolves #1488. --- .../decidable-total-orders.lagda.md | 234 ++++++---- .../greatest-lower-bounds-posets.lagda.md | 6 +- src/order-theory/meet-semilattices.lagda.md | 2 +- src/order-theory/total-orders.lagda.md | 401 ++++++++++++++++++ 4 files changed, 548 insertions(+), 95 deletions(-) diff --git a/src/order-theory/decidable-total-orders.lagda.md b/src/order-theory/decidable-total-orders.lagda.md index a68ece04d3..5799377141 100644 --- a/src/order-theory/decidable-total-orders.lagda.md +++ b/src/order-theory/decidable-total-orders.lagda.md @@ -76,6 +76,11 @@ module _ is-total-Poset (poset-Decidable-Total-Order) is-total-poset-Decidable-Total-Order = pr1 (pr2 P) + total-order-Decidable-Total-Order : Total-Order l1 l2 + total-order-Decidable-Total-Order = + ( poset-Decidable-Total-Order , + is-total-poset-Decidable-Total-Order) + is-decidable-poset-Decidable-Total-Order : is-decidable-leq-Poset (poset-Decidable-Total-Order) is-decidable-poset-Decidable-Total-Order = pr2 (pr2 P) @@ -200,22 +205,19 @@ module _ module _ {l1 l2 : Level} (T : Decidable-Total-Order l1 l2) - (x y : type-Decidable-Total-Order T) where - min-Decidable-Total-Order : type-Decidable-Total-Order T + min-Decidable-Total-Order : + type-Decidable-Total-Order T → type-Decidable-Total-Order T → + type-Decidable-Total-Order T min-Decidable-Total-Order = - rec-coproduct - ( λ x≤y → x) - ( λ yImports ```agda +open import foundation.action-on-identifications-functions open import foundation.binary-relations open import foundation.dependent-pair-types +open import foundation.disjunction open import foundation.identity-types open import foundation.propositions open import foundation.sets open import foundation.universe-levels +open import order-theory.greatest-lower-bounds-posets +open import order-theory.join-semilattices +open import order-theory.least-upper-bounds-posets +open import order-theory.meet-semilattices open import order-theory.posets open import order-theory.preorders open import order-theory.total-preorders @@ -118,6 +124,401 @@ module _ set-Total-Order = set-Poset poset-Total-Order ``` +### The maximum operation on a total order + +```agda +module _ + {l1 l2 : Level} (X : Total-Order l1 l2) + (x y : type-Total-Order X) + where + + opaque + has-least-binary-upper-bound-Total-Order : + has-least-binary-upper-bound-Poset (poset-Total-Order X) x y + has-least-binary-upper-bound-Total-Order = + elim-disjunction + ( has-least-binary-upper-bound-prop-Poset (poset-Total-Order X) x y) + ( has-least-binary-upper-bound-leq-Poset (poset-Total-Order X) x y) + ( λ y≤x → + symmetric-has-least-binary-upper-bound-Poset + ( poset-Total-Order X) + ( y) + ( x) + ( has-least-binary-upper-bound-leq-Poset + ( poset-Total-Order X) + ( y) + ( x) + ( y≤x))) + ( is-total-Total-Order X x y) + + max-Total-Order : type-Total-Order X + max-Total-Order = pr1 has-least-binary-upper-bound-Total-Order + + max-is-least-binary-upper-bound-Total-Order : + is-least-binary-upper-bound-Poset (poset-Total-Order X) x y max-Total-Order + max-is-least-binary-upper-bound-Total-Order = + pr2 has-least-binary-upper-bound-Total-Order +``` + +### The minimum operation on a total order + +```agda +module _ + {l1 l2 : Level} (X : Total-Order l1 l2) + (x y : type-Total-Order X) + where + + opaque + has-greatest-binary-lower-bound-Total-Order : + has-greatest-binary-lower-bound-Poset (poset-Total-Order X) x y + has-greatest-binary-lower-bound-Total-Order = + elim-disjunction + ( has-greatest-binary-lower-bound-prop-Poset (poset-Total-Order X) x y) + ( has-greatest-binary-lower-bound-leq-Poset + ( poset-Total-Order X) + ( x) + ( y)) + ( λ y≤x → + symmetric-has-greatest-binary-lower-bound-Poset + ( poset-Total-Order X) + ( y) + ( x) + ( has-greatest-binary-lower-bound-leq-Poset + ( poset-Total-Order X) + ( y) + ( x) + ( y≤x))) + ( is-total-Total-Order X x y) + + min-Total-Order : type-Total-Order X + min-Total-Order = pr1 has-greatest-binary-lower-bound-Total-Order + + min-is-greatest-binary-lower-bound-Total-Order : + is-greatest-binary-lower-bound-Poset + ( poset-Total-Order X) + ( x) + ( y) + ( min-Total-Order) + min-is-greatest-binary-lower-bound-Total-Order = + pr2 has-greatest-binary-lower-bound-Total-Order +``` + +## Properties + +### The minimum of two values is a lower bound + +```agda +module _ + {l1 l2 : Level} + (T : Total-Order l1 l2) + (x y : type-Total-Order T) + where + + leq-left-min-Total-Order : + leq-Total-Order T (min-Total-Order T x y) x + leq-left-min-Total-Order = + leq-left-is-greatest-binary-lower-bound-Poset + ( poset-Total-Order T) + ( min-is-greatest-binary-lower-bound-Total-Order T x y) + + leq-right-min-Total-Order : + leq-Total-Order T (min-Total-Order T x y) y + leq-right-min-Total-Order = + leq-right-is-greatest-binary-lower-bound-Poset + ( poset-Total-Order T) + ( min-is-greatest-binary-lower-bound-Total-Order T x y) +``` + +### The maximum of two values is an upper bound + +```agda +module _ + {l1 l2 : Level} + (T : Total-Order l1 l2) + (x y : type-Total-Order T) + where + + leq-left-max-Total-Order : + leq-Total-Order T x (max-Total-Order T x y) + leq-left-max-Total-Order = + leq-left-is-least-binary-upper-bound-Poset + ( poset-Total-Order T) + ( max-is-least-binary-upper-bound-Total-Order T x y) + + leq-right-max-Total-Order : + leq-Total-Order T y (max-Total-Order T x y) + leq-right-max-Total-Order = + leq-right-is-least-binary-upper-bound-Poset + ( poset-Total-Order T) + ( max-is-least-binary-upper-bound-Total-Order T x y) +``` + +### Total orders are meet semilattices + +```agda +module _ + {l1 l2 : Level} + (T : Total-Order l1 l2) + where + + is-meet-semilattice-Total-Order : + is-meet-semilattice-Poset (poset-Total-Order T) + is-meet-semilattice-Total-Order = + has-greatest-binary-lower-bound-Total-Order T + + order-theoretic-meet-semilattice-Total-Order : + Order-Theoretic-Meet-Semilattice l1 l2 + order-theoretic-meet-semilattice-Total-Order = + poset-Total-Order T , is-meet-semilattice-Total-Order +``` + +### Total orders are join semilattices + +```agda +module _ + {l1 l2 : Level} + (T : Total-Order l1 l2) + where + + is-join-semilattice-Total-Order : + is-join-semilattice-Poset (poset-Total-Order T) + is-join-semilattice-Total-Order = + has-least-binary-upper-bound-Total-Order T + + order-theoretic-join-semilattice-Total-Order : + Order-Theoretic-Join-Semilattice l1 l2 + order-theoretic-join-semilattice-Total-Order = + poset-Total-Order T , is-join-semilattice-Total-Order +``` + +### The binary minimum operation is associative + +```agda +module _ + {l1 l2 : Level} + (T : Total-Order l1 l2) + where + + associative-min-Total-Order : + (x y z : type-Total-Order T) → + min-Total-Order T (min-Total-Order T x y) z = + min-Total-Order T x (min-Total-Order T y z) + associative-min-Total-Order = + associative-meet-Order-Theoretic-Meet-Semilattice + ( order-theoretic-meet-semilattice-Total-Order T) +``` + +### The binary maximum operation is associative + +```agda +module _ + {l1 l2 : Level} + (T : Total-Order l1 l2) + where + + associative-max-Total-Order : + (x y z : type-Total-Order T) → + max-Total-Order T (max-Total-Order T x y) z = + max-Total-Order T x (max-Total-Order T y z) + associative-max-Total-Order = + associative-join-Order-Theoretic-Join-Semilattice + ( order-theoretic-join-semilattice-Total-Order T) +``` + +### The binary minimum operation is commutative + +```agda +module _ + {l1 l2 : Level} + (T : Total-Order l1 l2) + where + + commutative-min-Total-Order : + (x y : type-Total-Order T) → + min-Total-Order T x y = min-Total-Order T y x + commutative-min-Total-Order = + commutative-meet-Order-Theoretic-Meet-Semilattice + ( order-theoretic-meet-semilattice-Total-Order T) +``` + +### The binary maximum operation is commutative + +```agda +module _ + {l1 l2 : Level} + (T : Total-Order l1 l2) + where + + commutative-max-Total-Order : + (x y : type-Total-Order T) → + max-Total-Order T x y = max-Total-Order T y x + commutative-max-Total-Order = + commutative-join-Order-Theoretic-Join-Semilattice + ( order-theoretic-join-semilattice-Total-Order T) +``` + +### The binary minimum operation is idempotent + +```agda +module _ + {l1 l2 : Level} + (T : Total-Order l1 l2) + where + + idempotent-min-Total-Order : + (x : type-Total-Order T) → + min-Total-Order T x x = x + idempotent-min-Total-Order = + idempotent-meet-Order-Theoretic-Meet-Semilattice + ( order-theoretic-meet-semilattice-Total-Order T) +``` + +### The binary maximum operation is idempotent + +```agda +module _ + {l1 l2 : Level} + (T : Total-Order l1 l2) + where + + idempotent-max-Total-Order : + (x : type-Total-Order T) → + max-Total-Order T x x = x + idempotent-max-Total-Order = + idempotent-join-Order-Theoretic-Join-Semilattice + ( order-theoretic-join-semilattice-Total-Order T) +``` + +### If `x` is less than or equal to `y`, the minimum of `x` and `y` is `x` + +```agda +module _ + {l1 l2 : Level} + (T : Total-Order l1 l2) + where + + abstract + left-leq-right-min-Total-Order : + (x y : type-Total-Order T) → + leq-Total-Order T x y → min-Total-Order T x y = x + left-leq-right-min-Total-Order x y x≤y = + ap pr1 + ( eq-type-Prop + ( has-greatest-binary-lower-bound-prop-Poset + ( poset-Total-Order T) + ( x) + ( y)) + { has-greatest-binary-lower-bound-Total-Order T x y} + { has-greatest-binary-lower-bound-leq-Poset + ( poset-Total-Order T) + ( x) + ( y) + ( x≤y)}) +``` + +### If `y` is less than or equal to `x`, the minimum of `x` and `y` is `x` + +```agda +module _ + {l1 l2 : Level} + (T : Total-Order l1 l2) + where + + abstract + right-leq-left-min-Total-Order : + (x y : type-Total-Order T) → + leq-Total-Order T y x → min-Total-Order T x y = y + right-leq-left-min-Total-Order x y y≤x = + commutative-min-Total-Order T x y ∙ + left-leq-right-min-Total-Order T y x y≤x +``` + +### If `x` is less than or equal to `y`, the maximum of `x` and `y` is `y` + +```agda +module _ + {l1 l2 : Level} + (T : Total-Order l1 l2) + where + + abstract + left-leq-right-max-Total-Order : + (x y : type-Total-Order T) → + leq-Total-Order T x y → max-Total-Order T x y = y + left-leq-right-max-Total-Order x y x≤y = + ap pr1 + ( eq-type-Prop + ( has-least-binary-upper-bound-prop-Poset + ( poset-Total-Order T) + ( x) + ( y)) + { has-least-binary-upper-bound-Total-Order T x y} + { has-least-binary-upper-bound-leq-Poset + ( poset-Total-Order T) + ( x) + ( y) + ( x≤y)}) +``` + +### If `y` is less than or equal to `x`, the maximum of `x` and `y` is `x` + +```agda +module _ + {l1 l2 : Level} + (T : Total-Order l1 l2) + where + + abstract + right-leq-left-max-Total-Order : + (x y : type-Total-Order T) → + leq-Total-Order T y x → max-Total-Order T x y = x + right-leq-left-max-Total-Order x y y≤x = + commutative-max-Total-Order T x y ∙ + left-leq-right-max-Total-Order T y x y≤x +``` + +### If `a ≤ b` and `c ≤ d`, then `min a c ≤ min b d` + +```agda +module _ + {l1 l2 : Level} + (T : Total-Order l1 l2) + where + + abstract + min-leq-leq-Total-Order : + (a b c d : type-Total-Order T) → + leq-Total-Order T a b → leq-Total-Order T c d → + leq-Total-Order + ( T) + ( min-Total-Order T a c) + ( min-Total-Order T b d) + min-leq-leq-Total-Order = + meet-leq-leq-Order-Theoretic-Meet-Semilattice + ( order-theoretic-meet-semilattice-Total-Order T) +``` + +### If `a ≤ b` and `c ≤ d`, then `max a c ≤ max b d` + +```agda +module _ + {l1 l2 : Level} + (T : Total-Order l1 l2) + where + + abstract + max-leq-leq-Total-Order : + (a b c d : type-Total-Order T) → + leq-Total-Order T a b → leq-Total-Order T c d → + leq-Total-Order + ( T) + ( max-Total-Order T a c) + ( max-Total-Order T b d) + max-leq-leq-Total-Order = + join-leq-leq-Order-Theoretic-Join-Semilattice + ( order-theoretic-join-semilattice-Total-Order T) +``` + ## External links - [Total order](https://en.wikipedia.org/wiki/Total_order) at Wikipedia From d25255321da6cb817337d81e2eed7ac1f07ca8b1 Mon Sep 17 00:00:00 2001 From: malarbol Date: Sat, 30 Aug 2025 17:09:17 +0200 Subject: [PATCH 27/97] Arithmetic and geometric sequences in semirings (#1475) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR introduces the following concepts - Gauss summation of triangular numbers: the nth triangular number is `Tₙ = Σ (k ≤ n) k = n(n+1)/2`; (theorem 68.1 of [100 theorems](https://www.cs.ru.nl/~freek/100/)); - the initial semiring homomorphism `map-nat-Semiring : ℕ → R`; - arithmetic sequences in semirings: arithmetic sequences in the additive semigroup of the semiring; - geometric sequences in semirings: arithmetic sequences in the multiplicative semigroup of the semiring; - sequences of partial sums `n ↦ Σ (k ≤ n) (u k)` for some sequence `u` in a semiring; - arithmetic series in semirings: sequences `n ↦ Σ (k ≤ n) (u k)` for some arithmetic sequence `u` in a semiring; formula `Σ (i ≤ n) (a + i * d) = (n + 1) * a + Tₙ * d` where `Tₙ` is the nth triangular number (theorem 68.2 of [100 theorems](https://www.cs.ru.nl/~freek/100/)). --------- Co-authored-by: Louis Wasserman --- config/codespell-dictionary.txt | 1 + ...ative-semiring-of-natural-numbers.lagda.md | 124 ++++++++ .../triangular-numbers.lagda.md | 85 ++++++ .../arithmetic-sequences-semigroups.lagda.md | 2 +- src/lists/finite-sequences.lagda.md | 35 +++ src/literature/100-theorems.lagda.md | 11 + src/ring-theory.lagda.md | 4 + .../arithmetic-sequences-semirings.lagda.md | 270 +++++++++++++++++ .../arithmetic-series-semirings.lagda.md | 261 +++++++++++++++++ .../geometric-sequences-semirings.lagda.md | 272 ++++++++++++++++++ .../partial-sums-sequences-semirings.lagda.md | 70 +++++ src/ring-theory/semirings.lagda.md | 12 + ...e-sequences-of-elements-semirings.lagda.md | 18 ++ 13 files changed, 1164 insertions(+), 1 deletion(-) create mode 100644 src/ring-theory/arithmetic-sequences-semirings.lagda.md create mode 100644 src/ring-theory/arithmetic-series-semirings.lagda.md create mode 100644 src/ring-theory/geometric-sequences-semirings.lagda.md create mode 100644 src/ring-theory/partial-sums-sequences-semirings.lagda.md diff --git a/config/codespell-dictionary.txt b/config/codespell-dictionary.txt index 205c8c6f68..6d7db3c936 100644 --- a/config/codespell-dictionary.txt +++ b/config/codespell-dictionary.txt @@ -31,6 +31,7 @@ epimorhpsims->epimorphisms epimorphsim->epimorphism epimorphsims->epimorphisms foundaiton->foundation +geomeric->geometric homomorhpism->homomorphism homomorhpisms->homomorphisms homomorhpsim->homomorphism diff --git a/src/elementary-number-theory/commutative-semiring-of-natural-numbers.lagda.md b/src/elementary-number-theory/commutative-semiring-of-natural-numbers.lagda.md index 45f3324d10..2346b3328f 100644 --- a/src/elementary-number-theory/commutative-semiring-of-natural-numbers.lagda.md +++ b/src/elementary-number-theory/commutative-semiring-of-natural-numbers.lagda.md @@ -9,17 +9,40 @@ module elementary-number-theory.commutative-semiring-of-natural-numbers where ```agda open import commutative-algebra.commutative-semirings +open import elementary-number-theory.addition-natural-numbers open import elementary-number-theory.monoid-of-natural-numbers-with-addition open import elementary-number-theory.multiplication-natural-numbers +open import elementary-number-theory.natural-numbers +open import foundation.action-on-identifications-functions +open import foundation.contractible-types open import foundation.dependent-pair-types +open import foundation.function-types +open import foundation.homotopies +open import foundation.identity-types open import foundation.universe-levels +open import group-theory.homomorphisms-commutative-monoids + +open import ring-theory.homomorphisms-semirings open import ring-theory.semirings ``` +## Idea + +The type of [natural numbers](elementary-number-theory.natural-numbers.md) +equipped with [addition](elementary-number-theory.addition-natural-numbers.md) +and [multiplication](elementary-number-theory.multiplication-natural-numbers.md) +is a [commutative semiring](commutative-algebra.commutative-semirings.md). + +The {{#concept "semiring of natural numbers" Agda=ℕ-Semiring}} is the +**initial** semiring: for any semiring `R`, there's a unique +[semiring homomorphism](ring-theory.homomorphisms-semirings.md) from `ℕ` to `R`, +i.e., the type of semiring homomorphisms `hom-Semiring ℕ-Semiring R` is +[contractible](foundation.contractible-types.md). + ## Definition ### The commutative semiring of natural numbers @@ -45,3 +68,104 @@ pr2 (pr2 (pr2 ℕ-Semiring)) = right-zero-law-mul-ℕ pr1 ℕ-Commutative-Semiring = ℕ-Semiring pr2 ℕ-Commutative-Semiring = commutative-mul-ℕ ``` + +### The initial inclusion of the natural numbers in a semiring + +```agda +module _ + {l : Level} (R : Semiring l) + where + + map-nat-Semiring : ℕ → type-Semiring R + map-nat-Semiring n = mul-nat-scalar-Semiring R n (one-Semiring R) + + htpy-mul-map-mul-nat-scalar-Semiring : + (n : ℕ) → + mul-Semiring R (map-nat-Semiring n) ~ + mul-nat-scalar-Semiring R n + htpy-mul-map-mul-nat-scalar-Semiring n x = + ( left-nat-scalar-law-mul-Semiring R n (one-Semiring R) x) ∙ + ( ap (mul-nat-scalar-Semiring R n) (left-unit-law-mul-Semiring R x)) + + preserves-add-map-nat-Semiring : + (m n : ℕ) → + map-nat-Semiring (m +ℕ n) = + add-Semiring + ( R) + ( map-nat-Semiring m) + ( map-nat-Semiring n) + preserves-add-map-nat-Semiring m n = + right-distributive-mul-nat-scalar-add-Semiring + ( R) + ( m) + ( n) + ( one-Semiring R) + + preserves-one-map-nat-Semiring : + map-nat-Semiring 1 = one-Semiring R + preserves-one-map-nat-Semiring = + left-unit-law-mul-nat-scalar-Semiring R (one-Semiring R) + + preserves-mul-map-nat-Semiring : + (m n : ℕ) → + map-nat-Semiring (m *ℕ n) = + mul-Semiring + ( R) + ( map-nat-Semiring m) + ( map-nat-Semiring n) + preserves-mul-map-nat-Semiring m n = + htpy-comp-mul-nat-mul-Semiring R m n (one-Semiring R) ∙ + inv (htpy-mul-map-mul-nat-scalar-Semiring m (map-nat-Semiring n)) + +module _ + {l : Level} (R : Semiring l) + where + + initial-hom-Semiring : hom-Semiring ℕ-Semiring R + pr1 (pr1 initial-hom-Semiring) = + ( map-nat-Semiring R , + λ {m n} → preserves-add-map-nat-Semiring R m n) + pr2 (pr1 initial-hom-Semiring) = + left-zero-law-mul-nat-scalar-Semiring R (one-Semiring R) + pr1 (pr2 initial-hom-Semiring) {m} {n} = + preserves-mul-map-nat-Semiring R m n + pr2 (pr2 initial-hom-Semiring) = + preserves-one-map-nat-Semiring R +``` + +### Any semiring homomorphism from `ℕ` to a semiring is the initial inclusion + +```agda +module _ + {l : Level} (R : Semiring l) (f : hom-Semiring ℕ-Semiring R) + where + + htpy-map-nat-hom-Semiring : + map-nat-Semiring R ~ map-hom-Semiring ℕ-Semiring R f + htpy-map-nat-hom-Semiring zero-ℕ = + inv (preserves-zero-hom-Semiring ℕ-Semiring R f) + htpy-map-nat-hom-Semiring (succ-ℕ n) = + ( ap-add-Semiring + ( R) + ( htpy-map-nat-hom-Semiring n) + ( inv (preserves-unit-hom-Semiring ℕ-Semiring R f))) ∙ + ( inv (preserves-addition-hom-Semiring ℕ-Semiring R f)) +``` + +### The type of semiring homomorphisms from `ℕ` to a semiring is contractible + +```agda +module _ + {l : Level} (R : Semiring l) + where + + is-initial-semiring-ℕ : is-contr (hom-Semiring ℕ-Semiring R) + pr1 is-initial-semiring-ℕ = initial-hom-Semiring R + pr2 is-initial-semiring-ℕ f = + eq-htpy-hom-Semiring + ( ℕ-Semiring) + ( R) + ( initial-hom-Semiring R) + ( f) + ( htpy-map-nat-hom-Semiring R f) +``` diff --git a/src/elementary-number-theory/triangular-numbers.lagda.md b/src/elementary-number-theory/triangular-numbers.lagda.md index c7b19c3e58..474f4dc44d 100644 --- a/src/elementary-number-theory/triangular-numbers.lagda.md +++ b/src/elementary-number-theory/triangular-numbers.lagda.md @@ -8,15 +8,100 @@ module elementary-number-theory.triangular-numbers where ```agda open import elementary-number-theory.addition-natural-numbers +open import elementary-number-theory.commutative-semiring-of-natural-numbers +open import elementary-number-theory.divisibility-natural-numbers +open import elementary-number-theory.multiplication-natural-numbers open import elementary-number-theory.natural-numbers + +open import foundation.action-on-identifications-functions +open import foundation.dependent-pair-types +open import foundation.homotopies +open import foundation.identity-types +open import foundation.transport-along-identifications + +open import ring-theory.partial-sums-sequences-semirings +open import ring-theory.sums-of-finite-sequences-of-elements-semirings ``` +## Idea + +{{#concept "Triangular numbers" WD="triangular number" WDID=Q245102 OEIS=A000217 Agda=triangular-number-ℕ}} +are the sequence of +[natural numbers](elementary-number-theory.natural-numbers.md) `Tₙ` defined by: + +- `T₀ = 0`; +- `Tₙ₊₁ = Tₙ + n + 1`. + +I.e., `Tₙ = Σ (k ≤ n) k`. The nth triangular number is equal to `n(n+1)/2`. + ## Definition +### Triangular numbers + ```agda triangular-number-ℕ : ℕ → ℕ triangular-number-ℕ 0 = 0 triangular-number-ℕ (succ-ℕ n) = (triangular-number-ℕ n) +ℕ (succ-ℕ n) ``` + +### The sums `Σ (k ≤ n) k` + +```agda +sum-leq-ℕ : ℕ → ℕ +sum-leq-ℕ = seq-sum-sequence-Semiring ℕ-Semiring (λ k → k) +``` + +## Properties + +### The nth triangular number is the sum `Σ (k ≤ n) k` + +```agda +htpy-sum-leq-triangular-ℕ : triangular-number-ℕ ~ sum-leq-ℕ +htpy-sum-leq-triangular-ℕ zero-ℕ = refl +htpy-sum-leq-triangular-ℕ (succ-ℕ n) = + ap (add-ℕ' (succ-ℕ n)) (htpy-sum-leq-triangular-ℕ n) +``` + +### Twice the nth triangular number is `n(n+1)` + +```agda +compute-twice-triangular-number-ℕ : + (n : ℕ) → (triangular-number-ℕ n) +ℕ (triangular-number-ℕ n) = n *ℕ succ-ℕ n +compute-twice-triangular-number-ℕ zero-ℕ = refl +compute-twice-triangular-number-ℕ (succ-ℕ n) = + ( interchange-law-add-add-ℕ + ( triangular-number-ℕ n) + ( succ-ℕ n) + ( triangular-number-ℕ n) + ( succ-ℕ n)) ∙ + ( ap-add-ℕ + ( compute-twice-triangular-number-ℕ n) + ( inv (left-two-law-mul-ℕ (succ-ℕ n)))) ∙ + ( inv (right-distributive-mul-add-ℕ n 2 (succ-ℕ n))) ∙ + ( commutative-mul-ℕ (n +ℕ 2) (succ-ℕ n)) +``` + +### The nth triangular number is `n(n+1)/2` + +```agda +module _ + (n : ℕ) + where + + compute-triangular-number-ℕ : + Σ ( div-ℕ 2 (n *ℕ succ-ℕ n)) + ( λ H → quotient-div-ℕ 2 (n *ℕ succ-ℕ n) H = triangular-number-ℕ n) + pr1 (pr1 compute-triangular-number-ℕ) = triangular-number-ℕ n + pr2 (pr1 compute-triangular-number-ℕ) = + ( right-two-law-mul-ℕ (triangular-number-ℕ n)) ∙ + ( compute-twice-triangular-number-ℕ n) + pr2 compute-triangular-number-ℕ = refl +``` + +## External references + +- [Triangular number](https://en.wikipedia.org/wiki/Triangular_number) at + Wikipedia. +- [A000217](https://oeis.org/A000217) in the OEIS diff --git a/src/group-theory/arithmetic-sequences-semigroups.lagda.md b/src/group-theory/arithmetic-sequences-semigroups.lagda.md index 8eea990892..91845eda0e 100644 --- a/src/group-theory/arithmetic-sequences-semigroups.lagda.md +++ b/src/group-theory/arithmetic-sequences-semigroups.lagda.md @@ -163,7 +163,7 @@ module _ ( eq-common-difference)) ``` -### Any arithmetic sequence in a semigroup is standard +### Any arithmetic sequence in a semigroup is homotopic to a standard arithmetic sequence ```agda module _ diff --git a/src/lists/finite-sequences.lagda.md b/src/lists/finite-sequences.lagda.md index 876b6e4d1f..2a12be3f5a 100644 --- a/src/lists/finite-sequences.lagda.md +++ b/src/lists/finite-sequences.lagda.md @@ -9,12 +9,14 @@ module lists.finite-sequences where ```agda open import elementary-number-theory.natural-numbers +open import foundation.action-on-identifications-functions open import foundation.coproduct-types open import foundation.dependent-pair-types open import foundation.function-extensionality open import foundation.function-types open import foundation.homotopies open import foundation.identity-types +open import foundation.sequences open import foundation.sets open import foundation.truncated-types open import foundation.truncation-levels @@ -142,6 +144,39 @@ module _ eq-htpy (htpy-cons-head-tail-fin-sequence n v) ``` +### Any sequence `u` in a type determines a sequence of finite sequences `(i : Fin n) ↦ u i` + +```agda +module _ + {l : Level} {A : UU l} (u : sequence A) + where + + fin-sequence-sequence : (n : ℕ) → fin-sequence A n + fin-sequence-sequence n i = u (nat-Fin n i) + + eq-fin-sequence-sequence : + (n : ℕ) → fin-sequence-sequence (succ-ℕ n) (neg-one-Fin n) = u n + eq-fin-sequence-sequence n = refl + + eq-zero-fin-sequence-sequence : + (n : ℕ) → fin-sequence-sequence (succ-ℕ n) (zero-Fin n) = u 0 + eq-zero-fin-sequence-sequence n = ap u (is-zero-nat-zero-Fin {n}) + + eq-skip-zero-fin-sequence-sequence : + (n : ℕ) (i : Fin n) → + fin-sequence-sequence (succ-ℕ n) (skip-zero-Fin n i) = + u (succ-ℕ (nat-Fin n i)) + eq-skip-zero-fin-sequence-sequence n i = ap u (nat-skip-zero-Fin n i) + +module _ + {l : Level} {A : UU l} (u v : sequence A) (H : u ~ v) + where + + htpy-fin-sequence-sequence : + (n : ℕ) → fin-sequence-sequence u n ~ fin-sequence-sequence v n + htpy-fin-sequence-sequence n i = H (nat-Fin n i) +``` + ## See also - [Sequences](foundation.sequences.md) diff --git a/src/literature/100-theorems.lagda.md b/src/literature/100-theorems.lagda.md index e8ffeaa895..b855eca865 100644 --- a/src/literature/100-theorems.lagda.md +++ b/src/literature/100-theorems.lagda.md @@ -106,6 +106,17 @@ open import foundation.cantors-theorem using ( theorem-Cantor) ``` +### 68. Sum of an arithmetic series {#68} + +**Author:** [malarbol](http://www.github.com/malarbol) + +```agda +open import elementary-number-theory.triangular-numbers using + ( compute-triangular-number-ℕ) +open import ring-theory.arithmetic-series-semirings using + ( compute-sum-add-mul-nat-Semiring) +``` + ### 69. Greatest common divisor algorithm {#69} **Author:** [Egbert Rijke](https://egbertrijke.github.io) diff --git a/src/ring-theory.lagda.md b/src/ring-theory.lagda.md index c76901da84..a16c402daf 100644 --- a/src/ring-theory.lagda.md +++ b/src/ring-theory.lagda.md @@ -7,6 +7,8 @@ module ring-theory where open import ring-theory.additive-orders-of-elements-rings public open import ring-theory.algebras-rings public +open import ring-theory.arithmetic-sequences-semirings public +open import ring-theory.arithmetic-series-semirings public open import ring-theory.binomial-theorem-rings public open import ring-theory.binomial-theorem-semirings public open import ring-theory.category-of-cyclic-rings public @@ -27,6 +29,7 @@ open import ring-theory.full-ideals-rings public open import ring-theory.function-rings public open import ring-theory.function-semirings public open import ring-theory.generating-elements-rings public +open import ring-theory.geometric-sequences-semirings public open import ring-theory.groups-of-units-rings public open import ring-theory.homomorphisms-cyclic-rings public open import ring-theory.homomorphisms-ring-extensions-rational-numbers public @@ -59,6 +62,7 @@ open import ring-theory.nilpotent-elements-rings public open import ring-theory.nilpotent-elements-semirings public open import ring-theory.opposite-ring-extensions-rational-numbers public open import ring-theory.opposite-rings public +open import ring-theory.partial-sums-sequences-semirings public open import ring-theory.poset-of-cyclic-rings public open import ring-theory.poset-of-ideals-rings public open import ring-theory.poset-of-left-ideals-rings public diff --git a/src/ring-theory/arithmetic-sequences-semirings.lagda.md b/src/ring-theory/arithmetic-sequences-semirings.lagda.md new file mode 100644 index 0000000000..e8259ab286 --- /dev/null +++ b/src/ring-theory/arithmetic-sequences-semirings.lagda.md @@ -0,0 +1,270 @@ +# Arithmetic sequences in semirings + +```agda +module ring-theory.arithmetic-sequences-semirings where +``` + +
Imports + +```agda +open import elementary-number-theory.natural-numbers + +open import foundation.action-on-identifications-binary-functions +open import foundation.action-on-identifications-functions +open import foundation.binary-transport +open import foundation.dependent-pair-types +open import foundation.homotopies +open import foundation.identity-types +open import foundation.propositions +open import foundation.sequences +open import foundation.sets +open import foundation.universe-levels + +open import group-theory.arithmetic-sequences-semigroups + +open import ring-theory.semirings +``` + +
+ +## Ideas + +An +{{#concept "arithmetic sequence" Disambiguation="in a semiring" Agda=arithmetic-sequence-Semiring}} +in a [semiring](ring-theory.semirings.md) is an +[arithmetic sequence](group-theory.arithmetic-sequences-semigroups.md) in the +semiring's additive [semigroup](group-theory.semigroups.md). + +These are the sequences `n ↦ a + n * d` for some elements `a d` in the semiring. + +## Definitions + +### Arithmetic sequences in semirings + +```agda +module _ + {l : Level} (R : Semiring l) + where + + arithmetic-sequence-Semiring : UU l + arithmetic-sequence-Semiring = + arithmetic-sequence-Semigroup + ( additive-semigroup-Semiring R) + +module _ + {l : Level} (R : Semiring l) + (u : arithmetic-sequence-Semiring R) + where + + seq-arithmetic-sequence-Semiring : ℕ → type-Semiring R + seq-arithmetic-sequence-Semiring = + seq-arithmetic-sequence-Semigroup + ( additive-semigroup-Semiring R) + ( u) + + is-arithmetic-seq-arithmetic-sequence-Semiring : + is-arithmetic-sequence-Semigroup + ( additive-semigroup-Semiring R) + ( seq-arithmetic-sequence-Semiring) + is-arithmetic-seq-arithmetic-sequence-Semiring = + is-arithmetic-seq-arithmetic-sequence-Semigroup + ( additive-semigroup-Semiring R) + ( u) + + common-difference-arithmetic-sequence-Semiring : type-Semiring R + common-difference-arithmetic-sequence-Semiring = + common-difference-arithmetic-sequence-Semigroup + ( additive-semigroup-Semiring R) + ( u) + + is-common-difference-arithmetic-sequence-Semiring : + ( n : ℕ) → + ( seq-arithmetic-sequence-Semiring (succ-ℕ n)) = + ( add-Semiring + ( R) + ( seq-arithmetic-sequence-Semiring n) + ( common-difference-arithmetic-sequence-Semiring)) + is-common-difference-arithmetic-sequence-Semiring = + is-common-difference-arithmetic-sequence-Semigroup + ( additive-semigroup-Semiring R) + ( u) + + initial-term-arithmetic-sequence-Semiring : type-Semiring R + initial-term-arithmetic-sequence-Semiring = + initial-term-arithmetic-sequence-Semigroup + ( additive-semigroup-Semiring R) + ( u) +``` + +### The standard arithmetic sequences in a semiring + +The standard arithmetic sequence with initial term `a` and common difference `d` +is the sequence `u` defined by: + +- `u₀ = a` +- `uₙ₊₁ = uₙ + d` + +```agda +module _ + {l : Level} (R : Semiring l) (a d : type-Semiring R) + where + + standard-arithmetic-sequence-Semiring : arithmetic-sequence-Semiring R + standard-arithmetic-sequence-Semiring = + standard-arithmetic-sequence-Semigroup + ( additive-semigroup-Semiring R) + ( a) + ( d) + + seq-standard-arithmetic-sequence-Semiring : ℕ → type-Semiring R + seq-standard-arithmetic-sequence-Semiring = + seq-arithmetic-sequence-Semiring R + standard-arithmetic-sequence-Semiring + + is-arithmetic-standard-arithmetic-sequence-Semiring : + is-arithmetic-sequence-Semigroup + ( additive-semigroup-Semiring R) + ( seq-standard-arithmetic-sequence-Semiring) + is-arithmetic-standard-arithmetic-sequence-Semiring = + is-arithmetic-seq-arithmetic-sequence-Semiring R + standard-arithmetic-sequence-Semiring +``` + +### The arithmetic sequences `n ↦ a + n * d` + +```agda +module _ + {l : Level} (R : Semiring l) (a d : type-Semiring R) + where + + add-mul-nat-Semiring : ℕ → type-Semiring R + add-mul-nat-Semiring n = + add-Semiring R a (mul-nat-scalar-Semiring R n d) + + is-common-difference-add-mul-nat-Semiring : + is-common-difference-sequence-Semigroup + ( additive-semigroup-Semiring R) + ( add-mul-nat-Semiring) + ( d) + is-common-difference-add-mul-nat-Semiring n = + inv + ( associative-add-Semiring + ( R) + ( a) + ( mul-nat-scalar-Semiring R n d) + ( d)) + + is-arithmetic-add-mul-nat-Semiring : + is-arithmetic-sequence-Semigroup + ( additive-semigroup-Semiring R) + ( add-mul-nat-Semiring) + is-arithmetic-add-mul-nat-Semiring = + ( d , is-common-difference-add-mul-nat-Semiring) + + arithmetic-add-mul-nat-Semiring : arithmetic-sequence-Semiring R + arithmetic-add-mul-nat-Semiring = + ( add-mul-nat-Semiring , is-arithmetic-add-mul-nat-Semiring) + + initial-term-add-mul-nat-Semiring : type-Semiring R + initial-term-add-mul-nat-Semiring = + initial-term-arithmetic-sequence-Semiring + ( R) + ( arithmetic-add-mul-nat-Semiring) + + eq-initial-term-add-mul-nat-Semiring : + initial-term-add-mul-nat-Semiring = a + eq-initial-term-add-mul-nat-Semiring = + ( ( ap + ( add-Semiring R a) + ( inv (left-zero-law-mul-nat-scalar-Semiring R d))) ∙ + ( right-unit-law-add-Semiring R a)) +``` + +## Properties + +### Any arithmetic sequence in a semiring is homotopic to a standard arithmetic sequence + +```agda +module _ + {l : Level} (R : Semiring l) + (u : arithmetic-sequence-Semiring R) + where + + htpy-seq-standard-arithmetic-sequence-Semiring : + ( seq-arithmetic-sequence-Semiring R + ( standard-arithmetic-sequence-Semiring R + ( initial-term-arithmetic-sequence-Semiring R u) + ( common-difference-arithmetic-sequence-Semiring R u))) ~ + ( seq-arithmetic-sequence-Semiring R u) + htpy-seq-standard-arithmetic-sequence-Semiring = + htpy-seq-standard-arithmetic-sequence-Semigroup + ( additive-semigroup-Semiring R) + ( u) +``` + +### The nth term of an arithmetic sequence with initial term `a` and common difference `d` is `a + n * d` + +```agda +module _ + {l : Level} (R : Semiring l) (a d : type-Semiring R) + where + + htpy-add-mul-standard-arithmetic-sequence-Semiring : + add-mul-nat-Semiring R a d ~ seq-standard-arithmetic-sequence-Semiring R a d + htpy-add-mul-standard-arithmetic-sequence-Semiring = + htpy-seq-arithmetic-sequence-Semigroup + ( additive-semigroup-Semiring R) + ( arithmetic-add-mul-nat-Semiring R a d) + ( standard-arithmetic-sequence-Semiring R a d) + ( eq-initial-term-add-mul-nat-Semiring R a d) + ( refl) +``` + +```agda +module _ + {l : Level} (R : Semiring l) (u : arithmetic-sequence-Semiring R) + where + + htpy-add-mul-arithmetic-sequence-Semiring : + add-mul-nat-Semiring + ( R) + ( initial-term-arithmetic-sequence-Semiring R u) + ( common-difference-arithmetic-sequence-Semiring R u) ~ + seq-arithmetic-sequence-Semiring R u + htpy-add-mul-arithmetic-sequence-Semiring n = + ( htpy-add-mul-standard-arithmetic-sequence-Semiring + ( R) + ( initial-term-arithmetic-sequence-Semiring R u) + ( common-difference-arithmetic-sequence-Semiring R u) + ( n)) ∙ + ( htpy-seq-standard-arithmetic-sequence-Semigroup + ( additive-semigroup-Semiring R) + ( u) + ( n)) +``` + +### Constant sequences are arithmetic with common difference zero + +```agda +module _ + {l : Level} (R : Semiring l) (a : type-Semiring R) + where + + zero-is-common-difference-const-sequence-Semiring : + is-common-difference-sequence-Semigroup + ( additive-semigroup-Semiring R) + ( λ _ → a) + ( zero-Semiring R) + zero-is-common-difference-const-sequence-Semiring n = + inv (right-unit-law-add-Semiring R a) + + arithmetic-const-sequence-Semiring : arithmetic-sequence-Semiring R + pr1 arithmetic-const-sequence-Semiring _ = a + pr2 arithmetic-const-sequence-Semiring = + ( zero-Semiring R , zero-is-common-difference-const-sequence-Semiring) +``` + +## External links + +- [Arithmetic progressions](https://en.wikipedia.org/wiki/Arithmetic_progression) + at Wikipedia diff --git a/src/ring-theory/arithmetic-series-semirings.lagda.md b/src/ring-theory/arithmetic-series-semirings.lagda.md new file mode 100644 index 0000000000..c36e5d0e8d --- /dev/null +++ b/src/ring-theory/arithmetic-series-semirings.lagda.md @@ -0,0 +1,261 @@ +# Arithmetic series in semirings + +```agda +module ring-theory.arithmetic-series-semirings where +``` + +
Imports + +```agda +open import elementary-number-theory.commutative-semiring-of-natural-numbers +open import elementary-number-theory.natural-numbers +open import elementary-number-theory.triangular-numbers + +open import foundation.action-on-identifications-binary-functions +open import foundation.action-on-identifications-functions +open import foundation.function-types +open import foundation.homotopies +open import foundation.identity-types +open import foundation.universe-levels + +open import lists.finite-sequences + +open import ring-theory.arithmetic-sequences-semirings +open import ring-theory.partial-sums-sequences-semirings +open import ring-theory.semirings +open import ring-theory.sums-of-finite-sequences-of-elements-semirings +``` + +
+ +## Ideas + +An +{{#concept "arithmetic series" Disambiguation="in a semiring" Agda=seq-sum-arithmetic-sequence-Semiring}} +in a [semiring](ring-theory.semirings.md) is the +[sequence](foundation.sequences.md) of +[partial sums](ring-theory.partial-sums-sequences-semirings.md) + +```text +n ↦ Σ (k ≤ n) (u k) +``` + +of some [arithmetic sequence](ring-theory.arithmetic-sequences-semirings.md) `u` +in the semiring. These are the sums + +```text +n ↦ Σ (k ≤ n) (a + k * d) = (n + 1) * a + Tₙ * d +``` + +for some elements `a d : R` in the semiring, where `Tₙ` is the nth +[triangular number](elementary-number-theory.triangular-numbers.md). + +## Definitions + +### The partial sums of terms of an arithmetic sequence in a semiring + +```agda +module _ + {l : Level} (R : Semiring l) + where + + seq-sum-arithmetic-sequence-Semiring : + arithmetic-sequence-Semiring R → ℕ → type-Semiring R + seq-sum-arithmetic-sequence-Semiring = + seq-sum-sequence-Semiring R ∘ + seq-arithmetic-sequence-Semiring R +``` + +### The partial sums of terms of a standard arithmetic sequence in a semiring + +```agda +module _ + {l : Level} (R : Semiring l) (a d : type-Semiring R) + where + + seq-sum-standard-arithmetic-sequence-Semiring : ℕ → type-Semiring R + seq-sum-standard-arithmetic-sequence-Semiring = + seq-sum-arithmetic-sequence-Semiring + ( R) + ( standard-arithmetic-sequence-Semiring R a d) +``` + +### The sums `Σ (i ≤ n) (a + i * d)` + +```agda +module _ + {l : Level} (R : Semiring l) (a d : type-Semiring R) + where + + seq-sum-add-mul-nat-Semiring : ℕ → type-Semiring R + seq-sum-add-mul-nat-Semiring = + seq-sum-arithmetic-sequence-Semiring + ( R) + ( arithmetic-add-mul-nat-Semiring R a d) +``` + +## Properties + +### The sum of terms of an arithmetic sequence is determined by its initial term and common differenence + +```agda +module _ + {l : Level} (R : Semiring l) + where + + htpy-sum-arithmetic-standard-arithmetic-sequence-Semiring : + ( u : arithmetic-sequence-Semiring R) → + ( seq-sum-standard-arithmetic-sequence-Semiring + ( R) + ( initial-term-arithmetic-sequence-Semiring R u) + ( common-difference-arithmetic-sequence-Semiring R u)) ~ + ( seq-sum-arithmetic-sequence-Semiring R u) + htpy-sum-arithmetic-standard-arithmetic-sequence-Semiring = + htpy-seq-sum-sequence-Semiring R ∘ + htpy-seq-standard-arithmetic-sequence-Semiring R +``` + +### The nth partial sum of terms of the standard arithmetic sequence with initial term `a` and common difference `d` is the sum `Σ (i ≤ n) (a + i * d)` + +```agda +module _ + {l : Level} (R : Semiring l) (a d : type-Semiring R) + where + + htpy-sum-standard-arithmetic-sequence-add-mul-nat-Semiring : + seq-sum-add-mul-nat-Semiring R a d ~ + seq-sum-standard-arithmetic-sequence-Semiring R a d + htpy-sum-standard-arithmetic-sequence-add-mul-nat-Semiring = + htpy-seq-sum-sequence-Semiring + ( R) + ( htpy-add-mul-standard-arithmetic-sequence-Semiring R a d) +``` + +### The sum `Σ (k ≤ n) k` in a semiring is the image of the nth triangular number + +```agda +module _ + {l : Level} (R : Semiring l) + where + + compute-sum-map-nat-Semiring : + ( n : ℕ) → + ( seq-sum-sequence-Semiring R (map-nat-Semiring R) n) = + ( map-nat-Semiring R (sum-leq-ℕ n)) + compute-sum-map-nat-Semiring zero-ℕ = + compute-sum-one-element-Semiring + ( R) + ( λ _ → zero-Semiring R) ∙ + ( inv (left-zero-law-mul-nat-scalar-Semiring R (one-Semiring R))) + compute-sum-map-nat-Semiring (succ-ℕ n) = + ap-binary + ( add-Semiring R) + ( compute-sum-map-nat-Semiring n) + ( inv (eq-fin-sequence-sequence (map-nat-Semiring R) (succ-ℕ n))) ∙ + inv + ( right-distributive-mul-nat-scalar-add-Semiring + ( R) + ( sum-leq-ℕ n) + ( succ-ℕ n) + ( one-Semiring R)) +``` + +### The sum `Σ (i ≤ n) (a + i * d)` is equal to `(n + 1) * a + Tₙ * d` where `Tₙ` is the nth triangular number + +```agda +module _ + {l : Level} (R : Semiring l) (a d : type-Semiring R) + where + + compute-sum-add-mul-nat-Semiring : + ( n : ℕ) → + add-Semiring + ( R) + ( mul-nat-scalar-Semiring R (succ-ℕ n) a) + ( mul-nat-scalar-Semiring + ( R) + ( triangular-number-ℕ n) + ( d)) = + seq-sum-add-mul-nat-Semiring R a d n + compute-sum-add-mul-nat-Semiring n = + ap-binary + ( add-Semiring R) + ( inv (eq-mul-nat-scalar-sum-const-fin-sequence-Semiring R a (succ-ℕ n))) + ( ( ap + ( λ i → mul-nat-scalar-Semiring R i d) + ( htpy-sum-leq-triangular-ℕ n)) ∙ + ( inv + ( htpy-mul-map-mul-nat-scalar-Semiring R (sum-leq-ℕ n) d)) ∙ + ( ap + ( mul-Semiring' R d) + ( inv (compute-sum-map-nat-Semiring R n))) ∙ + ( inv lemma-seq-sum-mul-nat)) ∙ + ( interchange-add-sum-fin-sequence-type-Semiring + ( R) + ( succ-ℕ n) + ( fin-sequence-sequence (λ _ → a) (succ-ℕ n)) + ( fin-sequence-sequence + ( λ k → mul-nat-scalar-Semiring R k d) + ( succ-ℕ n))) + where + + lemma-seq-sum-mul-nat : + ( seq-sum-sequence-Semiring + ( R) + ( λ i → mul-nat-scalar-Semiring R i d) + ( n)) = + ( mul-Semiring + ( R) + ( seq-sum-sequence-Semiring + ( R) + ( map-nat-Semiring R) + ( n)) + ( d)) + lemma-seq-sum-mul-nat = + inv + ( ( right-distributive-mul-sum-fin-sequence-type-Semiring + ( R) + ( succ-ℕ n) + ( fin-sequence-sequence + ( map-nat-Semiring R) + ( succ-ℕ n)) + ( d)) ∙ + ( htpy-seq-sum-sequence-Semiring + ( R) + ( λ i → htpy-mul-map-mul-nat-scalar-Semiring R i d) + ( n))) +``` + +### The nth term of an arithmetic sequence with initial term `a` and common difference `d` is equal to `(n + 1) * a + Tₙ * d` where `Tₙ` is the nth triangular number + +```agda +module _ + {l : Level} (R : Semiring l) (u : arithmetic-sequence-Semiring R) + where + + compute-sum-arithmetic-sequence-Semiring : + (n : ℕ) → + add-Semiring + ( R) + ( mul-nat-scalar-Semiring + ( R) + ( succ-ℕ n) + ( initial-term-arithmetic-sequence-Semiring R u)) + ( mul-nat-scalar-Semiring + ( R) + ( triangular-number-ℕ n) + ( common-difference-arithmetic-sequence-Semiring R u)) = + seq-sum-arithmetic-sequence-Semiring R u n + compute-sum-arithmetic-sequence-Semiring n = + ( compute-sum-add-mul-nat-Semiring + ( R) + ( initial-term-arithmetic-sequence-Semiring R u) + ( common-difference-arithmetic-sequence-Semiring R u) + ( n)) ∙ + ( htpy-sum-standard-arithmetic-sequence-add-mul-nat-Semiring + ( R) + ( initial-term-arithmetic-sequence-Semiring R u) + ( common-difference-arithmetic-sequence-Semiring R u) + ( n)) ∙ + ( htpy-sum-arithmetic-standard-arithmetic-sequence-Semiring R u n) +``` diff --git a/src/ring-theory/geometric-sequences-semirings.lagda.md b/src/ring-theory/geometric-sequences-semirings.lagda.md new file mode 100644 index 0000000000..384e558179 --- /dev/null +++ b/src/ring-theory/geometric-sequences-semirings.lagda.md @@ -0,0 +1,272 @@ +# Geometric sequences in semirings + +```agda +module ring-theory.geometric-sequences-semirings where +``` + +
Imports + +```agda +open import elementary-number-theory.natural-numbers + +open import foundation.action-on-identifications-binary-functions +open import foundation.action-on-identifications-functions +open import foundation.binary-transport +open import foundation.dependent-pair-types +open import foundation.homotopies +open import foundation.identity-types +open import foundation.propositions +open import foundation.sequences +open import foundation.sets +open import foundation.universe-levels + +open import group-theory.arithmetic-sequences-semigroups + +open import ring-theory.powers-of-elements-semirings +open import ring-theory.semirings +``` + +
+ +## Ideas + +A +{{#concept "geometric sequence" Disambiguation="in a semiring" Agda=geometric-sequence-Semiring}} +in a [semiring](ring-theory.semirings.md) is an +[arithmetic sequence](group-theory.arithmetic-sequences-semigroups.md) in the +semiring multiplicative [semigroup](group-theory.semigroups.md). + +These are sequences of the form `n ↦ a * rⁿ`, for elements `a`, `r` in the +semiring. + +## Definitions + +### Geometric sequences in semirings + +```agda +module _ + {l : Level} (R : Semiring l) + where + + geometric-sequence-Semiring : UU l + geometric-sequence-Semiring = + arithmetic-sequence-Semigroup + ( multiplicative-semigroup-Semiring R) + +module _ + {l : Level} (R : Semiring l) + (u : geometric-sequence-Semiring R) + where + + seq-geometric-sequence-Semiring : ℕ → type-Semiring R + seq-geometric-sequence-Semiring = + seq-arithmetic-sequence-Semigroup + ( multiplicative-semigroup-Semiring R) + ( u) + + is-geometric-seq-geometric-sequence-Semiring : + is-arithmetic-sequence-Semigroup + ( multiplicative-semigroup-Semiring R) + ( seq-geometric-sequence-Semiring) + is-geometric-seq-geometric-sequence-Semiring = + is-arithmetic-seq-arithmetic-sequence-Semigroup + ( multiplicative-semigroup-Semiring R) + ( u) + + common-ratio-geometric-sequence-Semiring : type-Semiring R + common-ratio-geometric-sequence-Semiring = + common-difference-arithmetic-sequence-Semigroup + ( multiplicative-semigroup-Semiring R) + ( u) + + is-common-ratio-geometric-sequence-Semiring : + ( n : ℕ) → + ( seq-geometric-sequence-Semiring (succ-ℕ n)) = + ( mul-Semiring + ( R) + ( seq-geometric-sequence-Semiring n) + ( common-ratio-geometric-sequence-Semiring)) + is-common-ratio-geometric-sequence-Semiring = + is-common-difference-arithmetic-sequence-Semigroup + ( multiplicative-semigroup-Semiring R) + ( u) + + initial-term-geometric-sequence-Semiring : type-Semiring R + initial-term-geometric-sequence-Semiring = + initial-term-arithmetic-sequence-Semigroup + ( multiplicative-semigroup-Semiring R) + ( u) +``` + +### The standard geometric sequences in a semiring + +The standard geometric sequence with initial term `a` and common factor `r` is +the sequence `u` defined by: + +- `u₀ = a` +- `uₙ₊₁ = uₙ * r` + +```agda +module _ + {l : Level} (R : Semiring l) (a r : type-Semiring R) + where + + standard-geometric-sequence-Semiring : geometric-sequence-Semiring R + standard-geometric-sequence-Semiring = + standard-arithmetic-sequence-Semigroup + ( multiplicative-semigroup-Semiring R) + ( a) + ( r) + + seq-standard-geometric-sequence-Semiring : ℕ → type-Semiring R + seq-standard-geometric-sequence-Semiring = + seq-geometric-sequence-Semiring R + standard-geometric-sequence-Semiring + + is-geometric-standard-geometric-sequence-Semiring : + is-arithmetic-sequence-Semigroup + ( multiplicative-semigroup-Semiring R) + ( seq-standard-geometric-sequence-Semiring) + is-geometric-standard-geometric-sequence-Semiring = + is-geometric-seq-geometric-sequence-Semiring R + standard-geometric-sequence-Semiring +``` + +### The geometric sequences `n ↦ a * rⁿ` + +```agda +module _ + {l : Level} (R : Semiring l) (a r : type-Semiring R) + where + + mul-pow-nat-Semiring : ℕ → type-Semiring R + mul-pow-nat-Semiring n = + mul-Semiring R a (power-Semiring R n r) + + is-common-ratio-mul-pow-nat-Semiring : + is-common-difference-sequence-Semigroup + ( multiplicative-semigroup-Semiring R) + ( mul-pow-nat-Semiring) + ( r) + is-common-ratio-mul-pow-nat-Semiring n = + ( ap + ( mul-Semiring R a) + ( power-succ-Semiring R n r)) ∙ + ( inv + ( associative-mul-Semiring + ( R) + ( a) + ( power-Semiring R n r) + ( r))) + + is-geometric-mul-pow-nat-Semiring : + is-arithmetic-sequence-Semigroup + ( multiplicative-semigroup-Semiring R) + ( mul-pow-nat-Semiring) + is-geometric-mul-pow-nat-Semiring = + ( r , is-common-ratio-mul-pow-nat-Semiring) + + geometric-mul-pow-nat-Semiring : geometric-sequence-Semiring R + geometric-mul-pow-nat-Semiring = + ( mul-pow-nat-Semiring , is-geometric-mul-pow-nat-Semiring) + + initial-term-mul-pow-nat-Semiring : type-Semiring R + initial-term-mul-pow-nat-Semiring = + initial-term-geometric-sequence-Semiring + ( R) + ( geometric-mul-pow-nat-Semiring) + + eq-initial-term-mul-pow-nat-Semiring : + initial-term-mul-pow-nat-Semiring = a + eq-initial-term-mul-pow-nat-Semiring = + right-unit-law-mul-Semiring R a +``` + +## Properties + +### Any geometric sequence in a semiring is homotopic to a standard geometric sequence + +```agda +module _ + {l : Level} (R : Semiring l) + (u : geometric-sequence-Semiring R) + where + + htpy-seq-standard-geometric-sequence-Semiring : + ( seq-geometric-sequence-Semiring R + ( standard-geometric-sequence-Semiring R + ( initial-term-geometric-sequence-Semiring R u) + ( common-ratio-geometric-sequence-Semiring R u))) ~ + ( seq-geometric-sequence-Semiring R u) + htpy-seq-standard-geometric-sequence-Semiring = + htpy-seq-standard-arithmetic-sequence-Semigroup + ( multiplicative-semigroup-Semiring R) + ( u) +``` + +### The nth term of an geometric sequence with initial term `a` and common ratio `r` is `a * rⁿ` + +```agda +module _ + {l : Level} (R : Semiring l) (a r : type-Semiring R) + where + + htpy-mul-pow-standard-geometric-sequence-Semiring : + mul-pow-nat-Semiring R a r ~ seq-standard-geometric-sequence-Semiring R a r + htpy-mul-pow-standard-geometric-sequence-Semiring = + htpy-seq-arithmetic-sequence-Semigroup + ( multiplicative-semigroup-Semiring R) + ( geometric-mul-pow-nat-Semiring R a r) + ( standard-geometric-sequence-Semiring R a r) + ( eq-initial-term-mul-pow-nat-Semiring R a r) + ( refl) +``` + +```agda +module _ + {l : Level} (R : Semiring l) (u : geometric-sequence-Semiring R) + where + + htpy-mul-pow-geometric-sequence-Semiring : + mul-pow-nat-Semiring + ( R) + ( initial-term-geometric-sequence-Semiring R u) + ( common-ratio-geometric-sequence-Semiring R u) ~ + seq-geometric-sequence-Semiring R u + htpy-mul-pow-geometric-sequence-Semiring n = + ( htpy-mul-pow-standard-geometric-sequence-Semiring + ( R) + ( initial-term-geometric-sequence-Semiring R u) + ( common-ratio-geometric-sequence-Semiring R u) + ( n)) ∙ + ( htpy-seq-standard-arithmetic-sequence-Semigroup + ( multiplicative-semigroup-Semiring R) + ( u) + ( n)) +``` + +### Constant sequences are geometric with common ratio one + +```agda +module _ + {l : Level} (R : Semiring l) (a : type-Semiring R) + where + + one-is-common-ratio-const-sequence-Semiring : + is-common-difference-sequence-Semigroup + ( multiplicative-semigroup-Semiring R) + ( λ _ → a) + ( one-Semiring R) + one-is-common-ratio-const-sequence-Semiring n = + inv (right-unit-law-mul-Semiring R a) + + geometric-const-sequence-Semiring : geometric-sequence-Semiring R + pr1 geometric-const-sequence-Semiring _ = a + pr2 geometric-const-sequence-Semiring = + ( one-Semiring R , one-is-common-ratio-const-sequence-Semiring) +``` + +## External links + +- [Geometric progressions](https://en.wikipedia.org/wiki/Geometric_progression) + at Wikipedia diff --git a/src/ring-theory/partial-sums-sequences-semirings.lagda.md b/src/ring-theory/partial-sums-sequences-semirings.lagda.md new file mode 100644 index 0000000000..0c0edb66d3 --- /dev/null +++ b/src/ring-theory/partial-sums-sequences-semirings.lagda.md @@ -0,0 +1,70 @@ +# Partial sums of sequences in semirings + +```agda +module ring-theory.partial-sums-sequences-semirings where +``` + +
Imports + +```agda +open import elementary-number-theory.natural-numbers + +open import foundation.homotopies +open import foundation.identity-types +open import foundation.sequences +open import foundation.universe-levels + +open import lists.finite-sequences + +open import ring-theory.semirings +open import ring-theory.sums-of-finite-sequences-of-elements-semirings +``` + +
+ +## Ideas + +The +{{#concept "sequence of partial sums" Disambiguation="of a sequence in a semiring" Agda=seq-sum-sequence-Semiring}} +of a [sequence](foundation.sequences.md) `u` in a +[semiring](ring-theory.semirings.md) is the sequence of sums of terms of `u`: + +```text +n ↦ Σ (k ≤ n) (u k). +``` + +## Definitions + +### Partial sums of terms of a sequence in a semiring + +```agda +module _ + {l : Level} (R : Semiring l) (u : ℕ → type-Semiring R) + where + + seq-sum-sequence-Semiring : ℕ → type-Semiring R + seq-sum-sequence-Semiring n = + sum-fin-sequence-type-Semiring + ( R) + ( succ-ℕ n) + ( fin-sequence-sequence u (succ-ℕ n)) +``` + +## Properties + +### Homotopic sequences have homotopic partial sums + +```agda +module _ + {l : Level} (R : Semiring l) {u v : ℕ → type-Semiring R} + where + + htpy-seq-sum-sequence-Semiring : + (u ~ v) → + seq-sum-sequence-Semiring R u ~ seq-sum-sequence-Semiring R v + htpy-seq-sum-sequence-Semiring H n = + htpy-sum-fin-sequence-type-Semiring + ( R) + ( succ-ℕ n) + ( htpy-fin-sequence-sequence u v H (succ-ℕ n)) +``` diff --git a/src/ring-theory/semirings.lagda.md b/src/ring-theory/semirings.lagda.md index 982869d8d3..e8c7bc9900 100644 --- a/src/ring-theory/semirings.lagda.md +++ b/src/ring-theory/semirings.lagda.md @@ -8,12 +8,15 @@ module ring-theory.semirings where ```agda open import elementary-number-theory.addition-natural-numbers +open import elementary-number-theory.multiplication-natural-numbers open import elementary-number-theory.natural-numbers open import foundation.action-on-identifications-binary-functions open import foundation.action-on-identifications-functions open import foundation.cartesian-product-types open import foundation.dependent-pair-types +open import foundation.function-types +open import foundation.homotopies open import foundation.identity-types open import foundation.negation open import foundation.propositions @@ -383,4 +386,13 @@ module _ ( associative-add-Semiring R ( mul-nat-scalar-Semiring m x) ( mul-nat-scalar-Semiring n x) x) + + htpy-comp-mul-nat-mul-Semiring : + ( m n : ℕ) → + ( mul-nat-scalar-Semiring (m *ℕ n)) ~ + ( mul-nat-scalar-Semiring m ∘ mul-nat-scalar-Semiring n) + htpy-comp-mul-nat-mul-Semiring zero-ℕ n x = refl + htpy-comp-mul-nat-mul-Semiring (succ-ℕ m) n x = + ( right-distributive-mul-nat-scalar-add-Semiring (m *ℕ n) n x) ∙ + ( ap (add-Semiring' R _) (htpy-comp-mul-nat-mul-Semiring m n x)) ``` diff --git a/src/ring-theory/sums-of-finite-sequences-of-elements-semirings.lagda.md b/src/ring-theory/sums-of-finite-sequences-of-elements-semirings.lagda.md index 6dc430f48c..5fa3140c58 100644 --- a/src/ring-theory/sums-of-finite-sequences-of-elements-semirings.lagda.md +++ b/src/ring-theory/sums-of-finite-sequences-of-elements-semirings.lagda.md @@ -281,6 +281,24 @@ module _ ( additive-commutative-monoid-Semiring R) ``` +### The sum of a constant finite sequence in a semiring is scalar multiplication by the length of the sequence + +```agda +module _ + {l : Level} (R : Semiring l) (x : type-Semiring R) + where + + eq-mul-nat-scalar-sum-const-fin-sequence-Semiring : + (n : ℕ) → + sum-fin-sequence-type-Semiring R n (λ _ → x) = + mul-nat-scalar-Semiring R n x + eq-mul-nat-scalar-sum-const-fin-sequence-Semiring zero-ℕ = refl + eq-mul-nat-scalar-sum-const-fin-sequence-Semiring (succ-ℕ n) = + ap + ( add-Semiring' R x) + ( eq-mul-nat-scalar-sum-const-fin-sequence-Semiring n) +``` + ## See also - [Sums of finite families of elements in semirings](ring-theory.sums-of-finite-families-of-elements-semirings.md) From 65b187080256d4efccccdcbeae01075c726e6fc0 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sat, 30 Aug 2025 17:19:27 +0200 Subject: [PATCH 28/97] Some cleanup of species (#1502) - Add concept macro invocations and cross references - Tidy constructions of equivalences - Fix indentation - Improve universe polymorphism - Fix some grammatical errors and typos - Make `private` definitions into local ones --- .../decidable-equivalence-relations.lagda.md | 73 ++-- src/foundation/structure.lagda.md | 2 +- ...rithmetic-cartesian-product-types.lagda.md | 10 + .../universal-property-booleans.lagda.md | 3 +- ...niversal-property-coproduct-types.lagda.md | 2 +- ...tesian-exponents-species-of-types.lagda.md | 14 +- ...rtesian-products-species-of-types.lagda.md | 9 +- ...-species-of-types-in-subuniverses.lagda.md | 348 ++++++++---------- ...uchy-composition-species-of-types.lagda.md | 123 ++----- ...-species-of-types-in-subuniverses.lagda.md | 306 ++++++++------- ...chy-exponentials-species-of-types.lagda.md | 94 +++-- ...-species-of-types-in-subuniverses.lagda.md | 252 ++++++------- .../cauchy-products-species-of-types.lagda.md | 7 +- ...-species-of-types-in-subuniverses.lagda.md | 30 +- .../cauchy-series-species-of-types.lagda.md | 27 +- ...-species-of-types-in-subuniverses.lagda.md | 112 +++--- ...on-cauchy-series-species-of-types.lagda.md | 53 ++- ...-species-of-types-in-subuniverses.lagda.md | 39 +- .../coproducts-species-of-types.lagda.md | 15 +- ...cle-index-series-species-of-types.lagda.md | 14 +- .../derivatives-species-of-types.lagda.md | 8 +- ...-species-of-types-in-subuniverses.lagda.md | 285 +++++++------- ...let-exponentials-species-of-types.lagda.md | 83 ++--- ...-species-of-types-in-subuniverses.lagda.md | 309 +++++++--------- ...richlet-products-species-of-types.lagda.md | 7 +- ...species-of-finite-inhabited-types.lagda.md | 33 +- ...-species-of-types-in-subuniverses.lagda.md | 37 +- ...dirichlet-series-species-of-types.lagda.md | 35 +- ...-species-of-types-in-subuniverses.lagda.md | 14 +- .../equivalences-species-of-types.lagda.md | 11 +- ...y-series-of-types-in-subuniverses.lagda.md | 55 ++- ...ponentials-cauchy-series-of-types.lagda.md | 20 +- src/species/hasse-weil-species.lagda.md | 32 +- src/species/morphisms-finite-species.lagda.md | 11 +- .../morphisms-species-of-types.lagda.md | 12 +- .../pointing-species-of-types.lagda.md | 7 +- .../precategory-of-finite-species.lagda.md | 14 +- ...-species-of-types-in-subuniverses.lagda.md | 118 +++--- ...ts-cauchy-series-species-of-types.lagda.md | 39 +- ...species-of-finite-inhabited-types.lagda.md | 8 +- ...-species-of-types-in-subuniverses.lagda.md | 86 ++--- ...dirichlet-series-species-of-types.lagda.md | 48 +-- ...species-of-finite-inhabited-types.lagda.md | 52 ++- ...-species-of-types-in-subuniverses.lagda.md | 247 ++++++------- ...species-of-finite-inhabited-types.lagda.md | 7 +- src/species/species-of-finite-types.lagda.md | 4 +- .../species-of-inhabited-types.lagda.md | 7 +- .../species-of-types-in-subuniverses.lagda.md | 4 +- src/species/species-of-types.lagda.md | 3 +- ...-species-of-types-in-subuniverses.lagda.md | 13 +- ...uchy-composition-species-of-types.lagda.md | 7 +- .../unlabeled-structures-species.lagda.md | 5 +- src/trees/polynomial-endofunctors.lagda.md | 14 +- .../cyclic-finite-types.lagda.md | 7 +- .../decidable-equivalence-relations.lagda.md | 85 ++--- 55 files changed, 1555 insertions(+), 1705 deletions(-) diff --git a/src/foundation/decidable-equivalence-relations.lagda.md b/src/foundation/decidable-equivalence-relations.lagda.md index 149af1b5ca..7616e35b46 100644 --- a/src/foundation/decidable-equivalence-relations.lagda.md +++ b/src/foundation/decidable-equivalence-relations.lagda.md @@ -465,9 +465,8 @@ module _ is-decidable-is-in-equivalence-class-is-decidable F T a = apply-universal-property-trunc-Prop ( pr2 T) - ( is-decidable-Prop - ( subtype-equivalence-class R T a)) - ( λ (pair t P) → + ( is-decidable-Prop (subtype-equivalence-class R T a)) + ( λ (t , P) → is-decidable-iff ( backward-implication (P a)) ( forward-implication (P a)) @@ -506,44 +505,34 @@ equiv-Surjection-Into-Set-Decidable-Equivalence-Relation : Decidable-Equivalence-Relation l1 A ≃ Σ (UU l1) (λ X → (A ↠ X) × has-decidable-equality X) equiv-Surjection-Into-Set-Decidable-Equivalence-Relation {l1} A = - ( ( equiv-Σ - ( λ z → (A ↠ z) × has-decidable-equality z) - ( id-equiv) - ( λ X → - ( equiv-product - ( id-equiv) - ( inv-equiv - ( equiv-add-redundant-prop - ( is-prop-is-set ( X)) - ( is-set-has-decidable-equality)) ∘e - commutative-product) ∘e + ( equiv-tot + ( λ X → + ( equiv-product-right + ( ( equiv-remove-redundant-prop + ( is-prop-is-set X) + ( is-set-has-decidable-equality)) ∘e + ( commutative-product)) ∘e ( equiv-left-swap-Σ)))) ∘e - ( ( associative-Σ - ( UU l1) - ( λ X → is-set X) - ( λ X → (A ↠ pr1 X) × has-decidable-equality (pr1 X))) ∘e - ( ( associative-Σ - ( Set l1) - ( λ X → (A ↠ type-Set X)) - ( λ X → has-decidable-equality (pr1 (pr1 X)))) ∘e - ( ( equiv-type-subtype - ( λ surj → - is-prop-Π - ( λ x → - is-prop-Π - ( λ y → - is-prop-is-decidable - ( is-prop-sim-equivalence-relation - ( equivalence-relation-Surjection-Into-Set surj) - ( x) - ( y))))) - ( λ _ → is-prop-has-decidable-equality) - ( λ s → has-decidable-equality-type-Surjection-Into-Set s) - ( λ s → is-decidable-equivalence-relation-Surjection-Into-Set s)) ∘e - ( ( inv-equiv - ( equiv-Σ-equiv-base - ( λ R → is-decidable-equivalence-relation R) - ( inv-equiv - ( equiv-surjection-into-set-equivalence-relation A)))) ∘e - ( equiv-equivalence-relation-is-decidable-Decidable-Equivalence-Relation)))))) + ( associative-Σ _ _ _) ∘e + ( associative-Σ _ _ _) ∘e + ( equiv-type-subtype + ( λ surj → + is-prop-Π + ( λ x → + is-prop-Π + ( λ y → + is-prop-is-decidable + ( is-prop-sim-equivalence-relation + ( equivalence-relation-Surjection-Into-Set surj) + ( x) + ( y))))) + ( λ _ → is-prop-has-decidable-equality) + ( λ s → has-decidable-equality-type-Surjection-Into-Set s) + ( λ s → is-decidable-equivalence-relation-Surjection-Into-Set s)) ∘e + ( inv-equiv + ( equiv-Σ-equiv-base + ( λ R → is-decidable-equivalence-relation R) + ( inv-equiv + ( equiv-surjection-into-set-equivalence-relation A)))) ∘e + ( equiv-equivalence-relation-is-decidable-Decidable-Equivalence-Relation) ``` diff --git a/src/foundation/structure.lagda.md b/src/foundation/structure.lagda.md index 68d4e2d873..a889e21e40 100644 --- a/src/foundation/structure.lagda.md +++ b/src/foundation/structure.lagda.md @@ -66,7 +66,7 @@ structure-equality 𝒫 A = (x y : A) → 𝒫 (x = y) ### Having structure is closed under equivalences -This is a consequence of [the univalence axiom](foundation.univalence.md) +This is a consequence of [the univalence axiom](foundation.univalence.md). ```agda has-structure-equiv : diff --git a/src/foundation/type-arithmetic-cartesian-product-types.lagda.md b/src/foundation/type-arithmetic-cartesian-product-types.lagda.md index 4d0d338b3b..a4461efe4c 100644 --- a/src/foundation/type-arithmetic-cartesian-product-types.lagda.md +++ b/src/foundation/type-arithmetic-cartesian-product-types.lagda.md @@ -146,6 +146,16 @@ pr2 (equiv-add-redundant-prop is-prop-B f) = ( pr1) ( λ p → eq-pair refl (eq-is-prop is-prop-B)) ( refl-htpy) + +equiv-remove-redundant-prop : + {l1 l2 : Level} {A : UU l1} {B : UU l2} → + is-prop B → (f : A → B) → A × B ≃ A +pr1 (equiv-remove-redundant-prop is-prop-B f) = pr1 +pr2 (equiv-remove-redundant-prop is-prop-B f) = + is-equiv-is-invertible + ( λ a → (a , f a)) + ( refl-htpy) + ( λ p → eq-pair refl (eq-is-prop is-prop-B)) ``` ## See also diff --git a/src/foundation/universal-property-booleans.lagda.md b/src/foundation/universal-property-booleans.lagda.md index b976f49d78..06ff14fa07 100644 --- a/src/foundation/universal-property-booleans.lagda.md +++ b/src/foundation/universal-property-booleans.lagda.md @@ -37,8 +37,7 @@ abstract is-section-map-universal-property-bool : {l : Level} {A : UU l} → ((ev-true-false A) ∘ map-universal-property-bool) ~ id - is-section-map-universal-property-bool (pair x y) = - eq-pair refl refl + is-section-map-universal-property-bool (pair x y) = refl abstract is-retraction-map-universal-property-bool' : diff --git a/src/foundation/universal-property-coproduct-types.lagda.md b/src/foundation/universal-property-coproduct-types.lagda.md index 893e864163..2040da739f 100644 --- a/src/foundation/universal-property-coproduct-types.lagda.md +++ b/src/foundation/universal-property-coproduct-types.lagda.md @@ -45,7 +45,7 @@ module _ dependent-universal-property-coproduct P = is-equiv-is-invertible ( λ p → ind-coproduct P (pr1 p) (pr2 p)) - ( ind-Σ (λ f g → eq-pair refl refl)) + ( ind-Σ (λ f g → refl)) ( λ s → eq-htpy (ind-coproduct _ refl-htpy refl-htpy)) equiv-dependent-universal-property-coproduct : diff --git a/src/species/cartesian-exponents-species-of-types.lagda.md b/src/species/cartesian-exponents-species-of-types.lagda.md index 8f07241384..34fe0fc7e1 100644 --- a/src/species/cartesian-exponents-species-of-types.lagda.md +++ b/src/species/cartesian-exponents-species-of-types.lagda.md @@ -1,4 +1,4 @@ -# Cartesian exponents of species +# Cartesian exponents of species of types ```agda module species.cartesian-exponents-species-of-types where @@ -16,11 +16,13 @@ open import species.species-of-types ## Idea -The **Cartesian exponent** of two species `F` and `G` is the pointwise exponent -of `F` and `G`. +The +{{#concept "Cartesian exponent" Disambiguation="of species of types" Agda=function-species-types}} +of two [species of types](species.species-of-types.md) `F` and `G` is the +pointwise exponent of `F` and `G`. -Note that we call such exponents cartesian to disambiguate from other notions of -exponents, such as +Note that we call such exponents _cartesian_ to disambiguate from other notions +of exponents, such as [Cauchy exponentials](species.cauchy-exponentials-species-of-types.md). ## Definitions @@ -31,5 +33,5 @@ exponents, such as function-species-types : {l1 l2 l3 : Level} → species-types l1 l2 → species-types l1 l3 → species-types l1 (l2 ⊔ l3) -function-species-types F G X = F X → G X +function-species-types F G X = (F X → G X) ``` diff --git a/src/species/cartesian-products-species-of-types.lagda.md b/src/species/cartesian-products-species-of-types.lagda.md index 60e524d6b4..c9ee1342f8 100644 --- a/src/species/cartesian-products-species-of-types.lagda.md +++ b/src/species/cartesian-products-species-of-types.lagda.md @@ -22,8 +22,10 @@ open import species.species-of-types ## Idea -The **cartesian product** of two species of types `F` and `G` is their pointwise -cartesian product. +The +{{#concept "cartesian product" Disambiguation="of species of types" Agda=product-species-types}} +of two [species of types](species.species-of-types.md) `F` and `G` is their +pointwise [cartesian product](foundation.cartesian-product-types.md). ## Definition @@ -41,7 +43,8 @@ product-species-types F G X = (F X) × (G X) ```agda equiv-universal-property-exponents-species-types : {l1 l2 l3 l4 : Level} - (F : species-types l1 l2) (G : species-types l1 l3) + (F : species-types l1 l2) + (G : species-types l1 l3) (H : species-types l1 l4) → hom-species-types (product-species-types F G) H ≃ hom-species-types F (function-species-types G H) diff --git a/src/species/cauchy-composition-species-of-types-in-subuniverses.lagda.md b/src/species/cauchy-composition-species-of-types-in-subuniverses.lagda.md index 65183258e0..0f5ad3fad1 100644 --- a/src/species/cauchy-composition-species-of-types-in-subuniverses.lagda.md +++ b/src/species/cauchy-composition-species-of-types-in-subuniverses.lagda.md @@ -1,4 +1,4 @@ -# Cauchy composition of species of types in a subuniverse +# Cauchy composition of species of types in subuniverses ```agda module species.cauchy-composition-species-of-types-in-subuniverses where @@ -41,15 +41,18 @@ open import species.unit-cauchy-composition-species-of-types-in-subuniverses ## Idea -A species `S : type-subuniverse P → type-subuniverse Q` induces its +A [species](species.species-of-types-in-subuniverses.md) +`S : type-subuniverse P → type-subuniverse Q` induces its [Cauchy series](species.cauchy-series-species-of-types-in-subuniverses.md) ```text X ↦ Σ (A : type-subuniverse P), (S A) × (A → X) ``` -The **Cauchy composition** of species `S` and `T` is obtained from the -coefficients of the composite of the Cauchy series of `S` and `T`. +The +{{#concept "Cauchy composition" Disambiguation="of species of types in a subuniverse" Agda=cauchy-composition-species-subuniverse}} +of species `S` and `T` is obtained from the coefficients of the composite of the +Cauchy series of `S` and `T`. ## Definition @@ -57,9 +60,9 @@ coefficients of the composite of the Cauchy series of `S` and `T`. ```agda module _ - {l1 l2 : Level} + {α : Level → Level} {l1 l2 : Level} (P : subuniverse l1 l2) - (Q : global-subuniverse (λ l → l)) + (Q : global-subuniverse α) where type-cauchy-composition-species-subuniverse : @@ -88,9 +91,10 @@ module _ ( type-cauchy-composition-species-subuniverse S T X) module _ + {α : Level → Level} {l1 l2 l3 l4 : Level} (P : subuniverse l1 l2) - (Q : global-subuniverse (λ l → l)) + (Q : global-subuniverse α) (C1 : is-closed-under-cauchy-composition-species-subuniverse P Q) (C2 : is-closed-under-Σ-subuniverse P) (S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) @@ -111,9 +115,10 @@ module _ ```agda module _ + {α : Level → Level} {l1 l2 l3 l4 : Level} (P : subuniverse l1 l2) - (Q : global-subuniverse (λ l → l)) + (Q : global-subuniverse α) (C1 : is-closed-under-cauchy-composition-species-subuniverse P Q) (C2 : is-closed-under-Σ-subuniverse P) (S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) @@ -136,54 +141,40 @@ module _ ( T)) ( X)) preserves-cauchy-composition-Σ-extension-species-subuniverse X = - ( ( equiv-tot - ( λ D → - ( ( equiv-product id-equiv (inv-equiv distributive-Π-Σ)) ∘e - ( ( inv-equiv right-distributive-product-Σ) ∘e - ( ( equiv-tot (λ _ → inv-equiv (left-distributive-product-Σ)))))) ∘e - ( ( associative-Σ _ _ _)))) ∘e - ( ( associative-Σ - ( Relaxed-Σ-Decomposition l1 l1 X) + ( equiv-tot + ( λ D → + ( equiv-product-right inv-distributive-Π-Σ) ∘e + ( inv-equiv right-distributive-product-Σ) ∘e + ( equiv-tot (λ _ → inv-equiv left-distributive-product-Σ)) ∘e + ( associative-Σ _ _ _))) ∘e + ( associative-Σ _ _ _) ∘e + ( equiv-Σ-equiv-base + ( _) + ( ( equiv-remove-redundant-prop + ( is-prop-type-Prop (P X)) ( λ D → - is-in-subuniverse P (indexing-type-Relaxed-Σ-Decomposition D) × - ( (x : indexing-type-Relaxed-Σ-Decomposition D) → - is-in-subuniverse P (cotype-Relaxed-Σ-Decomposition D x))) - ( _)) ∘e - ( ( equiv-Σ-equiv-base - ( _) - ( ( inv-equiv - ( equiv-add-redundant-prop - ( is-prop-type-Prop (P X)) - ( λ D → - ( tr - ( is-in-subuniverse P) - ( eq-equiv - ( inv-equiv - ( matching-correspondence-Relaxed-Σ-Decomposition - ( pr1 D)))) - ( C2 - ( indexing-type-Relaxed-Σ-Decomposition (pr1 D) , - pr1 (pr2 D)) - ( λ x → - ( cotype-Relaxed-Σ-Decomposition (pr1 D) x , - pr2 (pr2 D) x)))))) ∘e - ( commutative-product ∘e - ( equiv-tot - ( λ p → - equiv-total-is-in-subuniverse-Σ-Decomposition - ( P) - (X , p))))))) ∘e - ( ( inv-associative-Σ - ( is-in-subuniverse P X) - ( λ p → Σ-Decomposition-Subuniverse P (X , p)) - ( _)))))) + ( tr + ( is-in-subuniverse P) + ( eq-equiv + ( inv-equiv + ( matching-correspondence-Relaxed-Σ-Decomposition (pr1 D)))) + ( C2 + ( indexing-type-Relaxed-Σ-Decomposition (pr1 D) , pr1 (pr2 D)) + ( λ x → + ( cotype-Relaxed-Σ-Decomposition (pr1 D) x , + pr2 (pr2 D) x)))))) ∘e + ( commutative-product) ∘e + ( equiv-tot + ( λ p → equiv-total-is-in-subuniverse-Σ-Decomposition P (X , p))))) ∘e + ( inv-associative-Σ _ _ _) ``` ### Unit laws for Cauchy composition of species-subuniverse ```agda module _ - {l1 l2 : Level} (P : subuniverse l1 l2) (Q : global-subuniverse (λ l → l)) + {α : Level → Level} {l1 l2 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) ( C3 : is-in-subuniverse P (raise-unit l1)) ( C4 : is-closed-under-is-contr-subuniverses P @@ -245,16 +236,17 @@ module _ is-equiv-map-equiv-Σ-extension-cauchy-composition-unit-subuniverse module _ - { l1 l2 l3 : Level} - ( P : subuniverse l1 l2) - ( Q : global-subuniverse (λ l → l)) - ( C1 : is-closed-under-cauchy-composition-species-subuniverse P Q) - ( C2 : is-closed-under-Σ-subuniverse P) - ( C3 : is-in-subuniverse P (raise-unit l1)) - ( C4 : + {α : Level → Level} + {l1 l2 l3 : Level} + (P : subuniverse l1 l2) + (Q : global-subuniverse α) + (C1 : is-closed-under-cauchy-composition-species-subuniverse P Q) + (C2 : is-closed-under-Σ-subuniverse P) + (C3 : is-in-subuniverse P (raise-unit l1)) + (C4 : is-closed-under-is-contr-subuniverses P ( subuniverse-global-subuniverse Q l1)) - ( S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) + (S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) where equiv-left-unit-law-cauchy-composition-species-subuniverse : @@ -267,47 +259,38 @@ module _ ( X)) ≃ inclusion-subuniverse (subuniverse-global-subuniverse Q l3) (S X) equiv-left-unit-law-cauchy-composition-species-subuniverse X = - ( ( inv-equiv - ( equiv-Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l3) - ( S) - ( X))) ∘e - ( ( left-unit-law-cauchy-composition-species-types - ( Σ-extension-species-subuniverse + ( inv-equiv + ( equiv-Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q l3) + ( S) + ( X))) ∘e + ( left-unit-law-cauchy-composition-species-types + ( Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q l3) + ( S)) + ( inclusion-subuniverse P X)) ∘e + ( equiv-tot + ( λ D → + equiv-product-left + ( equiv-Σ-extension-cauchy-composition-unit-subuniverse ( P) - ( subuniverse-global-subuniverse Q l3) - ( S)) - ( inclusion-subuniverse P X)) ∘e - ( ( equiv-tot - ( λ D → - equiv-product - ( equiv-Σ-extension-cauchy-composition-unit-subuniverse - ( P) - ( Q) - ( C3) - ( C4) - ( indexing-type-Relaxed-Σ-Decomposition D)) - ( id-equiv))) ∘e - ( ( preserves-cauchy-composition-Σ-extension-species-subuniverse - ( P) - ( Q) - ( C1) - ( C2) - ( cauchy-composition-unit-species-subuniverse P Q C4) - ( S) - ( inclusion-subuniverse P X)) ∘e - ( ( equiv-Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3)) - ( cauchy-composition-species-subuniverse - ( P) - ( Q) - ( C1) - ( C2) - ( cauchy-composition-unit-species-subuniverse P Q C4) - ( S)) - ( X))))))) + ( Q) + ( C3) + ( C4) + ( indexing-type-Relaxed-Σ-Decomposition D)))) ∘e + ( preserves-cauchy-composition-Σ-extension-species-subuniverse P Q C1 C2 + ( cauchy-composition-unit-species-subuniverse P Q C4) + ( S) + ( inclusion-subuniverse P X)) ∘e + ( equiv-Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3)) + ( cauchy-composition-species-subuniverse P Q C1 C2 + ( cauchy-composition-unit-species-subuniverse P Q C4) + ( S)) + ( X)) equiv-right-unit-law-cauchy-composition-species-subuniverse : ( X : type-subuniverse P) → @@ -324,52 +307,43 @@ module _ ( subuniverse-global-subuniverse Q l3) ( S) ( X))) ∘e - ( ( right-unit-law-cauchy-composition-species-types + ( right-unit-law-cauchy-composition-species-types ( Σ-extension-species-subuniverse ( P) ( subuniverse-global-subuniverse Q l3) ( S)) ( inclusion-subuniverse P X)) ∘e - ( ( equiv-tot - ( λ D → - equiv-product - ( id-equiv) - ( equiv-Π-equiv-family - ( λ x → - equiv-Σ-extension-cauchy-composition-unit-subuniverse - ( P) - ( Q) - ( C3) - ( C4) - ( cotype-Relaxed-Σ-Decomposition D x))))) ∘e - ( ( preserves-cauchy-composition-Σ-extension-species-subuniverse - ( P) - ( Q) - ( C1) - ( C2) - ( S) - ( cauchy-composition-unit-species-subuniverse P Q C4) - ( inclusion-subuniverse P X)) ∘e - ( ( equiv-Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3)) - ( cauchy-composition-species-subuniverse P Q C1 C2 S - ( cauchy-composition-unit-species-subuniverse P Q C4)) - ( X)))))) + ( equiv-tot + ( λ D → + equiv-product-right + ( equiv-Π-equiv-family + ( λ x → + equiv-Σ-extension-cauchy-composition-unit-subuniverse P Q C3 C4 + ( cotype-Relaxed-Σ-Decomposition D x))))) ∘e + ( preserves-cauchy-composition-Σ-extension-species-subuniverse P Q C1 C2 S + ( cauchy-composition-unit-species-subuniverse P Q C4) + ( inclusion-subuniverse P X)) ∘e + ( equiv-Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3)) + ( cauchy-composition-species-subuniverse P Q C1 C2 S + ( cauchy-composition-unit-species-subuniverse P Q C4)) + ( X)) ``` ### Associativity of composition of species of types in subuniverse ```agda module _ - { l1 l2 l3 l4 l5 : Level} - ( P : subuniverse l1 l2) - ( Q : global-subuniverse (λ l → l)) - ( C1 : is-closed-under-cauchy-composition-species-subuniverse P Q) - ( C2 : is-closed-under-Σ-subuniverse P) - ( S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) - ( T : species-subuniverse P (subuniverse-global-subuniverse Q l4)) - ( U : species-subuniverse P (subuniverse-global-subuniverse Q l5)) + {α : Level → Level} + {l1 l2 l3 l4 l5 : Level} + (P : subuniverse l1 l2) + (Q : global-subuniverse α) + (C1 : is-closed-under-cauchy-composition-species-subuniverse P Q) + (C2 : is-closed-under-Σ-subuniverse P) + (S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) + (T : species-subuniverse P (subuniverse-global-subuniverse Q l4)) + (U : species-subuniverse P (subuniverse-global-subuniverse Q l5)) where equiv-associative-cauchy-composition-species-subuniverse : @@ -394,73 +368,53 @@ module _ ( cauchy-composition-species-subuniverse P Q C1 C2 S T) ( U)) ( X))) ∘e - ( ( inv-equiv - ( preserves-cauchy-composition-Σ-extension-species-subuniverse P Q C1 C2 - ( cauchy-composition-species-subuniverse P Q C1 C2 S T) - ( U) - ( inclusion-subuniverse P X))) ∘e - ( ( equiv-tot - ( λ D → - equiv-product - ( inv-equiv - ( preserves-cauchy-composition-Σ-extension-species-subuniverse - ( P) - ( Q) - ( C1) - ( C2) - ( S) - ( T) - ( indexing-type-Relaxed-Σ-Decomposition D))) - ( id-equiv))) ∘e - ( ( equiv-associative-cauchy-composition-species-types - ( Σ-extension-species-subuniverse P - ( subuniverse-global-subuniverse Q l3) - ( S)) - ( Σ-extension-species-subuniverse P - ( subuniverse-global-subuniverse Q l4) - ( T)) - ( Σ-extension-species-subuniverse P - ( subuniverse-global-subuniverse Q l5) - ( U)) - ( inclusion-subuniverse P X)) ∘e - ( equiv-tot - ( λ D → - equiv-product - ( id-equiv) - ( equiv-Π - ( λ y → - cauchy-composition-species-types - ( Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l4) - ( T)) - ( Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l5) - ( U)) - ( cotype-Relaxed-Σ-Decomposition D y)) - ( id-equiv) - ( λ y → - preserves-cauchy-composition-Σ-extension-species-subuniverse - ( P) - ( Q) - ( C1) - ( C2) - ( T) - ( U) - ( cotype-Relaxed-Σ-Decomposition D y)))) ∘e - ( ( preserves-cauchy-composition-Σ-extension-species-subuniverse + ( inv-equiv + ( preserves-cauchy-composition-Σ-extension-species-subuniverse P Q C1 C2 + ( cauchy-composition-species-subuniverse P Q C1 C2 S T) + ( U) + ( inclusion-subuniverse P X))) ∘e + ( equiv-tot + ( λ D → + equiv-product-left + ( inv-equiv + ( preserves-cauchy-composition-Σ-extension-species-subuniverse + ( P) + ( Q) + ( C1) + ( C2) + ( S) + ( T) + ( indexing-type-Relaxed-Σ-Decomposition D))))) ∘e + ( equiv-associative-cauchy-composition-species-types + ( Σ-extension-species-subuniverse P + ( subuniverse-global-subuniverse Q l3) + ( S)) + ( Σ-extension-species-subuniverse P + ( subuniverse-global-subuniverse Q l4) + ( T)) + ( Σ-extension-species-subuniverse P + ( subuniverse-global-subuniverse Q l5) + ( U)) + ( inclusion-subuniverse P X)) ∘e + ( equiv-tot + ( λ D → + equiv-product-right + ( equiv-Π-equiv-family + ( λ y → + preserves-cauchy-composition-Σ-extension-species-subuniverse ( P) ( Q) ( C1) ( C2) - ( S) - ( cauchy-composition-species-subuniverse P Q C1 C2 T U) - ( inclusion-subuniverse P X)) ∘e - ( equiv-Σ-extension-species-subuniverse P - ( subuniverse-global-subuniverse Q - ( lsuc l1 ⊔ l2 ⊔ l3 ⊔ l4 ⊔ l5)) - ( cauchy-composition-species-subuniverse P Q C1 C2 S - ( cauchy-composition-species-subuniverse P Q C1 C2 T U)) - ( X))))))) + ( T) + ( U) + ( cotype-Relaxed-Σ-Decomposition D y))))) ∘e + ( preserves-cauchy-composition-Σ-extension-species-subuniverse P Q C1 C2 S + ( cauchy-composition-species-subuniverse P Q C1 C2 T U) + ( inclusion-subuniverse P X)) ∘e + ( equiv-Σ-extension-species-subuniverse P + ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3 ⊔ l4 ⊔ l5)) + ( cauchy-composition-species-subuniverse P Q C1 C2 S + ( cauchy-composition-species-subuniverse P Q C1 C2 T U)) + ( X)) ``` diff --git a/src/species/cauchy-composition-species-of-types.lagda.md b/src/species/cauchy-composition-species-of-types.lagda.md index 05943435c9..7e66fba693 100644 --- a/src/species/cauchy-composition-species-of-types.lagda.md +++ b/src/species/cauchy-composition-species-of-types.lagda.md @@ -36,15 +36,17 @@ open import species.unit-cauchy-composition-species-of-types ## Idea -A species of types `S : UU l1 → UU l2` can be thought of as the polynomial -endofunctor +A [species of types](species.species-of-types.md) `S : UU l1 → UU l2` can be +thought of as the [polynomial endofunctor](trees.polynomial-endofunctors.md) ```text - X ↦ Σ (A : UU l1) (S A) × (A → X) + X ↦ Σ (A : UU l1), (S A) × (A → X) ``` Using the formula for composition of analytic endofunctors, we obtain a way to -compose species, which is called the **Cauchy composition** of species. +compose species, which is called the +{{#concept "Cauchy composition" Disambiguation="of species of types" Agda=cauchy-composition-species-types}} +of species. ## Definition @@ -76,19 +78,9 @@ left-unit-law-cauchy-composition-species-types {l1} F A = ( is-contr-type-trivial-Relaxed-Σ-Decomposition) ( trivial-Relaxed-Σ-Decomposition l1 A , is-trivial-trivial-Relaxed-Σ-Decomposition {l1} {l1} {A})) ∘e - ( ( inv-associative-Σ - ( Relaxed-Σ-Decomposition l1 l1 A) - ( λ D → is-contr (indexing-type-Relaxed-Σ-Decomposition D)) - ( λ C → F (cotype-Relaxed-Σ-Decomposition (pr1 C) (center (pr2 C))))) ∘e - ( ( equiv-Σ - ( _) - ( id-equiv) - ( λ D → - equiv-Σ - ( λ z → F (cotype-Relaxed-Σ-Decomposition D (center z))) - ( id-equiv) - ( λ C → - ( left-unit-law-Π-is-contr C (center C))))))) + ( ( inv-associative-Σ _ _ _) ∘e + ( ( equiv-tot + ( λ D → equiv-tot (λ C → left-unit-law-Π-is-contr C (center C)))))) right-unit-law-cauchy-composition-species-types : {l1 l2 : Level} @@ -99,20 +91,8 @@ right-unit-law-cauchy-composition-species-types {l1} F A = ( is-contr-type-discrete-Relaxed-Σ-Decomposition) ( ( discrete-Relaxed-Σ-Decomposition l1 A) , is-discrete-discrete-Relaxed-Σ-Decomposition)) ∘e - ( ( inv-associative-Σ - ( Relaxed-Σ-Decomposition l1 l1 A) - ( λ D → - ( y : indexing-type-Relaxed-Σ-Decomposition D) → - is-contr (cotype-Relaxed-Σ-Decomposition D y)) - ( λ D → F (indexing-type-Relaxed-Σ-Decomposition (pr1 D)))) ∘e - ( ( equiv-Σ - ( λ D → - ( ( y : indexing-type-Relaxed-Σ-Decomposition D) → - unit-species-types - ( cotype-Relaxed-Σ-Decomposition D y)) × - F ( indexing-type-Relaxed-Σ-Decomposition D)) - ( id-equiv) - ( λ _ → commutative-product)))) + ( inv-associative-Σ _ _ _) ∘e + ( equiv-tot (λ _ → commutative-product)) ``` ### Associativity of composition of species @@ -120,7 +100,8 @@ right-unit-law-cauchy-composition-species-types {l1} F A = ```agda module _ {l1 l2 l3 l4 : Level} - (S : species-types l1 l2) (T : species-types l1 l3) + (S : species-types l1 l2) + (T : species-types l1 l3) (U : species-types l1 l4) where @@ -135,61 +116,31 @@ module _ ( U) ( A) equiv-associative-cauchy-composition-species-types A = - ( equiv-Σ - ( _) - ( id-equiv) + ( equiv-tot ( λ D1 → - ( ( inv-equiv right-distributive-product-Σ) ∘e - ( ( equiv-Σ - ( _) - ( id-equiv) - ( λ D2 → - ( inv-associative-Σ - ( S (indexing-type-Relaxed-Σ-Decomposition D2)) - ( λ _ → - ( x : indexing-type-Relaxed-Σ-Decomposition D2) → - T ( cotype-Relaxed-Σ-Decomposition D2 x)) - _))) ∘e - ( ( equiv-Σ - ( _) - ( id-equiv) - ( λ D2 → - ( equiv-product - ( id-equiv) - ( ( equiv-product - ( id-equiv) - ( ( inv-equiv - ( equiv-precomp-Π - ( inv-equiv - ( matching-correspondence-Relaxed-Σ-Decomposition - D2)) - ( λ x → U ( cotype-Relaxed-Σ-Decomposition D1 x)))) ∘e - ( inv-equiv equiv-ev-pair))) ∘e - ( distributive-Π-Σ)))))))))) ∘e - ( ( associative-Σ - ( Relaxed-Σ-Decomposition l1 l1 A) - ( λ D → Relaxed-Σ-Decomposition l1 l1 - ( indexing-type-Relaxed-Σ-Decomposition D)) - ( _)) ∘e - ( ( inv-equiv - ( equiv-Σ-equiv-base - ( _) - ( equiv-displayed-fibered-Relaxed-Σ-Decomposition))) ∘e - ( ( inv-associative-Σ - ( Relaxed-Σ-Decomposition l1 l1 A) - ( λ D → - ( x : indexing-type-Relaxed-Σ-Decomposition D) → - Relaxed-Σ-Decomposition l1 l1 - ( cotype-Relaxed-Σ-Decomposition D x)) - ( _)) ∘e - ( ( equiv-Σ - ( _) - ( id-equiv) - ( λ D → left-distributive-product-Σ)) ∘e - ( ( equiv-Σ - ( _) - ( id-equiv) - ( λ D → equiv-product id-equiv distributive-Π-Σ))))))) + ( inv-equiv right-distributive-product-Σ) ∘e + ( equiv-tot + ( λ D2 → + ( inv-associative-Σ _ _ _))) ∘e + ( equiv-tot + ( λ D2 → + ( equiv-product-right + ( ( equiv-product-right + ( ( inv-equiv + ( equiv-precomp-Π + ( inv-equiv + ( matching-correspondence-Relaxed-Σ-Decomposition + D2)) + ( λ x → U (cotype-Relaxed-Σ-Decomposition D1 x)))) ∘e + ( equiv-ind-Σ))) ∘e + ( distributive-Π-Σ))))))) ∘e + ( associative-Σ _ _ _) ∘e + ( equiv-Σ-equiv-base _ + ( inv-equiv equiv-displayed-fibered-Relaxed-Σ-Decomposition)) ∘e + ( inv-associative-Σ _ _ _) ∘e + ( equiv-tot + ( λ D → + left-distributive-product-Σ ∘e equiv-product-right distributive-Π-Σ)) htpy-associative-cauchy-composition-species-types : cauchy-composition-species-types diff --git a/src/species/cauchy-exponentials-species-of-types-in-subuniverses.lagda.md b/src/species/cauchy-exponentials-species-of-types-in-subuniverses.lagda.md index a5d3b8b486..59f3984e40 100644 --- a/src/species/cauchy-exponentials-species-of-types-in-subuniverses.lagda.md +++ b/src/species/cauchy-exponentials-species-of-types-in-subuniverses.lagda.md @@ -1,4 +1,4 @@ -# Cauchy exponentials of species of types in a subuniverse +# Cauchy exponentials of species of types in subuniverses ```agda module species.cauchy-exponentials-species-of-types-in-subuniverses where @@ -25,10 +25,12 @@ open import foundation.sigma-decomposition-subuniverse open import foundation.subuniverses open import foundation.transport-along-identifications open import foundation.type-arithmetic-cartesian-product-types +open import foundation.type-arithmetic-unit-type open import foundation.unit-type open import foundation.univalence open import foundation.universe-levels +open import species.cauchy-composition-species-of-types open import species.cauchy-composition-species-of-types-in-subuniverses open import species.cauchy-exponentials-species-of-types open import species.cauchy-products-species-of-types-in-subuniverses @@ -41,16 +43,18 @@ open import species.species-of-types-in-subuniverses ## Idea -The **Cauchy exponential** of a species `S : P → Q` of types in subuniverse is -defined by +The +{{#concept "Cauchy exponential" Disambiguation="of species of types in subuniverses" Agda=cauchy-exponential-species-subuniverse}} +of a [species](species.species-of-types-in-subuniverses.md) `S : P → Q` of types +in [subuniverses](foundation.subuniverses.md) is defined by ```text X ↦ Σ ((U , V , e) : Σ-Decomposition-subuniverse P X), Π (u : U) → S (V u). ``` -If `Q` is a global subuniverse, and if the previous definition is in `Q`, then -the Cauchy exponential is also a species of types in subuniverse from `P` to -`Q`. +If `Q` is a [global subuniverse](foundation.global-subuniverses.md), and if the +previous definition is in `Q`, then the Cauchy exponential is also a species of +types in subuniverses from `P` to `Q`. ## Definition @@ -58,7 +62,8 @@ the Cauchy exponential is also a species of types in subuniverse from `P` to ```agda module _ - {l1 l2 l3 : Level} (P : subuniverse l1 l2) (Q : global-subuniverse (λ l → l)) + {α : Level → Level} {l1 l2 l3 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) where type-cauchy-exponential-species-subuniverse : @@ -77,9 +82,10 @@ module _ ```agda is-closed-under-cauchy-exponential-species-subuniverse : - {l1 l2 : Level} (P : subuniverse l1 l2) (Q : global-subuniverse (λ l → l)) → + {α : Level → Level} {l1 l2 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) → UUω -is-closed-under-cauchy-exponential-species-subuniverse {l1} {l2} P Q = +is-closed-under-cauchy-exponential-species-subuniverse {α} {l1} {l2} P Q = {l3 : Level} (S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) (X : type-subuniverse P) → @@ -88,12 +94,13 @@ is-closed-under-cauchy-exponential-species-subuniverse {l1} {l2} P Q = ( type-cauchy-exponential-species-subuniverse P Q S X) ``` -### The Cauchy exponential of a species of types in a subuniverse +### The Cauchy exponential of a species of types in subuniverses ```agda module _ - {l1 l2 l3 : Level} (P : subuniverse l1 l2) (Q : global-subuniverse (λ l → l)) - ( C1 : is-closed-under-cauchy-exponential-species-subuniverse P Q) + {α : Level → Level} {l1 l2 l3 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) + (C1 : is-closed-under-cauchy-exponential-species-subuniverse P Q) where cauchy-exponential-species-subuniverse : @@ -106,13 +113,14 @@ module _ ## Propositions -### The Cauchy exponential in term of composition +### The Cauchy exponential in terms of composition ```agda module _ + {α : Level → Level} {l1 l2 l3 : Level} (P : subuniverse l1 l2) - (Q : global-subuniverse (λ l → l)) + (Q : global-subuniverse α) (C1 : is-closed-under-cauchy-exponential-species-subuniverse P Q) (C2 : is-in-subuniverse (subuniverse-global-subuniverse Q lzero) unit) (C3 : is-closed-under-cauchy-composition-species-subuniverse P Q) @@ -130,25 +138,65 @@ module _ ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3)) ( cauchy-exponential-species-subuniverse P Q C1 S X) equiv-cauchy-exponential-composition-unit-species-subuniverse = - equiv-tot λ _ → left-unit-law-product-is-contr is-contr-unit + equiv-tot (λ _ → left-unit-law-product) ``` -### Equivalence form with species of types +### Equivalence to Cauchy exponentials of species of types ```agda module _ - {l1 l2 l3 : Level} (P : subuniverse l1 l2) (Q : global-subuniverse (λ l → l)) - ( C1 : is-closed-under-cauchy-exponential-species-subuniverse P Q) - ( C2 : + {α : Level → Level} {l1 l2 l3 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) + (C1 : is-closed-under-cauchy-exponential-species-subuniverse P Q) + (C2 : ( U : UU l1) → ( V : U → UU l1) → ( (u : U) → is-in-subuniverse P (V u)) → is-in-subuniverse P (Σ U V) → is-in-subuniverse P U) - ( S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) - ( X : type-subuniverse P) + (S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) + (X : type-subuniverse P) where - private + equiv-cauchy-exponential-Σ-extension-species-subuniverse : + Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3)) + ( cauchy-exponential-species-subuniverse P Q C1 S) + ( inclusion-subuniverse P X) ≃ + cauchy-exponential-species-types + ( Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q l3) + ( S)) + ( inclusion-subuniverse P X) + equiv-cauchy-exponential-Σ-extension-species-subuniverse = + ( reassociate') ∘e + ( equiv-tot + ( λ d → + equiv-Σ-equiv-base + ( λ p → + ( u : indexing-type-Relaxed-Σ-Decomposition d) → + inclusion-subuniverse + ( subuniverse-global-subuniverse Q l3) + ( S (cotype-Relaxed-Σ-Decomposition d u , p u))) + ( ( equiv-remove-redundant-prop + ( is-prop-type-Prop (P (indexing-type-Relaxed-Σ-Decomposition d))) + ( λ pV → + C2 + ( indexing-type-Relaxed-Σ-Decomposition d) + ( cotype-Relaxed-Σ-Decomposition d) + ( pV) + ( tr + ( is-in-subuniverse P) + ( eq-equiv + ( matching-correspondence-Relaxed-Σ-Decomposition d)) + ( pr2 X)))) ∘e + ( commutative-product) ∘e + ( equiv-remove-redundant-prop + ( is-prop-type-Prop (P (inclusion-subuniverse P X))) + ( λ _ → pr2 X))))) ∘e + ( reassociate) + where reassociate : Σ-extension-species-subuniverse ( P) @@ -192,74 +240,33 @@ module _ ( λ (d , f) → (d , pr1 ∘ f , pr2 ∘ f)) ( refl-htpy) ( refl-htpy) - - equiv-cauchy-exponential-Σ-extension-species-subuniverse : - Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3)) - ( cauchy-exponential-species-subuniverse P Q C1 S) - ( inclusion-subuniverse P X) ≃ - cauchy-exponential-species-types - ( Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l3) - ( S)) - ( inclusion-subuniverse P X) - equiv-cauchy-exponential-Σ-extension-species-subuniverse = - ( reassociate') ∘e - ( ( equiv-tot - ( λ d → - equiv-Σ-equiv-base - ( λ p → - ( u : indexing-type-Relaxed-Σ-Decomposition d) → - inclusion-subuniverse - ( subuniverse-global-subuniverse Q l3) - ( S (cotype-Relaxed-Σ-Decomposition d u , p u))) - ( ( inv-equiv - ( equiv-add-redundant-prop - ( is-prop-type-Prop - ( P (indexing-type-Relaxed-Σ-Decomposition d))) - ( λ pV → - C2 - ( indexing-type-Relaxed-Σ-Decomposition d) - ( cotype-Relaxed-Σ-Decomposition d) - ( pV) - ( tr - ( is-in-subuniverse P) - ( eq-equiv - ( matching-correspondence-Relaxed-Σ-Decomposition d)) - ( pr2 X))))) ∘e - ( ( commutative-product) ∘e - ( inv-equiv - ( equiv-add-redundant-prop - ( is-prop-type-Prop (P (inclusion-subuniverse P X))) - ( λ _ → pr2 X))))))) ∘e - ( reassociate)) ``` ### The Cauchy exponential of the sum of a species is equivalent to the Cauchy product of the exponential of the two species ```agda module _ - {l1 l2 l3 l4 : Level} (P : subuniverse l1 l2) - ( Q : global-subuniverse (λ l → l)) - ( C1 : is-closed-under-cauchy-exponential-species-subuniverse P Q) - ( C2 : is-closed-under-coproduct-species-subuniverse P Q) - ( C3 : is-closed-under-cauchy-product-species-subuniverse P Q) - ( C4 : + {α : Level → Level} + {l1 l2 l3 l4 : Level} + (P : subuniverse l1 l2) + (Q : global-subuniverse α) + (C1 : is-closed-under-cauchy-exponential-species-subuniverse P Q) + (C2 : is-closed-under-coproduct-species-subuniverse P Q) + (C3 : is-closed-under-cauchy-product-species-subuniverse P Q) + (C4 : ( U : UU l1) → ( V : U → UU l1) → ( (u : U) → is-in-subuniverse P (V u)) → ( is-in-subuniverse P (Σ U V)) → ( is-in-subuniverse P U)) - ( C5 : is-closed-under-coproducts-subuniverse P) - ( C6 : + (C5 : is-closed-under-coproducts-subuniverse P) + (C6 : ( A B : UU l1) → is-in-subuniverse P (A + B) → is-in-subuniverse P A × is-in-subuniverse P B) - ( S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) - ( T : species-subuniverse P (subuniverse-global-subuniverse Q l4)) - ( X : type-subuniverse P) + (S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) + (T : species-subuniverse P (subuniverse-global-subuniverse Q l4)) + (X : type-subuniverse P) where equiv-cauchy-exponential-sum-species-subuniverse : @@ -274,90 +281,69 @@ module _ ( cauchy-exponential-species-subuniverse P Q C1 T) ( X)) equiv-cauchy-exponential-sum-species-subuniverse = - ( ( inv-equiv - ( equiv-Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3 ⊔ l4)) - ( cauchy-product-species-subuniverse P Q C3 - ( cauchy-exponential-species-subuniverse P Q C1 S) - ( cauchy-exponential-species-subuniverse P Q C1 T)) - ( X))) ∘e - ( ( inv-equiv - ( equiv-cauchy-product-Σ-extension-species-subuniverse - ( P) - ( Q) - ( C3) - ( C5) - ( cauchy-exponential-species-subuniverse P Q C1 S) - ( cauchy-exponential-species-subuniverse P Q C1 T) - ( inclusion-subuniverse P X))) ∘e - ( ( equiv-tot - ( λ d → - equiv-product - ( inv-equiv - ( equiv-cauchy-exponential-Σ-extension-species-subuniverse - ( P) - ( Q) - ( C1) - ( C4) - ( S) - ( left-summand-binary-coproduct-Decomposition d , - pr1 (lemma-C6 d)))) - ( inv-equiv - ( equiv-cauchy-exponential-Σ-extension-species-subuniverse - ( P) - ( Q) - ( C1) - ( C4) - ( T) - ( right-summand-binary-coproduct-Decomposition d , - pr2 (lemma-C6 d)))))) ∘e - ( ( equiv-cauchy-exponential-sum-species-types - ( Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l3) - ( S)) - ( Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l4) - ( T)) - ( pr1 X)) ∘e - ( ( equiv-tot - ( λ d → - equiv-Π - ( λ x → - coproduct-species-types - ( Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l3) - ( S)) - ( Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l4) - ( T)) - ( cotype-Relaxed-Σ-Decomposition d x)) - ( id-equiv) - ( λ x → - equiv-coproduct-Σ-extension-species-subuniverse - ( P) - ( Q) - ( C2) - ( S) - ( T) - ( cotype-Relaxed-Σ-Decomposition d x)))) ∘e - ( ( equiv-cauchy-exponential-Σ-extension-species-subuniverse - ( P) - ( Q) - ( C1) - ( C4) - ( coproduct-species-subuniverse P Q C2 S T) - ( X)) ∘e - ( equiv-Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3 ⊔ l4)) - ( cauchy-exponential-species-subuniverse P Q C1 - ( coproduct-species-subuniverse P Q C2 S T)) - ( X)))))))) + ( inv-equiv + ( equiv-Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3 ⊔ l4)) + ( cauchy-product-species-subuniverse P Q C3 + ( cauchy-exponential-species-subuniverse P Q C1 S) + ( cauchy-exponential-species-subuniverse P Q C1 T)) + ( X))) ∘e + ( inv-equiv + ( equiv-cauchy-product-Σ-extension-species-subuniverse + ( P) + ( Q) + ( C3) + ( C5) + ( cauchy-exponential-species-subuniverse P Q C1 S) + ( cauchy-exponential-species-subuniverse P Q C1 T) + ( inclusion-subuniverse P X))) ∘e + ( equiv-tot + ( λ d → + equiv-product + ( inv-equiv + ( equiv-cauchy-exponential-Σ-extension-species-subuniverse + ( P) + ( Q) + ( C1) + ( C4) + ( S) + ( left-summand-binary-coproduct-Decomposition d , + pr1 (lemma-C6 d)))) + ( inv-equiv + ( equiv-cauchy-exponential-Σ-extension-species-subuniverse + ( P) + ( Q) + ( C1) + ( C4) + ( T) + ( right-summand-binary-coproduct-Decomposition d , + pr2 (lemma-C6 d)))))) ∘e + ( equiv-cauchy-exponential-sum-species-types + ( Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q l3) + ( S)) + ( Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q l4) + ( T)) + ( pr1 X)) ∘e + ( equiv-tot + ( λ d → + equiv-Π-equiv-family + ( λ x → + equiv-coproduct-Σ-extension-species-subuniverse P Q C2 S T + ( cotype-Relaxed-Σ-Decomposition d x)))) ∘e + ( equiv-cauchy-exponential-Σ-extension-species-subuniverse P Q C1 C4 + ( coproduct-species-subuniverse P Q C2 S T) + ( X)) ∘e + ( equiv-Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3 ⊔ l4)) + ( cauchy-exponential-species-subuniverse P Q C1 + ( coproduct-species-subuniverse P Q C2 S T)) + ( X)) where lemma-C6 = λ d → diff --git a/src/species/cauchy-exponentials-species-of-types.lagda.md b/src/species/cauchy-exponentials-species-of-types.lagda.md index 0a4e3d7d9c..8ef9626dde 100644 --- a/src/species/cauchy-exponentials-species-of-types.lagda.md +++ b/src/species/cauchy-exponentials-species-of-types.lagda.md @@ -22,6 +22,7 @@ open import foundation.identity-types open import foundation.relaxed-sigma-decompositions open import foundation.type-arithmetic-cartesian-product-types open import foundation.type-arithmetic-dependent-pair-types +open import foundation.type-arithmetic-unit-type open import foundation.unit-type open import foundation.univalence open import foundation.universe-levels @@ -37,13 +38,15 @@ open import species.species-of-types ## Idea -The **Cauchy exponential** of a species of types `S` can be thought of as the -Cauchy composite `exp ∘ S`. Since the exponent species is defined as `X ↦ 𝟙`, -the coefficients of the Cauchy exponential of `S` are defined as follows: -species of types : +The +{{#concept "Cauchy exponential" Disambiguation="of species of types" Agda=cauchy-exponential-species-types}} +of a [species of types](species.species-of-types.md) `S` can be thought of as +the [Cauchy composite](species.cauchy-composition-species-of-types.md) +`exp ∘ S`. Since the exponent species is defined as `X ↦ 𝟙`, the coefficients of +the Cauchy exponential of `S` is defined as the following species of types: ```text - X ↦ Σ ((U , V , e) : Relaxed-Σ-Decomposition X), Π (u : U) → S (V u). + X ↦ Σ ((U , V , e) : Relaxed-Σ-Decomposition X), Π (u : U) → S (V u). ``` ## Definition @@ -73,7 +76,7 @@ module _ cauchy-composition-species-types (λ _ → unit) S X ≃ cauchy-exponential-species-types S X equiv-cauchy-exponential-composition-unit-species-types = - equiv-tot λ _ → left-unit-law-product-is-contr is-contr-unit + equiv-tot (λ _ → left-unit-law-product) ``` ### The Cauchy exponential of the sum of a species is equivalent to the Cauchy product of the exponential of the two species @@ -85,7 +88,42 @@ module _ (T : species-types l1 l3) where - private + equiv-cauchy-exponential-sum-species-types : + equiv-species-types + ( cauchy-exponential-species-types (coproduct-species-types S T)) + ( cauchy-product-species-types + ( cauchy-exponential-species-types S) + ( cauchy-exponential-species-types T)) + equiv-cauchy-exponential-sum-species-types X = + ( reassociate X) ∘e + ( equiv-Σ + ( λ D → + ( ( b : indexing-type-Relaxed-Σ-Decomposition (pr1 (pr2 D))) → + S (cotype-Relaxed-Σ-Decomposition (pr1 (pr2 D)) b)) × + ( ( b : indexing-type-Relaxed-Σ-Decomposition (pr2 (pr2 D))) → + T (cotype-Relaxed-Σ-Decomposition (pr2 (pr2 D)) b))) + ( equiv-binary-coproduct-Decomposition-Σ-Decomposition) + ( λ D → + equiv-product + ( equiv-Π-equiv-family + ( λ a' → + equiv-eq + ( ap S + ( inv + ( compute-left-equiv-binary-coproduct-Decomposition-Σ-Decomposition + ( D) + ( a')))))) + ( equiv-Π-equiv-family + ( λ b' → + equiv-eq + ( ap T + ( inv + ( compute-right-equiv-binary-coproduct-Decomposition-Σ-Decomposition + ( D) + ( b')))))))) ∘e + ( inv-associative-Σ _ _ _) ∘e + ( equiv-tot (λ d → distributive-Π-coproduct-binary-coproduct-Decomposition)) + where reassociate : ( X : UU l1) → Σ ( Σ ( binary-coproduct-Decomposition l1 l1 X) @@ -110,46 +148,4 @@ module _ ( λ ( d , (dl , s) , dr , t) → ((d , dl , dr) , s , t)) ( refl-htpy) ( refl-htpy) - - equiv-cauchy-exponential-sum-species-types : - equiv-species-types - ( cauchy-exponential-species-types (coproduct-species-types S T)) - ( cauchy-product-species-types - ( cauchy-exponential-species-types S) - ( cauchy-exponential-species-types T)) - equiv-cauchy-exponential-sum-species-types X = - ( reassociate X) ∘e - ( ( equiv-Σ - ( λ D → - ( ( b : indexing-type-Relaxed-Σ-Decomposition (pr1 (pr2 D))) → - S (cotype-Relaxed-Σ-Decomposition (pr1 (pr2 D)) b)) × - ( ( b : indexing-type-Relaxed-Σ-Decomposition (pr2 (pr2 D))) → - T (cotype-Relaxed-Σ-Decomposition (pr2 (pr2 D)) b))) - ( equiv-binary-coproduct-Decomposition-Σ-Decomposition) - ( λ D → - equiv-product - ( equiv-Π-equiv-family - ( λ a' → - equiv-eq - ( ap S - ( inv - ( compute-left-equiv-binary-coproduct-Decomposition-Σ-Decomposition - ( D) - ( a')))))) - ( equiv-Π-equiv-family - ( λ b' → - equiv-eq - ( ap T - ( inv - ( compute-right-equiv-binary-coproduct-Decomposition-Σ-Decomposition - ( D) - ( b')))))))) ∘e - ( ( inv-associative-Σ - ( Relaxed-Σ-Decomposition l1 l1 X) - ( λ d → - binary-coproduct-Decomposition l1 l1 - ( indexing-type-Relaxed-Σ-Decomposition d)) - ( _)) ∘e - ( equiv-tot - ( λ d → distributive-Π-coproduct-binary-coproduct-Decomposition)))) ``` diff --git a/src/species/cauchy-products-species-of-types-in-subuniverses.lagda.md b/src/species/cauchy-products-species-of-types-in-subuniverses.lagda.md index dc5f62299c..7f48882226 100644 --- a/src/species/cauchy-products-species-of-types-in-subuniverses.lagda.md +++ b/src/species/cauchy-products-species-of-types-in-subuniverses.lagda.md @@ -1,4 +1,4 @@ -# Cauchy products of species of types in a subuniverse +# Cauchy products of species of types in subuniverses ```agda module species.cauchy-products-species-of-types-in-subuniverses where @@ -35,15 +35,18 @@ open import species.species-of-types-in-subuniverses ## Idea -The **Cauchy product** of two species `S` and `T` from `P` to `Q` of types in a -subuniverse is defined by +The +{{#concept "Cauchy product" Disambiguation="of species of types in subuniverses" Agda=cauchy-product-species-subuniverse}} +of two [species](species.species-of-types-in-subuniverses.md) `S` and `T` from +`P` to `Q` of types in [subuniverses](foundation.subuniverses.md) is defined by ```text - X ↦ Σ (k : P), Σ (k' : P), Σ (e : k + k' ≃ X), S(k) × T(k') + X ↦ Σ (k : P), Σ (k' : P), Σ (e : k + k' ≃ X), S(k) × T(k'). ``` -If `Q` is closed under products and dependent pair types over types in `P`, then -the Cauchy product is also a species of subuniverse from `P` to `Q`. +If `Q` is closed under [products](foundation.cartesian-product-types.md) and +[dependent pair types](foundation.dependent-pair-types.md) over types in `P`, +then the Cauchy product is also a species of subuniverses from `P` to `Q`. ## Definition @@ -51,8 +54,8 @@ the Cauchy product is also a species of subuniverse from `P` to `Q`. ```agda module _ - {l1 l2 l3 l4 : Level} (P : subuniverse l1 l2) - (Q : global-subuniverse (λ l → l)) + {α : Level → Level} {l1 l2 l3 l4 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) where type-cauchy-product-species-subuniverse : @@ -74,9 +77,10 @@ module _ ```agda is-closed-under-cauchy-product-species-subuniverse : - {l1 l2 : Level} (P : subuniverse l1 l2) (Q : global-subuniverse (λ l → l)) → + {α : Level → Level} {l1 l2 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) → UUω -is-closed-under-cauchy-product-species-subuniverse {l1} {l2} P Q = +is-closed-under-cauchy-product-species-subuniverse {α} {l1} {l2} P Q = {l3 l4 : Level} (S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) (T : species-subuniverse P (subuniverse-global-subuniverse Q l4)) @@ -90,9 +94,9 @@ is-closed-under-cauchy-product-species-subuniverse {l1} {l2} P Q = ```agda module _ - {l1 l2 l3 l4 : Level} (P : subuniverse l1 l2) - (Q : global-subuniverse (λ l → l)) - ( C1 : is-closed-under-cauchy-product-species-subuniverse P Q) + {α : Level → Level} {l1 l2 l3 l4 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) + (C1 : is-closed-under-cauchy-product-species-subuniverse P Q) where cauchy-product-species-subuniverse : @@ -107,20 +111,20 @@ module _ ## Properties -### Cauchy product is associative +### The Cauchy product is associative ```agda module _ - {l1 l2 l3 l4 l5 : Level} (P : subuniverse l1 l2) - (Q : global-subuniverse (λ l → l)) - ( C1 : is-closed-under-cauchy-product-species-subuniverse P Q) - ( C2 : is-closed-under-coproducts-subuniverse P) + {α : Level → Level} {l1 l2 l3 l4 l5 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) + (C1 : is-closed-under-cauchy-product-species-subuniverse P Q) + (C2 : is-closed-under-coproducts-subuniverse P) where module _ - (S : species-subuniverse P ( subuniverse-global-subuniverse Q l3)) - (T : species-subuniverse P ( subuniverse-global-subuniverse Q l4)) - (U : species-subuniverse P ( subuniverse-global-subuniverse Q l5)) + (S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) + (T : species-subuniverse P (subuniverse-global-subuniverse Q l4)) + (U : species-subuniverse P (subuniverse-global-subuniverse Q l5)) (X : type-subuniverse P) where @@ -144,9 +148,10 @@ module _ ( third-summand-ternary-coproduct-Decomposition-subuniverse P X d)))) equiv-left-iterated-cauchy-product-species-subuniverse = - ( ( equiv-Σ - ( λ d → - inclusion-subuniverse ( subuniverse-global-subuniverse Q l3) + ( equiv-Σ + ( λ d → + inclusion-subuniverse + ( subuniverse-global-subuniverse Q l3) ( S ( first-summand-ternary-coproduct-Decomposition-subuniverse P X d)) × @@ -157,23 +162,19 @@ module _ inclusion-subuniverse ( subuniverse-global-subuniverse Q l5) ( U ( third-summand-ternary-coproduct-Decomposition-subuniverse - P X d))))) - ( ( equiv-Σ - ( _) - ( associative-product _ _ _ ∘e commutative-product) - ( λ x → - equiv-postcomp-equiv - ( ( ( associative-coproduct) ∘e - ( ( commutative-coproduct _ _)))) - ( inclusion-subuniverse P X)) ∘e - equiv-ternary-left-iterated-coproduct-Decomposition-subuniverse + P X d)))) + ( ( equiv-Σ + ( _) + ( associative-product _ _ _ ∘e commutative-product) + ( λ x → + equiv-postcomp-equiv + ( associative-coproduct ∘e commutative-coproduct _ _) + ( inclusion-subuniverse P X))) ∘e + ( equiv-ternary-left-iterated-coproduct-Decomposition-subuniverse P X C2)) - ( λ d → associative-product _ _ _) ∘e - ( ( inv-associative-Σ - ( binary-coproduct-Decomposition-subuniverse P X) - ( λ z → binary-coproduct-Decomposition-subuniverse P (pr1 z)) - ( _)) ∘e - ( ( equiv-tot λ d → right-distributive-product-Σ)))) + ( λ d → associative-product _ _ _)) ∘e + ( inv-associative-Σ _ _ _) ∘e + ( equiv-tot (λ d → right-distributive-product-Σ)) equiv-right-iterated-cauchy-product-species-subuniverse : type-cauchy-product-species-subuniverse P Q @@ -195,15 +196,12 @@ module _ ( third-summand-ternary-coproduct-Decomposition-subuniverse P X d)))) equiv-right-iterated-cauchy-product-species-subuniverse = - ( ( equiv-Σ-equiv-base - ( _) - ( equiv-ternary-right-iterated-coproduct-Decomposition-subuniverse - P X C2)) ∘e - ( ( inv-associative-Σ - ( binary-coproduct-Decomposition-subuniverse P X) - ( λ z → binary-coproduct-Decomposition-subuniverse P (pr1 (pr2 z))) - ( _)) ∘e - ( ( equiv-tot (λ d → left-distributive-product-Σ))))) + ( equiv-Σ-equiv-base + ( _) + ( equiv-ternary-right-iterated-coproduct-Decomposition-subuniverse + P X C2)) ∘e + ( inv-associative-Σ _ _ _) ∘e + ( equiv-tot (λ d → left-distributive-product-Σ)) equiv-associative-cauchy-product-species-subuniverse : type-cauchy-product-species-subuniverse P Q @@ -243,13 +241,12 @@ module _ ( equiv-associative-cauchy-product-species-subuniverse S T U) ``` -### Cauchy product is commutative +### The Cauchy product is commutative ```agda module _ - {l1 l2 l3 l4 : Level} - (P : subuniverse l1 l2) - (Q : global-subuniverse (λ l → l)) + {α : Level → Level} {l1 l2 l3 l4 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) (C1 : is-closed-under-cauchy-product-species-subuniverse P Q) (S : species-subuniverse P ( subuniverse-global-subuniverse Q l3)) (T : species-subuniverse P ( subuniverse-global-subuniverse Q l4)) @@ -280,11 +277,11 @@ module _ ( equiv-commutative-cauchy-product-species-subuniverse) ``` -### Unit laws of Cauchy product +### Unit laws of the Cauchy product ```agda unit-cauchy-product-species-subuniverse : - {l1 l2 l3 : Level} → (P : subuniverse l1 l2) → (Q : subuniverse l1 l3) → + {l1 l2 l3 : Level} (P : subuniverse l1 l2) (Q : subuniverse l1 l3) → ( (X : type-subuniverse P) → is-in-subuniverse Q ( is-empty (inclusion-subuniverse P X))) → species-subuniverse P Q @@ -292,7 +289,8 @@ unit-cauchy-product-species-subuniverse P Q C X = is-empty (inclusion-subuniverse P X) , C X module _ - {l1 l2 l3 : Level} (P : subuniverse l1 l2) (Q : global-subuniverse (λ l → l)) + {α : Level → Level} {l1 l2 l3 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) (C1 : is-closed-under-cauchy-product-species-subuniverse P Q) (C2 : is-in-subuniverse P (raise-empty l1)) (C3 : @@ -314,38 +312,20 @@ module _ ( X) ≃ inclusion-subuniverse (subuniverse-global-subuniverse Q l3) (S X) equiv-right-unit-law-cauchy-product-species-subuniverse X = - ( ( left-unit-law-Σ-is-contr - ( is-torsorial-equiv-subuniverse P X) - ( X , id-equiv)) ∘e - ( ( equiv-Σ-equiv-base - ( λ p → - inclusion-subuniverse - ( subuniverse-global-subuniverse Q l3) - ( S (pr1 (p)))) - ( equiv-is-empty-right-summand-binary-coproduct-Decomposition-subuniverse - P - X - C2)) ∘e - ( ( inv-associative-Σ - ( binary-coproduct-Decomposition-subuniverse P X) - ( λ d → - inclusion-subuniverse - ( subuniverse-global-subuniverse Q l1) - ( unit-cauchy-product-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l1) - ( C3) - ( right-summand-binary-coproduct-Decomposition-subuniverse - P X d))) - ( λ z → - inclusion-subuniverse - ( subuniverse-global-subuniverse Q l3) - ( S - ( left-summand-binary-coproduct-Decomposition-subuniverse - P - X - (pr1 z))))) ∘e - ( ( equiv-tot (λ _ → commutative-product)))))) + ( left-unit-law-Σ-is-contr + ( is-torsorial-equiv-subuniverse P X) + ( X , id-equiv)) ∘e + ( equiv-Σ-equiv-base + ( λ p → + inclusion-subuniverse + ( subuniverse-global-subuniverse Q l3) + ( S (pr1 (p)))) + ( equiv-is-empty-right-summand-binary-coproduct-Decomposition-subuniverse + P + X + C2)) ∘e + ( inv-associative-Σ _ _ _) ∘e + ( equiv-tot (λ _ → commutative-product)) equiv-left-unit-law-cauchy-product-species-subuniverse : (X : type-subuniverse P) → @@ -375,16 +355,55 @@ module _ ```agda module _ - {l1 l2 l3 l4 : Level} (P : subuniverse l1 l2) - (Q : global-subuniverse (λ l → l)) - ( C1 : is-closed-under-cauchy-product-species-subuniverse P Q) - ( C2 : is-closed-under-coproducts-subuniverse P) + {α : Level → Level} {l1 l2 l3 l4 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) + (C1 : is-closed-under-cauchy-product-species-subuniverse P Q) + (C2 : is-closed-under-coproducts-subuniverse P) (S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) (T : species-subuniverse P (subuniverse-global-subuniverse Q l4)) (X : UU l1) where - private + equiv-cauchy-product-Σ-extension-species-subuniverse : + Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3 ⊔ l4)) + ( cauchy-product-species-subuniverse P Q C1 S T) + ( X) ≃ + cauchy-product-species-types + ( Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q l3) + ( S)) + ( Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q l4) + ( T)) + ( X) + equiv-cauchy-product-Σ-extension-species-subuniverse = + ( reassociate') ∘e + ( equiv-tot + ( λ d → + equiv-Σ-equiv-base + ( λ p → + ( inclusion-subuniverse + ( subuniverse-global-subuniverse Q l3) + ( S (left-summand-binary-coproduct-Decomposition d , pr1 p))) × + ( inclusion-subuniverse + ( subuniverse-global-subuniverse Q l4) + ( T (right-summand-binary-coproduct-Decomposition d , pr2 p)))) + ( equiv-remove-redundant-prop + ( is-prop-type-Prop (P X)) + ( λ p → + tr + ( is-in-subuniverse P) + ( inv + ( eq-equiv + ( matching-correspondence-binary-coproduct-Decomposition + ( d)))) + ( C2 (pr1 p) (pr2 p)))))) ∘e + ( reassociate) + where reassociate : Σ-extension-species-subuniverse ( P) @@ -429,51 +448,4 @@ module _ ( λ ( d , (pA , s) , (pB , t)) → (d , (pA , pB) , s , t)) ( refl-htpy) ( refl-htpy) - - equiv-cauchy-product-Σ-extension-species-subuniverse : - Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3 ⊔ l4)) - ( cauchy-product-species-subuniverse P Q C1 S T) - ( X) ≃ - cauchy-product-species-types - ( Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l3) - ( S)) - ( Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l4) - ( T)) - ( X) - equiv-cauchy-product-Σ-extension-species-subuniverse = - ( ( reassociate') ∘e - ( ( equiv-tot - ( λ d → - equiv-Σ-equiv-base - (λ p → - ( inclusion-subuniverse - ( subuniverse-global-subuniverse Q l3) - ( S - ( left-summand-binary-coproduct-Decomposition d , - pr1 p))) × - ( inclusion-subuniverse - ( subuniverse-global-subuniverse Q l4) - ( T - ( right-summand-binary-coproduct-Decomposition d , - pr2 p)))) - ( inv-equiv - ( equiv-add-redundant-prop - ( is-prop-type-Prop (P X)) - ( λ p → - tr - ( is-in-subuniverse P) - ( inv - ( eq-equiv - ( matching-correspondence-binary-coproduct-Decomposition - ( d)))) - ( C2 - ( pr1 p) - ( pr2 p))))))) ∘e - ( reassociate))) ``` diff --git a/src/species/cauchy-products-species-of-types.lagda.md b/src/species/cauchy-products-species-of-types.lagda.md index 1d4560f78f..4c2180167d 100644 --- a/src/species/cauchy-products-species-of-types.lagda.md +++ b/src/species/cauchy-products-species-of-types.lagda.md @@ -19,10 +19,13 @@ open import species.species-of-types ## Idea -The Cauchy product of two species of types `S` and `T` on `X` is defined as +The +{{#concept "Cauchy product" Disambiguation="of species of types" Agda=cauchy-product-species-types}} +of two [species of types](species.species-of-types.md) `S` and `T` on `X` is +defined as ```text - Σ (k : UU) (Σ (k' : UU) (Σ (e : k + k' ≃ X) S(k) × T(k'))) + Σ (k : UU) (Σ (k' : UU) (Σ (e : k + k' ≃ X) S(k) × T(k'))). ``` ## Definition diff --git a/src/species/cauchy-series-species-of-types-in-subuniverses.lagda.md b/src/species/cauchy-series-species-of-types-in-subuniverses.lagda.md index 4e9a36c29a..1e6f11e40a 100644 --- a/src/species/cauchy-series-species-of-types-in-subuniverses.lagda.md +++ b/src/species/cauchy-series-species-of-types-in-subuniverses.lagda.md @@ -1,4 +1,4 @@ -# Cauchy series of species of types in a subuniverse +# Cauchy series of species of types in subuniverses ```agda module species.cauchy-series-species-of-types-in-subuniverses where @@ -27,11 +27,13 @@ open import species.species-of-types-in-subuniverses ## Idea -The **Cauchy series** of a species `S` of types in subuniverse from `P` to `Q` -at `X` is defined as : +The +{{#concept "Cauchy series" Disambiguation="of species of types in subuniverses" Agda=cauchy-series-species-subuniverse}} +of a [species](species.species-of-types-in-subuniverses.md) `S` of types in +[subuniverse](foundation.subuniverses.md) from `P` to `Q` at `X` is defined as ```text -Σ (U : type-subuniverse P) (S(U) × (U → X)) + Σ (U : type-subuniverse P) (S(U) × (U → X)). ``` ## Definition @@ -61,25 +63,15 @@ module _ cauchy-series-species-subuniverse ≃ cauchy-series-species-types (Σ-extension-species-subuniverse P Q S) X equiv-cauchy-series-Σ-extension-species-subuniverse = - ( equiv-tot - ( λ U → - inv-associative-Σ - ( type-Prop (P U)) - ( λ p → inclusion-subuniverse Q (S (U , p))) - ( λ _ → U → X))) ∘e - ( associative-Σ - ( UU l1) - ( λ U → type-Prop (P U)) - ( λ U → Σ ( inclusion-subuniverse Q (S U)) (λ _ → pr1 U → X))) + (equiv-tot (λ U → inv-associative-Σ _ _ _)) ∘e (associative-Σ _ _ _) ``` ### Equivalences ```agda module _ - {l1 l2 l3 l4 l5 : Level} - (P : subuniverse l1 l2) - (Q : global-subuniverse (λ l → l)) + {α : Level → Level} {l1 l2 l3 l4 l5 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) (S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) (T : species-subuniverse P (subuniverse-global-subuniverse Q l4)) (f : @@ -101,7 +93,7 @@ module _ ( T) ( X) equiv-cauchy-series-equiv-species-subuniverse = - equiv-tot λ X → equiv-product (f X) id-equiv + equiv-tot (λ X → equiv-product-left (f X)) module _ {l1 l2 l3 l4 l5 l6 : Level} @@ -119,5 +111,5 @@ module _ equiv-cauchy-series-species-subuniverse = equiv-tot ( λ F → - equiv-product id-equiv (equiv-postcomp (inclusion-subuniverse P F) e)) + equiv-product-right (equiv-postcomp (inclusion-subuniverse P F) e)) ``` diff --git a/src/species/cauchy-series-species-of-types.lagda.md b/src/species/cauchy-series-species-of-types.lagda.md index a7a7a35a51..30bc9f739c 100644 --- a/src/species/cauchy-series-species-of-types.lagda.md +++ b/src/species/cauchy-series-species-of-types.lagda.md @@ -22,24 +22,28 @@ open import species.species-of-types ## Idea -In classical mathematics, the Cauchy series of a species (of finite types) `S` -is the formal series in `x` : +In classical mathematics, the _Cauchy series_ of a +[species](species.species-of-finite-types.md) (of +[finite types](univalent-combinatorics.finite-types.md)) `S` is the formal +series in `x`: ```text -Σ (n : ℕ) (|S({1,...,n}| x^n / n!)) + Σ (n : ℕ) (|S({1,...,n})| x^n / n!) ``` -The categorified version of this series is : +The categorified version of this series is: ```text - Σ (F : Finite-Type), S(F) × (F → X) + Σ (F : Finite-Type), S(F) × (F → X). ``` -Remarks that we can generalized this to species of types with the following -definition : +Hence, we can generalize to +{{#concept "Cauchy series" Disambiguation="of species of types" Agda=cauchy-series-species-types}} +of any [species of types](species.species-of-types.md) `S` with the following +definition: ```text - Σ (U : UU), S(U) × (U → X) + Σ (U : UU), S(U) × (U → X). ``` ## Definition @@ -66,7 +70,7 @@ module _ equiv-cauchy-series-equiv-species-types : cauchy-series-species-types S X ≃ cauchy-series-species-types T X equiv-cauchy-series-equiv-species-types = - equiv-tot λ X → equiv-product (f X) id-equiv + equiv-tot (λ X → equiv-product-left (f X)) ``` ### Cauchy series of types are equivalence invariant @@ -75,13 +79,12 @@ module _ module _ {l1 l2 l3 l4 : Level} (S : species-types l1 l2) - (X : UU l3) - (Y : UU l4) + {X : UU l3} {Y : UU l4} (e : X ≃ Y) where equiv-cauchy-series-species-types : cauchy-series-species-types S X ≃ cauchy-series-species-types S Y equiv-cauchy-series-species-types = - equiv-tot (λ F → equiv-product id-equiv (equiv-postcomp F e)) + equiv-tot (λ F → equiv-product-right (equiv-postcomp F e)) ``` diff --git a/src/species/composition-cauchy-series-species-of-types-in-subuniverses.lagda.md b/src/species/composition-cauchy-series-species-of-types-in-subuniverses.lagda.md index e0eb8cc904..6710835e7e 100644 --- a/src/species/composition-cauchy-series-species-of-types-in-subuniverses.lagda.md +++ b/src/species/composition-cauchy-series-species-of-types-in-subuniverses.lagda.md @@ -25,17 +25,20 @@ open import species.species-of-types-in-subuniverses ## Idea -The composition of Cauchy series of two species of subuniverse `S` and `T` at -`X` is defined as the Cauchy series of `S` applied to the Cauchy series of `T` -at `X` +The +{{#concept "composition" Disambiguation="of Cauchy series of two species of types in subuniverses" Agda=composition-cauchy-series-species-subuniverse}} +of [Cauchy series](species.cauchy-series-species-of-types-in-subuniverses.md) of +two +[species of types in subuniverses](species.species-of-types-in-subuniverses.md) +`S` and `T` at `X` is defined as the Cauchy series of `S` applied to the Cauchy +series of `T` at `X`. ## Definition ```agda module _ - {l1 l2 l3 l4 l5 : Level} - (P : subuniverse l1 l2) - (Q : global-subuniverse (λ l → l)) + {α : Level → Level} {l1 l2 l3 l4 l5 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) (S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) (T : species-subuniverse P (subuniverse-global-subuniverse Q l4)) (X : UU l5) @@ -61,9 +64,8 @@ module _ ```agda module _ - {l1 l2 l3 l4 l5 : Level} - (P : subuniverse l1 l2) - (Q : global-subuniverse (λ l → l)) + {α : Level → Level} {l1 l2 l3 l4 l5 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) (S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) (T : species-subuniverse P (subuniverse-global-subuniverse Q l4)) (X : UU l5) @@ -92,37 +94,25 @@ module _ ( subuniverse-global-subuniverse Q l4) ( T) ( X)))) ∘e - ( equiv-cauchy-series-species-types - ( Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l3) - ( S)) - ( cauchy-series-species-types - ( Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l4) - ( T)) - ( X)) - ( cauchy-series-species-subuniverse + ( equiv-cauchy-series-species-types + ( Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q l3) + ( S)) + ( inv-equiv + ( equiv-cauchy-series-Σ-extension-species-subuniverse ( P) ( subuniverse-global-subuniverse Q l4) ( T) - ( X)) - ( inv-equiv - ( equiv-cauchy-series-Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l4) - ( T) - ( X)))) + ( X)))) ``` ### The Cauchy series associated to the composition of the species `S` and `T` is the composition of their Cauchy series ```agda module _ - {l1 l2 l3 l4 l5 : Level} - (P : subuniverse l1 l2) - (Q : global-subuniverse (λ l → l)) + {α : Level → Level} {l1 l2 l3 l4 l5 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) (C1 : is-closed-under-cauchy-composition-species-subuniverse P Q) (C2 : is-closed-under-Σ-subuniverse P) (S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) @@ -140,7 +130,22 @@ module _ equiv-cauchy-series-composition-species-subuniverse = ( equiv-composition-cauchy-series-Σ-extension-species-subuniverse P Q S T ( X)) ∘e - ( ( equiv-cauchy-series-composition-species-types + ( equiv-cauchy-series-composition-species-types + ( Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q l3) + ( S)) + ( Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q l4) + ( T)) + ( X)) ∘e + ( equiv-cauchy-series-equiv-species-types + ( Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3 ⊔ l4)) + ( cauchy-composition-species-subuniverse P Q C1 C2 S T)) + ( cauchy-composition-species-types ( Σ-extension-species-subuniverse ( P) ( subuniverse-global-subuniverse Q l3) @@ -148,33 +153,18 @@ module _ ( Σ-extension-species-subuniverse ( P) ( subuniverse-global-subuniverse Q l4) - ( T)) - ( X)) ∘e - ( ( equiv-cauchy-series-equiv-species-types - ( Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3 ⊔ l4)) - ( cauchy-composition-species-subuniverse P Q C1 C2 S T)) - ( cauchy-composition-species-types - ( Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l3) - ( S)) - ( Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l4) - ( T))) - ( preserves-cauchy-composition-Σ-extension-species-subuniverse - ( P) - ( Q) - ( C1) - ( C2) - ( S) - ( T)) - ( X)) ∘e - ( equiv-cauchy-series-Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3 ⊔ l4)) - ( cauchy-composition-species-subuniverse P Q C1 C2 S T) - ( X)))) + ( T))) + ( preserves-cauchy-composition-Σ-extension-species-subuniverse + ( P) + ( Q) + ( C1) + ( C2) + ( S) + ( T)) + ( X)) ∘e + ( equiv-cauchy-series-Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3 ⊔ l4)) + ( cauchy-composition-species-subuniverse P Q C1 C2 S T) + ( X)) ``` diff --git a/src/species/composition-cauchy-series-species-of-types.lagda.md b/src/species/composition-cauchy-series-species-of-types.lagda.md index 729af0a56f..e89452ef92 100644 --- a/src/species/composition-cauchy-series-species-of-types.lagda.md +++ b/src/species/composition-cauchy-series-species-of-types.lagda.md @@ -29,8 +29,11 @@ open import species.species-of-types ## Idea -The composition of Cauchy series of two species of types `S` and `T` at `X` is -defined as the Cauchy series of `S` applied to the Cauchy series of `T` at `X` +The +{{#concept "composition" Disambiguation="of Cauchy series of two species of types in subuniverses" Agda=composition-cauchy-series-species-subuniverse}} +of [Cauchy series](species.cauchy-series-species-of-types.md) of two +[species of types](species.species-of-types.md) `S` and `T` at `X` is defined as +the Cauchy series of `S` applied to the Cauchy series of `T` at `X`. ## Definition @@ -42,7 +45,7 @@ composition-cauchy-series-species-types S T X = cauchy-series-species-types S (cauchy-series-species-types T X) ``` -## Property +## Properties ### The Cauchy series associated to the composition of the species `S` and `T` is the composition of their Cauchy series @@ -54,7 +57,26 @@ module _ (X : UU l4) where - private + equiv-cauchy-series-composition-species-types : + cauchy-series-species-types + ( cauchy-composition-species-types S T) + ( X) ≃ + composition-cauchy-series-species-types S T X + equiv-cauchy-series-composition-species-types = + ( equiv-tot + ( λ U → + ( equiv-product-right inv-distributive-Π-Σ) ∘e + ( inv-equiv left-distributive-product-Σ) ∘e + ( equiv-tot + ( λ V → + ( equiv-product-right + ( ( inv-equiv-up-product) ∘e + ( equiv-product-right equiv-ev-pair))) ∘e + ( left-unit-law-Σ-is-contr + ( is-torsorial-equiv' (Σ U V)) + ( Σ U V , id-equiv)))))) ∘e + ( reassociate) + where reassociate : cauchy-series-species-types (cauchy-composition-species-types S T) X ≃ Σ ( UU l1) @@ -71,27 +93,4 @@ module _ (F , ((U , V , e) , s , fs) , ft)) ( refl-htpy) ( refl-htpy) - - equiv-cauchy-series-composition-species-types : - cauchy-series-species-types - ( cauchy-composition-species-types S T) - ( X) ≃ - composition-cauchy-series-species-types S T X - equiv-cauchy-series-composition-species-types = - ( equiv-tot - ( λ U → - ( equiv-product - ( id-equiv) - ( inv-equiv distributive-Π-Σ)) ∘e - ( ( inv-equiv left-distributive-product-Σ) ∘e - ( equiv-tot - ( λ V → - ( equiv-product - ( id-equiv) - ( ( inv-equiv equiv-up-product) ∘e - ( equiv-product id-equiv equiv-ev-pair))) ∘e - ( left-unit-law-Σ-is-contr - ( is-torsorial-equiv' (Σ U V)) - ( Σ U V , id-equiv))))))) ∘e - ( reassociate) ``` diff --git a/src/species/coproducts-species-of-types-in-subuniverses.lagda.md b/src/species/coproducts-species-of-types-in-subuniverses.lagda.md index 2900441e71..3fca3f2675 100644 --- a/src/species/coproducts-species-of-types-in-subuniverses.lagda.md +++ b/src/species/coproducts-species-of-types-in-subuniverses.lagda.md @@ -25,9 +25,13 @@ open import species.species-of-types-in-subuniverses ## Idea -The coproduct of two species of types of subuniverse `F` and `G` is the -pointwise coproduct provided that the domain subuniverse of `F` and `G` is -stable by coproduct. +The +{{#concept "coproduct" Disambiguation="of species of types in subuniverses" Agda=coproduct-species-subuniverse}} +of two +[species of types in subuniverses](species.species-of-types-in-subuniverses.md) +`F` and `G` is the pointwise [coproduct](foundation.coproduct-types.md) provided +that the domain [subuniverse](foundation.subuniverses.md) of `F` and `G` is +stable under coproduct. ## Definitions @@ -35,8 +39,8 @@ stable by coproduct. ```agda module _ - {l1 l2 l3 l4 : Level} (P : subuniverse l1 l2) - (Q : global-subuniverse (λ l → l)) + {α : Level → Level} {l1 l2 l3 l4 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) where type-coproduct-species-subuniverse : @@ -56,7 +60,8 @@ module _ ```agda is-closed-under-coproduct-species-subuniverse : - {l1 l2 : Level} (P : subuniverse l1 l2) (Q : global-subuniverse (λ l → l)) → + {α : Level → Level} {l1 l2 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) → UUω is-closed-under-coproduct-species-subuniverse P Q = {l3 l4 : Level} @@ -72,9 +77,9 @@ is-closed-under-coproduct-species-subuniverse P Q = ```agda module _ - {l1 l2 l3 l4 : Level} (P : subuniverse l1 l2) - (Q : global-subuniverse (λ l → l)) - ( C1 : is-closed-under-coproduct-species-subuniverse P Q) + {α : Level → Level} {l1 l2 l3 l4 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) + (C1 : is-closed-under-coproduct-species-subuniverse P Q) where coproduct-species-subuniverse : @@ -92,12 +97,12 @@ module _ ```agda module _ - {l1 l2 l3 l4 : Level} (P : subuniverse l1 l2) - ( Q : global-subuniverse (λ l → l)) - ( C1 : is-closed-under-coproduct-species-subuniverse P Q) - ( S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) - ( T : species-subuniverse P (subuniverse-global-subuniverse Q l4)) - ( X : UU l1) + {α : Level → Level} {l1 l2 l3 l4 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) + (C1 : is-closed-under-coproduct-species-subuniverse P Q) + (S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) + (T : species-subuniverse P (subuniverse-global-subuniverse Q l4)) + (X : UU l1) where map-coproduct-Σ-extension-species-subuniverse : @@ -116,8 +121,8 @@ module _ ( subuniverse-global-subuniverse Q l4) ( T)) ( X) - map-coproduct-Σ-extension-species-subuniverse (p , inl x) = inl ( p , x) - map-coproduct-Σ-extension-species-subuniverse (p , inr x) = inr ( p , x) + map-coproduct-Σ-extension-species-subuniverse (p , inl x) = inl (p , x) + map-coproduct-Σ-extension-species-subuniverse (p , inr x) = inr (p , x) map-inv-coproduct-Σ-extension-species-subuniverse : coproduct-species-types diff --git a/src/species/coproducts-species-of-types.lagda.md b/src/species/coproducts-species-of-types.lagda.md index b38a5e44ee..b0a3a55093 100644 --- a/src/species/coproducts-species-of-types.lagda.md +++ b/src/species/coproducts-species-of-types.lagda.md @@ -23,7 +23,10 @@ open import species.species-of-types ## Idea -The coproduct of two species of types `F` and `G` is the pointwise coproduct. +The +{{#concept "coproduct" Disambiguation="of species of types" Agda=coproduct-species-types}} +of two [species of types](species.species-of-types.md) `F` and `G` is the +pointwise [coproduct](foundation.coproduct-types.md). ## Definition @@ -33,13 +36,17 @@ The coproduct of two species of types `F` and `G` is the pointwise coproduct. coproduct-species-types : {l1 l2 l3 : Level} (F : species-types l1 l2) (G : species-types l1 l3) → species-types l1 (l2 ⊔ l3) -coproduct-species-types F G X = F X + G X +coproduct-species-types F G X = (F X + G X) ``` ## Universal properties -Proof of (hom-species-types (species-types-coproduct F G) H) ≃ -((hom-species-types F H) × (hom-species-types G H)). +Proof of + +```text + (hom-species-types (species-types-coproduct F G) H) ≃ + ((hom-species-types F H) × (hom-species-types G H)). +``` ```agda equiv-universal-property-coproduct-species-types : diff --git a/src/species/cycle-index-series-species-of-types.lagda.md b/src/species/cycle-index-series-species-of-types.lagda.md index 36fe229ae9..383070901c 100644 --- a/src/species/cycle-index-series-species-of-types.lagda.md +++ b/src/species/cycle-index-series-species-of-types.lagda.md @@ -19,12 +19,14 @@ open import univalent-combinatorics.cyclic-finite-types ## Idea -The cycle index series of a species of types `F` is a type family indexed by -finite families of cyclic types. Note that a finite family of cyclic types `Cᵢ` -uniquely determines a permutation `e` on the disjoint union `C := Σᵢ Cᵢ` of the -underlying types of the `Cᵢ`. This permutation determines an action `F e` on -`F C`. The cycle index series of `F` at the family `Cᵢ` is the type `Fix (F e)` -of fixed points of `F e`. +The {{#concept "cycle index series" Disambiguation="of species of types"}} of a +[species of types](species.species-of-types.md) `F` is a type family indexed by +finite families of +[cyclic types](univalent-combinatorics.cyclic-finite-types.md). Note that a +finite family of cyclic types `Cᵢ` uniquely determines a permutation `e` on the +disjoint union `C := Σᵢ Cᵢ` of the underlying types of the `Cᵢ`. This +permutation determines an action `F e` on `F C`. The cycle index series of `F` +at the family `Cᵢ` is the type `Fix (F e)` of fixed points of `F e`. ## Definition diff --git a/src/species/derivatives-species-of-types.lagda.md b/src/species/derivatives-species-of-types.lagda.md index 089dca1f20..7e505b0706 100644 --- a/src/species/derivatives-species-of-types.lagda.md +++ b/src/species/derivatives-species-of-types.lagda.md @@ -18,9 +18,11 @@ open import species.species-of-types ## Idea -When we think of a species of types as the coefficients of a formal power -series, the derivative of a species of types is the species of types -representing the derivative of that formal power series. +When we think of a [species of types](species.species-of-types.md) as the +coefficients of a formal power series, the +{{#concept "derivative" Disambiguation="of species of types" Agda=derivative-species-types}} +of a species of types is the species of types representing the derivative of +that formal power series. ## Definition diff --git a/src/species/dirichlet-exponentials-species-of-types-in-subuniverses.lagda.md b/src/species/dirichlet-exponentials-species-of-types-in-subuniverses.lagda.md index caf7c99d4d..40ae633640 100644 --- a/src/species/dirichlet-exponentials-species-of-types-in-subuniverses.lagda.md +++ b/src/species/dirichlet-exponentials-species-of-types-in-subuniverses.lagda.md @@ -1,4 +1,4 @@ -# Dirichlet exponentials of species of types in a subuniverse +# Dirichlet exponentials of species of types in subuniverses ```agda module species.dirichlet-exponentials-species-of-types-in-subuniverses where @@ -37,16 +37,18 @@ open import species.species-of-types-in-subuniverses ## Idea -The **Dirichlet exponential** of a species `S : P → Q` of types in subuniverse -is defined by +The +{{#concept "Dirichlet exponential" Disambiguation="of species of types in subuniverses" Agda=dirichlet-exponential-species-subuniverse}} +of a [species](species.species-of-types-in-subuniverses.md) `S : P → Q` of types +in [subuniverses](foundation.subuniverses.md) is defined by ```text X ↦ Σ ((U , V , e) : Π-Decomposition-subuniverse P X), Π (u : U) → S (V u). ``` -If `Q` is a global subuniverse, and if the previous definition is in `Q`, then -the Dirichlet exponential is also a species of types in subuniverse from `P` to -`Q`. +If `Q` is a [global subuniverse](foundation.global-subuniverses.md), and if the +previous definition is in `Q`, then the Dirichlet exponential is also a species +of types in subuniverses from `P` to `Q`. ## Definition @@ -54,7 +56,8 @@ the Dirichlet exponential is also a species of types in subuniverse from `P` to ```agda module _ - {l1 l2 l3 : Level} (P : subuniverse l1 l2) (Q : global-subuniverse (λ l → l)) + {α : Level → Level} {l1 l2 l3 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) where type-dirichlet-exponential-species-subuniverse : @@ -73,9 +76,10 @@ module _ ```agda is-closed-under-dirichlet-exponential-species-subuniverse : - {l1 l2 : Level} (P : subuniverse l1 l2) (Q : global-subuniverse (λ l → l)) → + {α : Level → Level} {l1 l2 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) → UUω -is-closed-under-dirichlet-exponential-species-subuniverse {l1} {l2} P Q = +is-closed-under-dirichlet-exponential-species-subuniverse {α} {l1} {l2} P Q = {l3 : Level} (S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) (X : type-subuniverse P) → @@ -88,8 +92,9 @@ is-closed-under-dirichlet-exponential-species-subuniverse {l1} {l2} P Q = ```agda module _ - {l1 l2 l3 : Level} (P : subuniverse l1 l2) (Q : global-subuniverse (λ l → l)) - ( C1 : is-closed-under-dirichlet-exponential-species-subuniverse P Q) + {α : Level → Level} {l1 l2 l3 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) + (C1 : is-closed-under-dirichlet-exponential-species-subuniverse P Q) where dirichlet-exponential-species-subuniverse : @@ -106,18 +111,57 @@ module _ ```agda module _ - {l1 l2 l3 : Level} (P : subuniverse l1 l2) (Q : global-subuniverse (λ l → l)) - ( C1 : is-closed-under-dirichlet-exponential-species-subuniverse P Q) - ( C2 : + {α : Level → Level} {l1 l2 l3 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) + (C1 : is-closed-under-dirichlet-exponential-species-subuniverse P Q) + (C2 : ( U : UU l1) → ( V : U → UU l1) → ( (u : U) → is-in-subuniverse P (V u)) → is-in-subuniverse P (Π U V) → is-in-subuniverse P U) - ( S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) - ( X : type-subuniverse P) + (S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) + (X : type-subuniverse P) where - private + equiv-dirichlet-exponential-Σ-extension-species-subuniverse : + Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3)) + ( dirichlet-exponential-species-subuniverse P Q C1 S) + ( inclusion-subuniverse P X) ≃ + dirichlet-exponential-species-types + ( Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q l3) + ( S)) + ( inclusion-subuniverse P X) + equiv-dirichlet-exponential-Σ-extension-species-subuniverse = + ( reassociate') ∘e + ( equiv-tot + ( λ d → + equiv-Σ-equiv-base + ( λ p → + ( u : indexing-type-Π-Decomposition d) → + inclusion-subuniverse + ( subuniverse-global-subuniverse Q l3) + ( S (cotype-Π-Decomposition d u , p u))) + ( ( equiv-remove-redundant-prop + ( is-prop-type-Prop (P (indexing-type-Π-Decomposition d))) + ( λ pV → + C2 + ( indexing-type-Π-Decomposition d) + ( cotype-Π-Decomposition d) + ( pV) + ( tr + ( is-in-subuniverse P) + ( eq-equiv (matching-correspondence-Π-Decomposition d)) + ( pr2 X)))) ∘e + ( commutative-product) ∘e + ( equiv-remove-redundant-prop + ( is-prop-type-Prop (P (inclusion-subuniverse P X))) + ( λ _ → pr2 X))))) ∘e + ( reassociate) + where reassociate : Σ-extension-species-subuniverse ( P) @@ -161,73 +205,31 @@ module _ ( λ (d , f) → (d , pr1 ∘ f , pr2 ∘ f)) ( refl-htpy) ( refl-htpy) - - equiv-dirichlet-exponential-Σ-extension-species-subuniverse : - Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3)) - ( dirichlet-exponential-species-subuniverse P Q C1 S) - ( inclusion-subuniverse P X) ≃ - dirichlet-exponential-species-types - ( Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l3) - ( S)) - ( inclusion-subuniverse P X) - equiv-dirichlet-exponential-Σ-extension-species-subuniverse = - ( reassociate') ∘e - ( ( equiv-tot - ( λ d → - equiv-Σ-equiv-base - ( λ p → - ( u : indexing-type-Π-Decomposition d) → - inclusion-subuniverse - ( subuniverse-global-subuniverse Q l3) - ( S (cotype-Π-Decomposition d u , p u))) - ( ( inv-equiv - ( equiv-add-redundant-prop - ( is-prop-type-Prop - ( P (indexing-type-Π-Decomposition d))) - ( λ pV → - C2 - ( indexing-type-Π-Decomposition d) - ( cotype-Π-Decomposition d) - ( pV) - ( tr - ( is-in-subuniverse P) - ( eq-equiv (matching-correspondence-Π-Decomposition d)) - ( pr2 X))))) ∘e - ( ( commutative-product) ∘e - ( inv-equiv - ( equiv-add-redundant-prop - ( is-prop-type-Prop (P (inclusion-subuniverse P X))) - ( λ _ → pr2 X))))))) ∘e - ( reassociate)) ``` ### The Dirichlet exponential of the sum of a species is equivalent to the Dirichlet product of the exponential of the two species ```agda module _ - {l1 l2 l3 l4 : Level} (P : subuniverse l1 l2) - (Q : global-subuniverse (λ l → l)) - ( C1 : is-closed-under-dirichlet-exponential-species-subuniverse P Q) - ( C2 : is-closed-under-coproduct-species-subuniverse P Q) - ( C3 : is-closed-under-dirichlet-product-species-subuniverse P Q) - ( C4 : + {α : Level → Level} {l1 l2 l3 l4 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) + (C1 : is-closed-under-dirichlet-exponential-species-subuniverse P Q) + (C2 : is-closed-under-coproduct-species-subuniverse P Q) + (C3 : is-closed-under-dirichlet-product-species-subuniverse P Q) + (C4 : ( U : UU l1) → ( V : U → UU l1) → ( (u : U) → is-in-subuniverse P (V u)) → ( is-in-subuniverse P (Π U V)) → ( is-in-subuniverse P U)) - ( C5 : is-closed-under-products-subuniverse P) - ( C6 : + (C5 : is-closed-under-products-subuniverse P) + (C6 : ( A B : UU l1) → is-in-subuniverse P (A × B) → is-in-subuniverse P A × is-in-subuniverse P B) - ( S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) - ( T : species-subuniverse P (subuniverse-global-subuniverse Q l4)) - ( X : type-subuniverse P) + (S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) + (T : species-subuniverse P (subuniverse-global-subuniverse Q l4)) + (X : type-subuniverse P) where equiv-dirichlet-exponential-sum-species-subuniverse : @@ -242,90 +244,65 @@ module _ ( dirichlet-exponential-species-subuniverse P Q C1 T) ( X)) equiv-dirichlet-exponential-sum-species-subuniverse = - ( ( inv-equiv - ( equiv-Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3 ⊔ l4)) - ( dirichlet-product-species-subuniverse P Q C3 - ( dirichlet-exponential-species-subuniverse P Q C1 S) - ( dirichlet-exponential-species-subuniverse P Q C1 T)) - ( X))) ∘e - ( ( inv-equiv - ( equiv-dirichlet-product-Σ-extension-species-subuniverse - ( P) - ( Q) - ( C3) - ( C5) - ( dirichlet-exponential-species-subuniverse P Q C1 S) - ( dirichlet-exponential-species-subuniverse P Q C1 T) - ( inclusion-subuniverse P X))) ∘e - ( ( equiv-tot - ( λ d → - equiv-product - (( inv-equiv - ( equiv-dirichlet-exponential-Σ-extension-species-subuniverse - ( P) - ( Q) - ( C1) - ( C4) - ( S) - ( left-summand-binary-product-Decomposition d , - pr1 (lemma-C6 d))))) - (( inv-equiv - ( equiv-dirichlet-exponential-Σ-extension-species-subuniverse - ( P) - ( Q) - ( C1) - ( C4) - ( T) - ( right-summand-binary-product-Decomposition d , - pr2 (lemma-C6 d))))))) ∘e - ( ( equiv-dirichlet-exponential-sum-species-types - ( Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l3) - ( S)) - ( Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l4) - ( T)) - ( pr1 X)) ∘e - ( ( equiv-tot - ( λ d → - equiv-Π - ( λ x → - coproduct-species-types - ( Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l3) - ( S)) - ( Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l4) - ( T)) - ( cotype-Π-Decomposition d x)) - ( id-equiv) - ( λ x → - equiv-coproduct-Σ-extension-species-subuniverse - ( P) - ( Q) - ( C2) - ( S) - ( T) - ( cotype-Π-Decomposition d x)))) ∘e - ( ( equiv-dirichlet-exponential-Σ-extension-species-subuniverse - ( P) - ( Q) - ( C1) - ( C4) - ( coproduct-species-subuniverse P Q C2 S T) - ( X)) ∘e - ( equiv-Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3 ⊔ l4)) - ( dirichlet-exponential-species-subuniverse P Q C1 - ( coproduct-species-subuniverse P Q C2 S T)) - ( X)))))))) + ( inv-equiv + ( equiv-Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3 ⊔ l4)) + ( dirichlet-product-species-subuniverse P Q C3 + ( dirichlet-exponential-species-subuniverse P Q C1 S) + ( dirichlet-exponential-species-subuniverse P Q C1 T)) + ( X))) ∘e + ( inv-equiv + ( equiv-dirichlet-product-Σ-extension-species-subuniverse P Q C3 C5 + ( dirichlet-exponential-species-subuniverse P Q C1 S) + ( dirichlet-exponential-species-subuniverse P Q C1 T) + ( inclusion-subuniverse P X))) ∘e + ( equiv-tot + ( λ d → + equiv-product + ( inv-equiv + ( equiv-dirichlet-exponential-Σ-extension-species-subuniverse + ( P) + ( Q) + ( C1) + ( C4) + ( S) + ( left-summand-binary-product-Decomposition d , + pr1 (lemma-C6 d)))) + ( inv-equiv + ( equiv-dirichlet-exponential-Σ-extension-species-subuniverse + ( P) + ( Q) + ( C1) + ( C4) + ( T) + ( right-summand-binary-product-Decomposition d , + pr2 (lemma-C6 d)))))) ∘e + ( equiv-dirichlet-exponential-sum-species-types + ( Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q l3) + ( S)) + ( Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q l4) + ( T)) + ( pr1 X)) ∘e + ( equiv-tot + ( λ d → + equiv-Π-equiv-family + ( λ x → + equiv-coproduct-Σ-extension-species-subuniverse P Q C2 S T + ( cotype-Π-Decomposition d x)))) ∘e + ( equiv-dirichlet-exponential-Σ-extension-species-subuniverse P Q C1 C4 + ( coproduct-species-subuniverse P Q C2 S T) + ( X)) ∘e + ( equiv-Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3 ⊔ l4)) + ( dirichlet-exponential-species-subuniverse P Q C1 + ( coproduct-species-subuniverse P Q C2 S T)) + ( X)) where lemma-C6 = λ d → diff --git a/src/species/dirichlet-exponentials-species-of-types.lagda.md b/src/species/dirichlet-exponentials-species-of-types.lagda.md index 4a1ac22104..8fdc9897a6 100644 --- a/src/species/dirichlet-exponentials-species-of-types.lagda.md +++ b/src/species/dirichlet-exponentials-species-of-types.lagda.md @@ -35,7 +35,9 @@ open import species.species-of-types ## Idea -The **Dirichlet exponential** of a species of types `S` is defined as follows: +The +{{#concept "Dirichlet exponential" Disambiguation="of species of types" Agda=dirichlet-exponential-species-types}} +of a [species of types](species.species-of-types.md) `S` is defined as follows: ```text X ↦ Σ ((U , V , e) : Π-Decomposition X), Π (u : U) → S (V u). @@ -64,7 +66,42 @@ module _ (T : species-types l1 l3) where - private + equiv-dirichlet-exponential-sum-species-types : + equiv-species-types + ( dirichlet-exponential-species-types (coproduct-species-types S T)) + ( dirichlet-product-species-types + ( dirichlet-exponential-species-types S) + ( dirichlet-exponential-species-types T)) + equiv-dirichlet-exponential-sum-species-types X = + ( reassociate X) ∘e + ( equiv-Σ + ( λ D → + ( ( b : indexing-type-Π-Decomposition (pr1 (pr2 D))) → + S (cotype-Π-Decomposition (pr1 (pr2 D)) b)) × + ( ( b : indexing-type-Π-Decomposition (pr2 (pr2 D))) → + T (cotype-Π-Decomposition (pr2 (pr2 D)) b))) + ( equiv-binary-product-Decomposition-Π-Decomposition) + ( λ D → + equiv-product + ( equiv-Π-equiv-family + ( λ a' → + equiv-eq + ( ap S + ( inv + ( compute-left-equiv-binary-product-Decomposition-Π-Decomposition + ( D) + ( a')))))) + ( equiv-Π-equiv-family + ( λ b' → + equiv-eq + ( ap T + ( inv + ( compute-right-equiv-binary-product-Decomposition-Π-Decomposition + ( D) + ( b')))))))) ∘e + ( inv-associative-Σ _ _ _) ∘e + ( equiv-tot (λ d → distributive-Π-coproduct-binary-coproduct-Decomposition)) + where reassociate : ( X : UU l1) → Σ ( Σ ( binary-product-Decomposition l1 l1 X) @@ -89,46 +126,4 @@ module _ ( λ ( d , (dl , s) , dr , t) → ((d , dl , dr) , s , t)) ( refl-htpy) ( refl-htpy) - - equiv-dirichlet-exponential-sum-species-types : - equiv-species-types - ( dirichlet-exponential-species-types (coproduct-species-types S T)) - ( dirichlet-product-species-types - ( dirichlet-exponential-species-types S) - ( dirichlet-exponential-species-types T)) - equiv-dirichlet-exponential-sum-species-types X = - ( reassociate X) ∘e - ( ( equiv-Σ - ( λ D → - ( ( b : indexing-type-Π-Decomposition (pr1 (pr2 D))) → - S (cotype-Π-Decomposition (pr1 (pr2 D)) b)) × - ( ( b : indexing-type-Π-Decomposition (pr2 (pr2 D))) → - T (cotype-Π-Decomposition (pr2 (pr2 D)) b))) - ( equiv-binary-product-Decomposition-Π-Decomposition) - ( λ D → - equiv-product - ( equiv-Π-equiv-family - ( λ a' → - equiv-eq - ( ap S - ( inv - ( compute-left-equiv-binary-product-Decomposition-Π-Decomposition - ( D) - ( a')))))) - ( equiv-Π-equiv-family - ( λ b' → - equiv-eq - ( ap T - ( inv - ( compute-right-equiv-binary-product-Decomposition-Π-Decomposition - ( D) - ( b')))))))) ∘e - ( ( inv-associative-Σ - ( Π-Decomposition l1 l1 X) - ( λ d → - binary-coproduct-Decomposition l1 l1 - ( indexing-type-Π-Decomposition d)) - ( _)) ∘e - ( equiv-tot - ( λ d → distributive-Π-coproduct-binary-coproduct-Decomposition)))) ``` diff --git a/src/species/dirichlet-products-species-of-types-in-subuniverses.lagda.md b/src/species/dirichlet-products-species-of-types-in-subuniverses.lagda.md index 1c966ec39c..1a872f00c7 100644 --- a/src/species/dirichlet-products-species-of-types-in-subuniverses.lagda.md +++ b/src/species/dirichlet-products-species-of-types-in-subuniverses.lagda.md @@ -34,15 +34,20 @@ open import species.species-of-types-in-subuniverses ## Idea -The Dirichlet product of two species of subuniverse `S` and `T` from `P` to `Q` -on `X` is defined as +The +{{#concept "Dirichlet product" Disambiguation="of species of types in subuniverses"}} +of two [species](species.species-of-types-in-subuniverses.md) `S` and `T` of +types in [subuniverses](foundation.subuniverses.md) from `P` to `Q` on `X` is +defined as ```text - Σ (k : P) (Σ (k' : P) (Σ (e : k × k' ≃ X) S(k) × T(k'))) + Σ (k : P) (Σ (k' : P) (Σ (e : k × k' ≃ X) S(k) × T(k'))). ``` -If `Q` is stable by product and dependent pair type over `P` type, then the -dirichlet product is also a species of subuniverse from `P` to `Q` +If `Q` is stable under [products](foundation.cartesian-product-types.md) and +[dependent pair types](foundation.dependent-pair-types.md) over `P` type, then +the dirichlet product is also a species of types in subuniverses from `P` to +`Q`. ## Definition @@ -50,8 +55,8 @@ dirichlet product is also a species of subuniverse from `P` to `Q` ```agda module _ - {l1 l2 l3 l4 : Level} (P : subuniverse l1 l2) - (Q : global-subuniverse (λ l → l)) + {α : Level → Level} {l1 l2 l3 l4 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) where type-dirichlet-product-species-subuniverse : @@ -61,9 +66,11 @@ module _ type-dirichlet-product-species-subuniverse S T X = Σ ( binary-product-Decomposition-Subuniverse P X) ( λ d → - inclusion-subuniverse ( subuniverse-global-subuniverse Q l3) + inclusion-subuniverse + ( subuniverse-global-subuniverse Q l3) ( S (left-summand-binary-product-Decomposition-Subuniverse P X d)) × - inclusion-subuniverse ( subuniverse-global-subuniverse Q l4) + inclusion-subuniverse + ( subuniverse-global-subuniverse Q l4) ( T (right-summand-binary-product-Decomposition-Subuniverse P X d))) ``` @@ -71,9 +78,10 @@ module _ ```agda is-closed-under-dirichlet-product-species-subuniverse : - {l1 l2 : Level} (P : subuniverse l1 l2) (Q : global-subuniverse (λ l → l)) → + {α : Level → Level} {l1 l2 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) → UUω -is-closed-under-dirichlet-product-species-subuniverse {l1} {l2} P Q = +is-closed-under-dirichlet-product-species-subuniverse {α} {l1} {l2} P Q = {l3 l4 : Level} (S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) (T : species-subuniverse P (subuniverse-global-subuniverse Q l4)) @@ -87,9 +95,9 @@ is-closed-under-dirichlet-product-species-subuniverse {l1} {l2} P Q = ```agda module _ - {l1 l2 l3 l4 : Level} (P : subuniverse l1 l2) - (Q : global-subuniverse (λ l → l)) - ( C1 : is-closed-under-dirichlet-product-species-subuniverse P Q) + {α : Level → Level} {l1 l2 l3 l4 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) + (C1 : is-closed-under-dirichlet-product-species-subuniverse P Q) where dirichlet-product-species-subuniverse : @@ -108,10 +116,10 @@ module _ ```agda module _ - {l1 l2 l3 l4 l5 : Level} (P : subuniverse l1 l2) - ( Q : global-subuniverse (λ l → l)) - ( C1 : is-closed-under-dirichlet-product-species-subuniverse P Q) - ( C2 : is-closed-under-products-subuniverse P) + {α : Level → Level} {l1 l2 l3 l4 l5 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) + (C1 : is-closed-under-dirichlet-product-species-subuniverse P Q) + (C2 : is-closed-under-products-subuniverse P) where module _ @@ -141,56 +149,53 @@ module _ ( second-summand-ternary-product-Decomposition-Subuniverse P X - d)) × - inclusion-subuniverse - ( subuniverse-global-subuniverse Q l5) - ( U - ( third-summand-ternary-product-Decomposition-Subuniverse - P - X - d)))) - equiv-left-iterated-dirichlet-product-species-subuniverse = - ( ( equiv-Σ - ( λ d → - inclusion-subuniverse - ( subuniverse-global-subuniverse Q l3) - ( S - ( first-summand-ternary-product-Decomposition-Subuniverse - P - X - d)) × + d))) × ( inclusion-subuniverse - ( subuniverse-global-subuniverse Q l4) - ( T - ( second-summand-ternary-product-Decomposition-Subuniverse + ( subuniverse-global-subuniverse Q l5) + ( U + ( third-summand-ternary-product-Decomposition-Subuniverse P X - d)) × - inclusion-subuniverse - ( subuniverse-global-subuniverse Q l5) - ( U - ( third-summand-ternary-product-Decomposition-Subuniverse - P - X - d))))) - ( ( equiv-Σ - ( _) - ( associative-product _ _ _ ∘e commutative-product) - ( λ x → - equiv-postcomp-equiv - ( ( associative-product _ _ _ ∘e - ( commutative-product))) - ( inclusion-subuniverse P X)) ∘e - equiv-ternary-left-iterated-product-Decomposition-Subuniverse + d)))) + equiv-left-iterated-dirichlet-product-species-subuniverse = + ( equiv-Σ + ( λ d → + inclusion-subuniverse + ( subuniverse-global-subuniverse Q l3) + ( S + ( first-summand-ternary-product-Decomposition-Subuniverse + P + X + d)) × + ( inclusion-subuniverse + ( subuniverse-global-subuniverse Q l4) + ( T + ( second-summand-ternary-product-Decomposition-Subuniverse P X - C2)) - ( λ d → associative-product _ _ _) ∘e - ( ( inv-associative-Σ - ( binary-product-Decomposition-Subuniverse P X) - ( λ z → binary-product-Decomposition-Subuniverse P (pr1 z)) - ( _)) ∘e - ( ( equiv-tot λ d → right-distributive-product-Σ)))) + d)) × + inclusion-subuniverse + ( subuniverse-global-subuniverse Q l5) + ( U + ( third-summand-ternary-product-Decomposition-Subuniverse + P + X + d)))) + ( equiv-Σ + ( _) + ( associative-product _ _ _ ∘e commutative-product) + ( λ x → + equiv-postcomp-equiv + ( ( associative-product _ _ _ ∘e + ( commutative-product))) + ( inclusion-subuniverse P X)) ∘e + equiv-ternary-left-iterated-product-Decomposition-Subuniverse + P + X + C2) + ( λ d → associative-product _ _ _)) ∘e + ( inv-associative-Σ _ _ _) ∘e + ( equiv-tot (λ d → right-distributive-product-Σ)) equiv-right-iterated-dirichlet-product-species-subuniverse : type-dirichlet-product-species-subuniverse P Q @@ -221,17 +226,14 @@ module _ X d)))) equiv-right-iterated-dirichlet-product-species-subuniverse = - ( ( equiv-Σ-equiv-base - ( _) - ( equiv-ternary-right-iterated-product-Decomposition-Subuniverse - P - X - C2)) ∘e - ( ( inv-associative-Σ - ( binary-product-Decomposition-Subuniverse P X) - ( λ z → binary-product-Decomposition-Subuniverse P (pr1 (pr2 z))) - ( _)) ∘e - ( ( equiv-tot (λ d → left-distributive-product-Σ))))) + ( equiv-Σ-equiv-base + ( _) + ( equiv-ternary-right-iterated-product-Decomposition-Subuniverse + P + X + C2)) ∘e + ( inv-associative-Σ _ _ _) ∘e + ( ( equiv-tot (λ d → left-distributive-product-Σ))) equiv-associative-dirichlet-product-species-subuniverse : type-dirichlet-product-species-subuniverse P Q @@ -275,9 +277,8 @@ module _ ```agda module _ - {l1 l2 l3 l4 : Level} - (P : subuniverse l1 l2) - (Q : global-subuniverse (λ l → l)) + {α : Level → Level} {l1 l2 l3 l4 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) (C1 : is-closed-under-dirichlet-product-species-subuniverse P Q) (S : species-subuniverse P ( subuniverse-global-subuniverse Q l3)) (T : species-subuniverse P ( subuniverse-global-subuniverse Q l4)) @@ -318,10 +319,11 @@ unit-dirichlet-product-species-subuniverse : is-in-subuniverse Q ( is-contr (inclusion-subuniverse P X))) → species-subuniverse P Q unit-dirichlet-product-species-subuniverse P Q C X = - is-contr (inclusion-subuniverse P X) , C X + ( is-contr (inclusion-subuniverse P X) , C X) module _ - {l1 l2 l3 : Level} (P : subuniverse l1 l2) (Q : global-subuniverse (λ l → l)) + {α : Level → Level} {l1 l2 l3 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) (C1 : is-closed-under-dirichlet-product-species-subuniverse P Q) (C2 : is-in-subuniverse P (raise-unit l1)) (C3 : @@ -343,40 +345,20 @@ module _ ( X) ≃ inclusion-subuniverse (subuniverse-global-subuniverse Q l3) (S X) equiv-right-unit-law-dirichlet-product-species-subuniverse X = - ( ( left-unit-law-Σ-is-contr - ( is-torsorial-equiv-subuniverse P X) - ( X , id-equiv)) ∘e - ( ( equiv-Σ-equiv-base - ( λ p → - inclusion-subuniverse - ( subuniverse-global-subuniverse Q l3) - ( S (pr1 (p)))) - (equiv-is-contr-right-summand-binary-product-Decomposition-Subuniverse - P - X - C2)) ∘e - ( ( inv-associative-Σ - ( binary-product-Decomposition-Subuniverse P X) - ( λ d → - inclusion-subuniverse - ( subuniverse-global-subuniverse Q l1) - ( unit-dirichlet-product-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l1) - ( C3) - ( right-summand-binary-product-Decomposition-Subuniverse - P - X - d))) - ( λ z → - inclusion-subuniverse - ( subuniverse-global-subuniverse Q l3) - ( S - ( left-summand-binary-product-Decomposition-Subuniverse - P - X - (pr1 z))))) ∘e - ( ( equiv-tot (λ _ → commutative-product)))))) + ( left-unit-law-Σ-is-contr + ( is-torsorial-equiv-subuniverse P X) + ( X , id-equiv)) ∘e + ( equiv-Σ-equiv-base + ( λ p → + inclusion-subuniverse + ( subuniverse-global-subuniverse Q l3) + ( S (pr1 (p)))) + (equiv-is-contr-right-summand-binary-product-Decomposition-Subuniverse + P + X + C2)) ∘e + ( inv-associative-Σ _ _ _) ∘e + ( equiv-tot (λ _ → commutative-product)) equiv-left-unit-law-dirichlet-product-species-subuniverse : (X : type-subuniverse P) → @@ -389,8 +371,8 @@ module _ ( X) ≃ inclusion-subuniverse (subuniverse-global-subuniverse Q l3) (S X) equiv-left-unit-law-dirichlet-product-species-subuniverse X = - equiv-right-unit-law-dirichlet-product-species-subuniverse X ∘e - equiv-commutative-dirichlet-product-species-subuniverse + ( equiv-right-unit-law-dirichlet-product-species-subuniverse X) ∘e + ( equiv-commutative-dirichlet-product-species-subuniverse ( P) ( Q) ( C1) @@ -399,23 +381,61 @@ module _ ( subuniverse-global-subuniverse Q l1) ( C3)) ( S) - ( X) + ( X)) ``` ### Equivalent form with species of types ```agda module _ - {l1 l2 l3 l4 : Level} (P : subuniverse l1 l2) - ( Q : global-subuniverse (λ l → l)) - ( C1 : is-closed-under-dirichlet-product-species-subuniverse P Q) - ( C2 : is-closed-under-products-subuniverse P) + {α : Level → Level} {l1 l2 l3 l4 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) + (C1 : is-closed-under-dirichlet-product-species-subuniverse P Q) + (C2 : is-closed-under-products-subuniverse P) (S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) (T : species-subuniverse P (subuniverse-global-subuniverse Q l4)) (X : UU l1) where - private + equiv-dirichlet-product-Σ-extension-species-subuniverse : + Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3 ⊔ l4)) + ( dirichlet-product-species-subuniverse P Q C1 S T) + ( X) ≃ + dirichlet-product-species-types + ( Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q l3) + ( S)) + ( Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q l4) + ( T)) + ( X) + equiv-dirichlet-product-Σ-extension-species-subuniverse = + ( reassociate') ∘e + ( equiv-tot + ( λ d → + equiv-Σ-equiv-base + ( λ p → + ( inclusion-subuniverse + ( subuniverse-global-subuniverse Q l3) + ( S (left-summand-binary-product-Decomposition d , pr1 p))) × + ( inclusion-subuniverse + ( subuniverse-global-subuniverse Q l4) + ( T (right-summand-binary-product-Decomposition d , pr2 p)))) + ( equiv-remove-redundant-prop + ( is-prop-type-Prop (P X)) + ( λ p → + tr + ( is-in-subuniverse P) + ( inv + ( eq-equiv + ( matching-correspondence-binary-product-Decomposition d))) + ( C2 (pr1 p) (pr2 p)))))) ∘e + ( reassociate) + where reassociate : Σ-extension-species-subuniverse ( P) @@ -460,51 +480,4 @@ module _ ( λ ( d , (pA , s) , (pB , t)) → (d , (pA , pB) , s , t)) ( refl-htpy) ( refl-htpy) - - equiv-dirichlet-product-Σ-extension-species-subuniverse : - Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3 ⊔ l4)) - ( dirichlet-product-species-subuniverse P Q C1 S T) - ( X) ≃ - dirichlet-product-species-types - ( Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l3) - ( S)) - ( Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l4) - ( T)) - ( X) - equiv-dirichlet-product-Σ-extension-species-subuniverse = - ( ( reassociate') ∘e - ( ( equiv-tot - ( λ d → - equiv-Σ-equiv-base - (λ p → - ( inclusion-subuniverse - ( subuniverse-global-subuniverse Q l3) - ( S - ( left-summand-binary-product-Decomposition d , - pr1 p))) × - ( inclusion-subuniverse - ( subuniverse-global-subuniverse Q l4) - ( T - ( right-summand-binary-product-Decomposition d , - pr2 p)))) - ( inv-equiv - ( equiv-add-redundant-prop - ( is-prop-type-Prop (P X)) - ( λ p → - tr - ( is-in-subuniverse P) - ( inv - ( eq-equiv - ( matching-correspondence-binary-product-Decomposition - ( d)))) - ( C2 - ( pr1 p) - ( pr2 p))))))) ∘e - ( reassociate))) ``` diff --git a/src/species/dirichlet-products-species-of-types.lagda.md b/src/species/dirichlet-products-species-of-types.lagda.md index ba7ab3e640..e0f199ec66 100644 --- a/src/species/dirichlet-products-species-of-types.lagda.md +++ b/src/species/dirichlet-products-species-of-types.lagda.md @@ -19,10 +19,13 @@ open import species.species-of-types ## Idea -The Dirichlet product of two species of types `S` and `T` on `X` is defined as +The +{{#concept "Dirichlet product" Disambiguation="of species of types" Agda=dirichlet-product-species-types}} +of two [species of types](species.species-of-types.md) `S` and `T` on `X` is +defined as ```text - Σ (k : UU) (Σ (k' : UU) (Σ (e : k × k' ≃ X) S(k) × T(k'))) + Σ (k : UU) (Σ (k' : UU) (Σ (e : k × k' ≃ X) S(k) × T(k'))). ``` ## Definition diff --git a/src/species/dirichlet-series-species-of-finite-inhabited-types.lagda.md b/src/species/dirichlet-series-species-of-finite-inhabited-types.lagda.md index d5d0a07c20..4eb3af149a 100644 --- a/src/species/dirichlet-series-species-of-finite-inhabited-types.lagda.md +++ b/src/species/dirichlet-series-species-of-finite-inhabited-types.lagda.md @@ -24,36 +24,39 @@ open import univalent-combinatorics.inhabited-finite-types ## Idea -In classical mathematics, the Dirichlet series of a species of finite inhabited -types `T` is the formal series in `s` : +In classical mathematics, the _Dirichlet series_ of a +[species of finite inhabited types](species.species-of-finite-inhabited-types.md) +`T` is the formal series in `s`: ```text -Σ (n : ℕ∖{0}) (|T({1,...,n}| n^(-s) / n!)) + Σ (n : ℕ∖{0}) (|T({1,...,n})| n^(-s) / n!). ``` -If `s` is a negative integer, the categorified version of this formula is +If `s` is a [negative integer](elementary-number-theory.negative-integers.md), +the categorified version of this formula is ```text -Σ (F : Finite-Type ∖ {∅}), T (F) × (S → F) + Σ (F : Finite-Type∖{∅}), T(F) × (S → F). ``` -We can generalize it to species of types as +We can generalize it to [species of types](species.species-of-types.md) as ```text -Σ (U : UU) (T (U) × (S → U)) + Σ (X : UU) (T(X) × (S → X)). ``` The interesting case is when `s` is a positive number. The categorified version of this formula then becomes ```text -Σ ( n : ℕ ∖ {0}), - ( Σ (F : Type-With-Cardinality-ℕ n) , T (F) × (S → cycle-prime-decomposition-ℕ (n)) + Σ ( n : ℕ∖{0}), + ( Σ ( F : Type-With-Cardinality-ℕ n) , + ( T(F) × (S → cycle-prime-decomposition-ℕ n)). ``` -We have picked the concrete group `cycle-prime-decomposition-ℕ (n)` because it -is closed under cartesian product and also because its groupoid cardinality is -equal to `1/n`. +We have picked the [concrete group](group-theory.concrete-groups.md) +`cycle-prime-decomposition-ℕ n` because it is closed under cartesian product and +also because its groupoid cardinality is `1/n`. ## Definition @@ -66,11 +69,11 @@ dirichlet-series-species-Inhabited-Finite-Type {l1} T S = ( λ n → Σ ( Type-With-Cardinality-ℕ l1 (succ-ℕ n)) ( λ F → - type-Finite-Type + ( type-Finite-Type ( T ( type-Type-With-Cardinality-ℕ (succ-ℕ n) F , is-finite-and-inhabited-type-Type-With-Cardinality-ℕ-succ-ℕ n - F)) × - S → cycle-prime-decomposition-ℕ (succ-ℕ n) _)) + F))) × + ( S → cycle-prime-decomposition-ℕ (succ-ℕ n) _))) ``` diff --git a/src/species/dirichlet-series-species-of-types-in-subuniverses.lagda.md b/src/species/dirichlet-series-species-of-types-in-subuniverses.lagda.md index 22ff7d6265..0cb00bf32c 100644 --- a/src/species/dirichlet-series-species-of-types-in-subuniverses.lagda.md +++ b/src/species/dirichlet-series-species-of-types-in-subuniverses.lagda.md @@ -19,41 +19,48 @@ open import species.species-of-types-in-subuniverses ## Idea -In classical mathematics, the Dirichlet series of a species of finite inhabited -types `T` is the formal series in `s` : +In classical mathematics, the _Dirichlet series_ of a +[species of finite inhabited types](species.species-of-finite-inhabited-types.md) +`T` is the formal series in `s` : ```text -Σ (n : ℕ∖{0}) (|T({1,...,n}| n^(-s) / n!)) + Σ (n : ℕ∖{0}), (|T({1,...,n})| n^(-s) / n!) ``` -If `s` is a negative integer, the categorified version of this formula is +If `s` is a [negative integer](elementary-number-theory.negative-integers.md), +the categorified version of this formula is ```text -Σ (F : Finite-Type ∖ {∅}), T (F) × (S → F) + Σ (F : Finite-Type∖{∅}), T(F) × (S → F). ``` -We can generalize it to species of types as +We can generalize it to [species of types](species.species-of-types.md) as ```text -Σ (U : UU) (T (U) × (S → U)) + Σ (X : UU), (T(X) × (S → X)). ``` The interesting case is when `s` is a positive number. The categorified version of this formula then becomes ```text -Σ ( n : ℕ ∖ {0}), - ( Σ (F : Type-With-Cardinality-ℕ n) , T (F) × (S → cycle-prime-decomposition-ℕ (n)) + Σ ( n : ℕ∖{0}), + ( Σ ( F : Type-With-Cardinality-ℕ n), + ( T(F) × (S → cycle-prime-decomposition-ℕ n)). ``` -We can generalize the two notions to species of types in subuniverses. Let `P` -and `Q` two subuniverse such that `P` is closed by cartesian product. Let -`H : P → UU` be a species such that for every `X , Y : P` the following equality -is satisfied `H (X × Y) ≃ H X × H Y`. Then we can define the `H`-Dirichlet -series to any species of subuniverse `T` by +We can generalize the two notions to +[species of types in subuniverses](species.species-of-types-in-subuniverses.md). +Let `P` and `Q` two subuniverse such that `P` is closed under +[cartesian products](foundation.cartesian-product-types.md). Let `H : P → UU` be +a species such that for every `X , Y : P` the following +[equivalence](foundation-core.equivalences.md) is satisfied +`H (X × Y) ≃ H X × H Y`. Then we can define the +{{#concept "`H`-Dirichlet series" Disambiguation="of species of types in subuniverses" Agda=dirichlet-series-species-subuniverse}} +to any species of types in subuniverses `T` by ```text -Σ (X : P) (T (X) × (S → H (X))) + Σ (X : P), (T(X) × (S → H(X))). ``` The condition on `H` ensure that all the usual properties of the Dirichlet diff --git a/src/species/dirichlet-series-species-of-types.lagda.md b/src/species/dirichlet-series-species-of-types.lagda.md index a3e2595e36..4db6a19fe8 100644 --- a/src/species/dirichlet-series-species-of-types.lagda.md +++ b/src/species/dirichlet-series-species-of-types.lagda.md @@ -18,41 +18,46 @@ open import species.species-of-types ## Idea -In classical mathematics, the Dirichlet series of a species of finite inhabited -types `T` is the formal series in `s` : +In classical mathematics, the _Dirichlet series_ of a +[species of finite inhabited types](species.species-of-finite-inhabited-types.md) +`T` is the formal series in `s`: ```text -Σ (n : ℕ∖{0}) (|T({1,...,n}| n^(-s) / n!)) + Σ (n : ℕ∖{0}), (|T({1,...,n})| n^(-s) / n!). ``` -If `s` is a negative integer, the categorified version of this formula is +If `s` is a [negative integer](elementary-number-theory.negative-integers.md), +the categorified version of this formula is ```text -Σ (F : Finite-Type ∖ {∅}), T (F) × (S → F) + Σ (F : Finite-Type∖{∅}), T(F) × (S → F). ``` -We can generalize it to species of types as +We can generalize it to [species of types](species.species-of-types.md) as ```text -Σ (U : UU) (T (U) × (S → U)) + Σ (X : UU), (T(X) × (S → X)). ``` The interesting case is when `s` is a positive number. The categorified version of this formula then becomes ```text -Σ ( n : ℕ ∖ {0}), - ( Σ (F : Type-With-Cardinality-ℕ n) , T (F) × (S → cycle-prime-decomposition-ℕ (n)) + Σ ( n : ℕ∖{0}), + ( Σ ( F : Type-With-Cardinality-ℕ n), + ( T(F) × (S → cycle-prime-decomposition-ℕ n)). ``` -We can generalize the two notions to species of types in subuniverses. Let `P` -and `Q` two subuniverse such that `P` is closed by cartesian product. Let -`H : P → UU` be a species such that for every `X , Y : P` the following equality -is satisfied `H (X × Y) ≃ H X × H Y`. Then we can define the `H`-Dirichlet -series to any species of subuniverse `T` by +We can generalize the two notions to +[species of types](species.species-of-types.md). Let `H : UU → UU` be a species +such that for every `X , Y : P` the following +[equivalence](foundation-core.equivalences.md) is satisfied +`H (X × Y) ≃ H X × H Y`. Then we can define the +{{#concept "`H`-Dirichlet series" Disambiguation="of species of types" Agda=dirichlet-series-species-types}} +of any species of types `T` by ```text -Σ (X : P) (T (X) × (S → H (X))) + Σ (X : P), (T(X) × (S → H(X))). ``` The condition on `H` ensure that all the usual properties of the Dirichlet diff --git a/src/species/equivalences-species-of-types-in-subuniverses.lagda.md b/src/species/equivalences-species-of-types-in-subuniverses.lagda.md index e2a0f54a3f..3267f38b23 100644 --- a/src/species/equivalences-species-of-types-in-subuniverses.lagda.md +++ b/src/species/equivalences-species-of-types-in-subuniverses.lagda.md @@ -19,15 +19,19 @@ open import species.species-of-types-in-subuniverses ## Idea -An equivalence of species of types from `F` to `G` is a pointwise equivalence. +An +{{#concept "equivalence" Disambiguation="of species of types in subuniverses" Agda=equiv-species-subuniverse}} +of +[species of types in subuniverses](species.species-of-types-in-subuniverses.md) +from `F` to `G` is a pointwise [equivalence](foundation-core.equivalences.md). ## Definition ```agda equiv-species-subuniverse : - {l1 l2 l3 : Level} (P : subuniverse l1 l2) (Q : subuniverse l1 l3) → + {l1 l2 l3 l4 : Level} (P : subuniverse l1 l2) (Q : subuniverse l3 l4) → species-subuniverse P Q → species-subuniverse P Q → - UU (lsuc l1 ⊔ l2) + UU (lsuc l1 ⊔ l2 ⊔ l3) equiv-species-subuniverse {l1} P Q S T = (X : type-subuniverse P) → inclusion-subuniverse Q (S X) ≃ inclusion-subuniverse Q (T X) @@ -39,9 +43,9 @@ equiv-species-subuniverse {l1} P Q S T = ```agda extensionality-species-subuniverse : - {l1 l2 l3 : Level} (P : subuniverse l1 l2) (Q : subuniverse l1 l3) → + {l1 l2 l3 l4 : Level} (P : subuniverse l1 l2) (Q : subuniverse l3 l4) → (S : species-subuniverse P Q) → (T : species-subuniverse P Q) → - (Id S T) ≃ (equiv-species-subuniverse P Q S T) + (S = T) ≃ (equiv-species-subuniverse P Q S T) extensionality-species-subuniverse P Q S T = extensionality-fam-subuniverse Q S T ``` diff --git a/src/species/equivalences-species-of-types.lagda.md b/src/species/equivalences-species-of-types.lagda.md index a0e35581a6..27cd9a3f3e 100644 --- a/src/species/equivalences-species-of-types.lagda.md +++ b/src/species/equivalences-species-of-types.lagda.md @@ -19,7 +19,10 @@ open import species.species-of-types ## Idea -An equivalence of species of types from `F` to `G` is a pointwise equivalence. +An +{{#concept "equivalence" Disambiguation="of species of types" Agda=equiv-species-types}} +of [species of types](species.species-of-types.md) from `F` to `G` is a +pointwise [equivalence](foundation-core.equivalences.md). ## Definition @@ -27,7 +30,7 @@ An equivalence of species of types from `F` to `G` is a pointwise equivalence. equiv-species-types : {l1 l2 l3 : Level} → species-types l1 l2 → species-types l1 l3 → UU (lsuc l1 ⊔ l2 ⊔ l3) -equiv-species-types {l1} F G = (X : UU l1) → F X ≃ G X +equiv-species-types {l1} F G = ((X : UU l1) → F X ≃ G X) ``` ## Properties @@ -36,7 +39,7 @@ equiv-species-types {l1} F G = (X : UU l1) → F X ≃ G X ```agda extensionality-species-types : - {l1 l2 : Level} (F : species-types l1 l2) (G : species-types l1 l2) → - (Id F G) ≃ (equiv-species-types F G) + {l1 l2 : Level} (F G : species-types l1 l2) → + (F = G) ≃ (equiv-species-types F G) extensionality-species-types = extensionality-fam ``` diff --git a/src/species/exponentials-cauchy-series-of-types-in-subuniverses.lagda.md b/src/species/exponentials-cauchy-series-of-types-in-subuniverses.lagda.md index 4f1628ab45..103810bda4 100644 --- a/src/species/exponentials-cauchy-series-of-types-in-subuniverses.lagda.md +++ b/src/species/exponentials-cauchy-series-of-types-in-subuniverses.lagda.md @@ -15,6 +15,7 @@ open import foundation.global-subuniverses open import foundation.sigma-closed-subuniverses open import foundation.subuniverses open import foundation.type-arithmetic-cartesian-product-types +open import foundation.type-arithmetic-unit-type open import foundation.unit-type open import foundation.universe-levels @@ -56,12 +57,11 @@ module _ ```agda module _ - {l1 l2 l3 l5 : Level} - (P : subuniverse l1 l2) - (Q : global-subuniverse (λ l → l)) + {α : Level → Level} {l1 l2 l3 l4 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) (C : is-in-subuniverse (subuniverse-global-subuniverse Q lzero) unit) (S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) - (X : UU l5) + (X : UU l4) where equiv-exponential-cauchy-series-composition-unit-species-subuniverse : @@ -72,16 +72,15 @@ module _ ( S) ( X) equiv-exponential-cauchy-series-composition-unit-species-subuniverse = - equiv-tot (λ F → left-unit-law-product-is-contr is-contr-unit) + equiv-tot (λ F → left-unit-law-product) ``` ### The Cauchy series associated to the Cauchy exponential of `S` is equal to the exponential of its Cauchy series ```agda module _ - {l1 l2 l3 l4 : Level} - (P : subuniverse l1 l2) - (Q : global-subuniverse (λ l → l)) + {α : Level → Level} {l1 l2 l3 l4 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) (C1 : is-closed-under-cauchy-exponential-species-subuniverse P Q) (C2 : is-in-subuniverse (subuniverse-global-subuniverse Q lzero) unit) (C3 : is-closed-under-cauchy-composition-species-subuniverse P Q) @@ -106,25 +105,25 @@ module _ ( C2) ( S) ( X)) ∘e - ( ( equiv-cauchy-series-composition-species-subuniverse P Q C3 C4 + ( equiv-cauchy-series-composition-species-subuniverse P Q C3 C4 + ( λ _ → unit , C2) + ( S) + ( X)) ∘e + ( equiv-cauchy-series-equiv-species-subuniverse P Q + ( cauchy-exponential-species-subuniverse P Q C1 S) + ( cauchy-composition-species-subuniverse P Q C3 C4 ( λ _ → unit , C2) - ( S) - ( X)) ∘e - ( equiv-cauchy-series-equiv-species-subuniverse P Q - ( cauchy-exponential-species-subuniverse P Q C1 S) - ( cauchy-composition-species-subuniverse P Q C3 C4 - ( λ _ → unit , C2) - ( S)) - ( λ F → - inv-equiv - ( equiv-cauchy-exponential-composition-unit-species-subuniverse - ( P) - ( Q) - ( C1) - ( C2) - ( C3) - ( C4) - ( S) - ( F))) - ( X))) + ( S)) + ( λ F → + inv-equiv + ( equiv-cauchy-exponential-composition-unit-species-subuniverse + ( P) + ( Q) + ( C1) + ( C2) + ( C3) + ( C4) + ( S) + ( F))) + ( X)) ``` diff --git a/src/species/exponentials-cauchy-series-of-types.lagda.md b/src/species/exponentials-cauchy-series-of-types.lagda.md index 39cbfbf9be..4bd66f12e8 100644 --- a/src/species/exponentials-cauchy-series-of-types.lagda.md +++ b/src/species/exponentials-cauchy-series-of-types.lagda.md @@ -12,6 +12,7 @@ open import foundation.dependent-pair-types open import foundation.equivalences open import foundation.functoriality-dependent-pair-types open import foundation.type-arithmetic-cartesian-product-types +open import foundation.type-arithmetic-unit-type open import foundation.unit-type open import foundation.universe-levels @@ -37,7 +38,7 @@ module _ UU (lsuc l1 ⊔ l2 ⊔ l3) exponential-cauchy-series-species-types = Σ ( UU l1) - ( λ F → F → (Σ ( UU l1) (λ U → S U × (U → X)))) + ( λ F → (F → Σ (UU l1) (λ U → S U × (U → X)))) ``` ## Properties @@ -49,7 +50,7 @@ module _ composition-cauchy-series-species-types (λ _ → unit) S X ≃ exponential-cauchy-series-species-types equiv-exponential-cauchy-series-composition-unit-species-types = - equiv-tot λ F → left-unit-law-product-is-contr is-contr-unit + equiv-tot (λ F → left-unit-law-product) ``` ### The Cauchy series associated to the Cauchy exponential of `S` is equal to the exponential of its Cauchy series @@ -60,12 +61,11 @@ module _ exponential-cauchy-series-species-types equiv-cauchy-series-cauchy-exponential-species-types = ( equiv-exponential-cauchy-series-composition-unit-species-types) ∘e - ( ( equiv-cauchy-series-composition-species-types (λ _ → unit) S X) ∘e - ( equiv-cauchy-series-equiv-species-types - ( cauchy-exponential-species-types S) - ( cauchy-composition-species-types (λ _ → unit) S) - ( λ F → - inv-equiv - ( equiv-cauchy-exponential-composition-unit-species-types S F)) - ( X))) + ( equiv-cauchy-series-composition-species-types (λ _ → unit) S X) ∘e + ( equiv-cauchy-series-equiv-species-types + ( cauchy-exponential-species-types S) + ( cauchy-composition-species-types (λ _ → unit) S) + ( λ F → + inv-equiv (equiv-cauchy-exponential-composition-unit-species-types S F)) + ( X)) ``` diff --git a/src/species/hasse-weil-species.lagda.md b/src/species/hasse-weil-species.lagda.md index 849e510d62..959832c732 100644 --- a/src/species/hasse-weil-species.lagda.md +++ b/src/species/hasse-weil-species.lagda.md @@ -21,13 +21,18 @@ open import univalent-combinatorics.finite-types ## Idea -Let `S` be a function from the type of commutative finite rings to the finite -types that preserves cartesian products. The **Hasse-Weil species** is a species -of finite inhabited types defined for any finite inhabited type `k` as +Let `S` be a function from the type of +[commutative finite rings](finite-algebra.commutative-finite-rings.md) to the +[finite types](univalent-combinatorics.finite-types.md) that preserves cartesian +products. The {{#concept "Hasse-Weil species"}} is a +[species of finite inhabited types](species.species-of-finite-inhabited-types.md) +defined for any +[finite inhabited type](univalent-combinatorics.inhabited-finite-types.md) `k` +as ```text Σ ( p : structure-semisimple-commutative-ring-Finite-Type k), - ( S (commutative-finite-ring-finite-semisimple-commutative-ring-structure-semisimple-commutative-ring-Finite-Type k p)) + ( S (commutative-finite-ring-finite-semisimple-commutative-ring-structure-semisimple-commutative-ring-Finite-Type k p)). ``` ## Definitions @@ -54,13 +59,14 @@ module _ hasse-weil-species-Inhabited-Finite-Type : species-Inhabited-Finite-Type l1 (l1 ⊔ l2 ⊔ lsuc l3 ⊔ lsuc l4) hasse-weil-species-Inhabited-Finite-Type ( k , (f , i)) = - Σ-Finite-Type {!!} - ( λ p → - S - ( commutative-finite-ring-Semisimple-Finite-Commutative-Ring - ( finite-semisimple-commutative-ring-structure-semisimple-commutative-ring-Finite-Type - ( l3) - ( l4) - ( k , f) - ( p)))) + Σ-Finite-Type + {!!} + ( λ p → + S + ( commutative-finite-ring-Semisimple-Finite-Commutative-Ring + ( finite-semisimple-commutative-ring-structure-semisimple-commutative-ring-Finite-Type + ( l3) + ( l4) + ( k , f) + ( p)))) ``` diff --git a/src/species/morphisms-finite-species.lagda.md b/src/species/morphisms-finite-species.lagda.md index 52f2991b25..fbf3a5e9aa 100644 --- a/src/species/morphisms-finite-species.lagda.md +++ b/src/species/morphisms-finite-species.lagda.md @@ -29,7 +29,10 @@ open import univalent-combinatorics.finite-types ## Idea -A homomorphism between two finite species is a pointwise family of maps. +A +{{#concept "homomorphism" Disambiguation="between finite species" Agda=hom-finite-species}} +between two [finite species](species.species-of-finite-types.md) is a pointwise +family of maps. ## Definitions @@ -48,7 +51,7 @@ hom-finite-species {l1} F G = ```agda id-hom-finite-species : {l1 l2 : Level} (F : finite-species l1 l2) → hom-finite-species F F -id-hom-finite-species F = λ X x → x +id-hom-finite-species F X = id ``` ### Composition of morphisms of finite species @@ -58,7 +61,7 @@ comp-hom-finite-species : {l1 l2 l3 l4 : Level} (F : finite-species l1 l2) (G : finite-species l1 l3) (H : finite-species l1 l4) → hom-finite-species G H → hom-finite-species F G → hom-finite-species F H -comp-hom-finite-species F G H f g X = (f X) ∘ (g X) +comp-hom-finite-species F G H f g X = f X ∘ g X ``` ### Homotopies of morphisms of finite species @@ -68,7 +71,7 @@ htpy-hom-finite-species : {l1 l2 l3 : Level} (F : finite-species l1 l2) (G : finite-species l1 l3) → (hom-finite-species F G) → (hom-finite-species F G) → UU (lsuc l1 ⊔ l2 ⊔ l3) -htpy-hom-finite-species {l1} F G f g = (X : Finite-Type l1) → (f X) ~ (g X) +htpy-hom-finite-species {l1} F G f g = (X : Finite-Type l1) → f X ~ g X refl-htpy-hom-finite-species : {l1 l2 l3 : Level} (F : finite-species l1 l2) (G : finite-species l1 l3) → diff --git a/src/species/morphisms-species-of-types.lagda.md b/src/species/morphisms-species-of-types.lagda.md index 713b51777c..bd5a2617ff 100644 --- a/src/species/morphisms-species-of-types.lagda.md +++ b/src/species/morphisms-species-of-types.lagda.md @@ -24,8 +24,10 @@ open import species.species-of-types ### Idea -A homomorphism between two species is a pointwise family of maps between their -values. +A +{{#concept "homomorphism" Disambiguation="between species of types" Agda=hom-species-types}} +between two [species of types](species.species-of-types.md) is a pointwise +family of maps. ## Definitions @@ -39,7 +41,7 @@ hom-species-types {l1} F G = (X : UU l1) → F X → G X id-hom-species-types : {l1 l2 : Level} → (F : species-types l1 l2) → hom-species-types F F -id-hom-species-types F = λ X x → x +id-hom-species-types F X = id comp-hom-species-types : {l1 l2 l3 l4 : Level} @@ -47,7 +49,7 @@ comp-hom-species-types : {G : species-types l1 l3} {H : species-types l1 l4} → hom-species-types G H → hom-species-types F G → hom-species-types F H -comp-hom-species-types f g X = (f X) ∘ (g X) +comp-hom-species-types f g X = f X ∘ g X ``` ### Homotopies between morphisms of species @@ -56,7 +58,7 @@ comp-hom-species-types f g X = (f X) ∘ (g X) htpy-hom-species-types : {l1 l2 l3 : Level} {F : species-types l1 l2} {G : species-types l1 l3} → hom-species-types F G → hom-species-types F G → UU (lsuc l1 ⊔ l2 ⊔ l3) -htpy-hom-species-types {l1} f g = (X : UU l1) → (f X) ~ (g X) +htpy-hom-species-types {l1} f g = (X : UU l1) → f X ~ g X refl-htpy-hom-species-types : {l1 l2 l3 : Level} {F : species-types l1 l2} {G : species-types l1 l3} diff --git a/src/species/pointing-species-of-types.lagda.md b/src/species/pointing-species-of-types.lagda.md index 6761bb997f..36e2976133 100644 --- a/src/species/pointing-species-of-types.lagda.md +++ b/src/species/pointing-species-of-types.lagda.md @@ -17,8 +17,11 @@ open import species.species-of-types ## Idea -A pointing of a species of types `F` is the species of types `F*` given by -`F* X := X × (F X)`. In other words, it is the species of pointed `F`-structures +A +{{#concept "pointing" Disambiguation="of species of types" Agda=pointing-species-types}} +of a [species of types](species.species-of-types.md) `F` is the species of types +`F∗` given by `F∗ X := X × F X`. In other words, it is the species of points and +`F`-[structures](foundation.structure.md). ## Definition diff --git a/src/species/precategory-of-finite-species.lagda.md b/src/species/precategory-of-finite-species.lagda.md index d2de76dfc8..ef2c6eab0e 100644 --- a/src/species/precategory-of-finite-species.lagda.md +++ b/src/species/precategory-of-finite-species.lagda.md @@ -8,6 +8,7 @@ module species.precategory-of-finite-species where ```agda open import category-theory.large-precategories +open import category-theory.precategories open import foundation.universe-levels @@ -24,7 +25,9 @@ The consists of [finite species](species.species-of-finite-types.md) and [homomorphisms of finite species](species.morphisms-finite-species.md). -## Definition +## Definitions + +### The large precategories of finite species ```agda finite-species-Large-Precategory : @@ -41,3 +44,12 @@ finite-species-Large-Precategory l = ( λ {l1} {l2} {F} {G} → left-unit-law-comp-hom-finite-species F G) ( λ {l1} {l2} {F} {G} → right-unit-law-comp-hom-finite-species F G) ``` + +### The small precategories of finite species + +```agda +finite-species-Precategory : + (l1 l2 : Level) → Precategory (lsuc l1 ⊔ lsuc l2) (lsuc l1 ⊔ l2) +finite-species-Precategory l1 = + precategory-Large-Precategory (finite-species-Large-Precategory l1) +``` diff --git a/src/species/products-cauchy-series-species-of-types-in-subuniverses.lagda.md b/src/species/products-cauchy-series-species-of-types-in-subuniverses.lagda.md index 946d2dd088..7937aaf0d6 100644 --- a/src/species/products-cauchy-series-species-of-types-in-subuniverses.lagda.md +++ b/src/species/products-cauchy-series-species-of-types-in-subuniverses.lagda.md @@ -27,15 +27,19 @@ open import species.species-of-types-in-subuniverses ## Idea -The product of two Cauchy series is just the pointwise product. +The +{{#concept "product" Disambiguation="of Caucy series of species of types in subuniverses" Agda=product-cauchy-series-species-subuniverse}} +of two +[Cauchy series](species.cauchy-series-species-of-types-in-subuniverses.md) of +[species of types in subuniverses](species.species-of-types-in-subuniverses.md) +is just the pointwise [product](foundation.cartesian-product-types.md). ## Definition ```agda module _ - {l1 l2 l3 l4 l5 : Level} - (P : subuniverse l1 l2) - (Q : global-subuniverse (λ l → l)) + {α : Level → Level} {l1 l2 l3 l4 l5 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) (S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) (T : species-subuniverse P (subuniverse-global-subuniverse Q l4)) (X : UU l5) @@ -56,9 +60,8 @@ module _ ```agda module _ - {l1 l2 l3 l4 l5 : Level} - (P : subuniverse l1 l2) - (Q : global-subuniverse (λ l → l)) + {α : Level → Level} {l1 l2 l3 l4 l5 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) (S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) (T : species-subuniverse P (subuniverse-global-subuniverse Q l4)) (X : UU l5) @@ -78,28 +81,26 @@ module _ ≃ product-cauchy-series-species-subuniverse P Q S T X equiv-product-cauchy-series-Σ-extension-species-subuniverse = - equiv-product - ( inv-equiv - ( equiv-cauchy-series-Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l3) - ( S) - ( X))) - ( inv-equiv - ( equiv-cauchy-series-Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l4) - ( T) - ( X))) + inv-equiv + ( equiv-product + ( equiv-cauchy-series-Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q l3) + ( S) + ( X)) + ( equiv-cauchy-series-Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q l4) + ( T) + ( X))) ``` ### The Cauchy series associated to the Cauchy product of `S` and `T` is equal to the product of theirs Cauchy series ```agda module _ - {l1 l2 l3 l4 l5 : Level} - (P : subuniverse l1 l2) - (Q : global-subuniverse (λ l → l)) + {α : Level → Level} {l1 l2 l3 l4 l5 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) (C1 : is-closed-under-cauchy-product-species-subuniverse P Q) (C2 : is-closed-under-coproducts-subuniverse P) (S : species-subuniverse P (subuniverse-global-subuniverse Q l3)) @@ -115,40 +116,39 @@ module _ ( X) ≃ product-cauchy-series-species-subuniverse P Q S T X equiv-cauchy-series-cauchy-product-species-subuniverse = - ( equiv-product-cauchy-series-Σ-extension-species-subuniverse P Q S T X ∘e - ( ( equiv-cauchy-series-cauchy-product-species-types - ( Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l3) - ( S)) - ( Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l4) - ( T)) - ( X)) ∘e - ( ( equiv-cauchy-series-equiv-species-types - ( λ z → - Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3 ⊔ l4)) - ( cauchy-product-species-subuniverse P Q C1 S T) z) - ( λ z → - cauchy-product-species-types - ( Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l3) - ( S)) - ( Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q l4) - ( T)) - z) - ( equiv-cauchy-product-Σ-extension-species-subuniverse - P Q C1 C2 S T) - ( X)) ∘e - ( ( equiv-cauchy-series-Σ-extension-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3 ⊔ l4)) - ( cauchy-product-species-subuniverse P Q C1 S T) - ( X)))))) + ( equiv-product-cauchy-series-Σ-extension-species-subuniverse P Q S T X) ∘e + ( equiv-cauchy-series-cauchy-product-species-types + ( Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q l3) + ( S)) + ( Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q l4) + ( T)) + ( X)) ∘e + ( equiv-cauchy-series-equiv-species-types + ( λ z → + Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3 ⊔ l4)) + ( cauchy-product-species-subuniverse P Q C1 S T) z) + ( λ z → + cauchy-product-species-types + ( Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q l3) + ( S)) + ( Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q l4) + ( T)) + z) + ( equiv-cauchy-product-Σ-extension-species-subuniverse P Q C1 C2 S T) + ( X)) ∘e + ( equiv-cauchy-series-Σ-extension-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3 ⊔ l4)) + ( cauchy-product-species-subuniverse P Q C1 S T) + ( X)) ``` diff --git a/src/species/products-cauchy-series-species-of-types.lagda.md b/src/species/products-cauchy-series-species-of-types.lagda.md index 347682538c..ca626dd4a4 100644 --- a/src/species/products-cauchy-series-species-of-types.lagda.md +++ b/src/species/products-cauchy-series-species-of-types.lagda.md @@ -28,7 +28,11 @@ open import species.species-of-types ## Idea -The product of two Cauchy series is just the pointwise product. +The +{{#concept "product" Disambiguation="of Caucy series of species of types" Agda=product-cauchy-series-species-types}} +of two [Cauchy series](species.cauchy-series-species-of-types.md) of +[species of types in subuniverses](species.species-of-types.md) is just the +pointwise [product](foundation.cartesian-product-types.md). ## Definition @@ -52,7 +56,21 @@ module _ (X : UU l4) where - private + equiv-cauchy-series-cauchy-product-species-types : + cauchy-series-species-types (cauchy-product-species-types S T) X ≃ + product-cauchy-series-species-types S T X + equiv-cauchy-series-cauchy-product-species-types = + ( reassociate') ∘e + ( equiv-tot + ( λ A → + equiv-tot + ( λ B → + ( equiv-product-right (equiv-universal-property-coproduct X)) ∘e + ( left-unit-law-Σ-is-contr + ( is-torsorial-equiv' (A + B)) + ( A + B , id-equiv))))) ∘e + ( reassociate) + where reassociate : cauchy-series-species-types (cauchy-product-species-types S T) X ≃ Σ ( UU l1) @@ -80,21 +98,4 @@ module _ (A , B , (s , t) , (fs , ft))) ( refl-htpy) ( refl-htpy) - - equiv-cauchy-series-cauchy-product-species-types : - cauchy-series-species-types (cauchy-product-species-types S T) X ≃ - product-cauchy-series-species-types S T X - equiv-cauchy-series-cauchy-product-species-types = - ( reassociate') ∘e - ( ( equiv-tot - ( λ A → - equiv-tot - ( λ B → - ( equiv-product - ( id-equiv) - ( equiv-universal-property-coproduct X)) ∘e - ( left-unit-law-Σ-is-contr - ( is-torsorial-equiv' (A + B)) - ( A + B , id-equiv))))) ∘e - ( reassociate)) ``` diff --git a/src/species/products-dirichlet-series-species-of-finite-inhabited-types.lagda.md b/src/species/products-dirichlet-series-species-of-finite-inhabited-types.lagda.md index 26fac97788..c0c591cf20 100644 --- a/src/species/products-dirichlet-series-species-of-finite-inhabited-types.lagda.md +++ b/src/species/products-dirichlet-series-species-of-finite-inhabited-types.lagda.md @@ -18,7 +18,13 @@ open import species.species-of-finite-inhabited-types ## Idea -The product of two Dirichlet series is the pointwise product. +The +{{#concept "product" Disambiguation="of Caucy series of species of finite inhabited types" Agda=product-dirichlet-series-species-Inhabited-Finite-Type}} +of two +[Dirichlet series](species.dirichlet-series-species-of-finite-inhabited-types.md) +of +[species of types in subuniverses](species.species-of-finite-inhabited-types.md) +is just the pointwise [product](foundation.cartesian-product-types.md). ## Definition diff --git a/src/species/products-dirichlet-series-species-of-types-in-subuniverses.lagda.md b/src/species/products-dirichlet-series-species-of-types-in-subuniverses.lagda.md index 0618179c6c..a2cb49f176 100644 --- a/src/species/products-dirichlet-series-species-of-types-in-subuniverses.lagda.md +++ b/src/species/products-dirichlet-series-species-of-types-in-subuniverses.lagda.md @@ -30,15 +30,20 @@ open import species.species-of-types-in-subuniverses ## Idea -The product of two Dirichlet series is the pointwise product. +The +{{#concept "product" Disambiguation="of Caucy series of species of types in subuniverses" Agda=product-dirichlet-series-species-subuniverse}} +of two +[Dirichlet series](species.dirichlet-series-species-of-types-in-subuniverses.md) +of +[species of types in subuniverses](species.species-of-types-in-subuniverses.md) +is just the pointwise [product](foundation.cartesian-product-types.md). ## Definition ```agda module _ - {l1 l2 l3 l4 l5 l6 : Level} - (P : subuniverse l1 l2) - (Q : global-subuniverse (λ l → l)) + {α : Level → Level} {l1 l2 l3 l4 l5 l6 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) (C1 : is-closed-under-products-subuniverse P) (H : species-subuniverse-domain l5 P) (C2 : preserves-product-species-subuniverse-domain P C1 H) @@ -74,9 +79,8 @@ module _ ```agda module _ - {l1 l2 l3 l4 l5 : Level} - (P : subuniverse l1 l2) - (Q : global-subuniverse (λ l → l)) + {α : Level → Level} {l1 l2 l3 l4 l5 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) (C1 : is-closed-under-products-subuniverse P) (H : species-subuniverse-domain l5 P) (C2 : preserves-product-species-subuniverse-domain P C1 H) @@ -87,7 +91,39 @@ module _ (X : UU l5) where - private + equiv-dirichlet-series-dirichlet-product-species-subuniverse : + dirichlet-series-species-subuniverse + ( P) + ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3 ⊔ l4)) + ( C1) + ( H) + ( C2) + ( dirichlet-product-species-subuniverse P Q C3 S T) + ( X) ≃ + product-dirichlet-series-species-subuniverse P Q C1 H C2 S T X + equiv-dirichlet-series-dirichlet-product-species-subuniverse = + ( reassociate') ∘e + ( equiv-tot + ( λ A → + equiv-tot + ( λ B → + ( equiv-product-right + ( equiv-up-product ∘e equiv-postcomp X (C2 A B))) ∘e + ( left-unit-law-Σ-is-contr + ( is-torsorial-equiv-subuniverse' + ( P) + ( inclusion-subuniverse P A × + inclusion-subuniverse P B , + C1 + ( is-in-subuniverse-inclusion-subuniverse P A) + ( is-in-subuniverse-inclusion-subuniverse P B))) + ( ( inclusion-subuniverse P A × inclusion-subuniverse P B , + C1 + ( is-in-subuniverse-inclusion-subuniverse P A) + ( is-in-subuniverse-inclusion-subuniverse P B)) , + ( id-equiv)))))) ∘e + ( reassociate) + where reassociate : dirichlet-series-species-subuniverse ( P) @@ -139,38 +175,4 @@ module _ (A , B , (s , t) , (fs , ft))) ( refl-htpy) ( refl-htpy) - - equiv-dirichlet-series-dirichlet-product-species-subuniverse : - dirichlet-series-species-subuniverse - ( P) - ( subuniverse-global-subuniverse Q (lsuc l1 ⊔ l2 ⊔ l3 ⊔ l4)) - ( C1) - ( H) - ( C2) - ( dirichlet-product-species-subuniverse P Q C3 S T) - ( X) ≃ - product-dirichlet-series-species-subuniverse P Q C1 H C2 S T X - equiv-dirichlet-series-dirichlet-product-species-subuniverse = - ( reassociate') ∘e - ( ( equiv-tot - ( λ A → - equiv-tot - ( λ B → - ( equiv-product - ( id-equiv) - ( equiv-up-product ∘e equiv-postcomp X (C2 A B))) ∘e - left-unit-law-Σ-is-contr - ( is-torsorial-equiv-subuniverse' - ( P) - ( inclusion-subuniverse P A × - inclusion-subuniverse P B , - C1 - ( is-in-subuniverse-inclusion-subuniverse P A) - ( is-in-subuniverse-inclusion-subuniverse P B))) - ( ( inclusion-subuniverse P A × inclusion-subuniverse P B , - C1 - ( is-in-subuniverse-inclusion-subuniverse P A) - ( is-in-subuniverse-inclusion-subuniverse P B)) , - id-equiv)))) ∘e - ( reassociate)) ``` diff --git a/src/species/products-dirichlet-series-species-of-types.lagda.md b/src/species/products-dirichlet-series-species-of-types.lagda.md index 1b015bd412..a431942e47 100644 --- a/src/species/products-dirichlet-series-species-of-types.lagda.md +++ b/src/species/products-dirichlet-series-species-of-types.lagda.md @@ -28,7 +28,11 @@ open import species.species-of-types ## Idea -The product of two Dirichlet series is the pointwise product. +The +{{#concept "product" Disambiguation="of Caucy series of species of types" Agda=product-dirichlet-series-species-subuniverse}} +of two [Dirichlet series](species.dirichlet-series-species-of-types.md) of +[species of types in subuniverses](species.species-of-types.md) is just the +pointwise [product](foundation.cartesian-product-types.md). ## Definition @@ -62,7 +66,26 @@ module _ (X : UU l4) where - private + equiv-dirichlet-series-dirichlet-product-species-types : + dirichlet-series-species-types + ( H) + ( C1) + ( dirichlet-product-species-types S T) + ( X) ≃ + product-dirichlet-series-species-types H C1 S T X + equiv-dirichlet-series-dirichlet-product-species-types = + ( reassociate') ∘e + ( equiv-tot + ( λ A → + equiv-tot + ( λ B → + ( equiv-product-right + ( equiv-up-product ∘e equiv-postcomp X (C1 A B))) ∘e + ( left-unit-law-Σ-is-contr + ( is-torsorial-equiv' (A × B)) + ( A × B , id-equiv))))) ∘e + ( reassociate) + where reassociate : dirichlet-series-species-types ( H) @@ -93,25 +116,4 @@ module _ (A , B , (s , t) , (fs , ft))) ( refl-htpy) ( refl-htpy) - - equiv-dirichlet-series-dirichlet-product-species-types : - dirichlet-series-species-types - ( H) - ( C1) - ( dirichlet-product-species-types S T) - ( X) ≃ - product-dirichlet-series-species-types H C1 S T X - equiv-dirichlet-series-dirichlet-product-species-types = - ( reassociate') ∘e - ( ( equiv-tot - ( λ A → - equiv-tot - ( λ B → - ( equiv-product - ( id-equiv) - ( equiv-up-product ∘e equiv-postcomp X (C1 A B))) ∘e - ( left-unit-law-Σ-is-contr - ( is-torsorial-equiv' (A × B)) - ( A × B , id-equiv))))) ∘e - ( reassociate)) ``` diff --git a/src/species/small-cauchy-composition-species-of-finite-inhabited-types.lagda.md b/src/species/small-cauchy-composition-species-of-finite-inhabited-types.lagda.md index 32e27e77d0..a580fe6658 100644 --- a/src/species/small-cauchy-composition-species-of-finite-inhabited-types.lagda.md +++ b/src/species/small-cauchy-composition-species-of-finite-inhabited-types.lagda.md @@ -55,18 +55,17 @@ equiv-Σ-Decomposition-Inhabited-Finite-Type-Σ-Decomposition-Finite-Type X = ( equiv-total-is-in-subuniverse-Σ-Decomposition ( is-finite-and-inhabited-Prop) ( map-compute-Inhabited-Finite-Type' X))) ∘e - ( ( equiv-tot - ( λ D → - equiv-product - ( equiv-add-redundant-prop - ( is-property-is-inhabited _) - ( λ _ → - map-is-inhabited - ( pr1 ∘ map-matching-correspondence-Relaxed-Σ-Decomposition D) - ( is-inhabited-type-Inhabited-Finite-Type X))) - ( id-equiv))) ∘e - ( ( equiv-Relaxed-Σ-Decomposition-Σ-Decomposition-Finite-Type - (finite-type-Inhabited-Finite-Type X)))) + ( equiv-tot + ( λ D → + equiv-product-left + ( equiv-add-redundant-prop + ( is-property-is-inhabited _) + ( λ _ → + map-is-inhabited + ( pr1 ∘ map-matching-correspondence-Relaxed-Σ-Decomposition D) + ( is-inhabited-type-Inhabited-Finite-Type X))))) ∘e + ( equiv-Relaxed-Σ-Decomposition-Σ-Decomposition-Finite-Type + ( finite-type-Inhabited-Finite-Type X)) is-finite-Σ-Decomposition-Subuniverse-Inhabited-Finite-Type : {l : Level} (X : Inhabited-Finite-Type l) → @@ -82,9 +81,9 @@ is-finite-Σ-Decomposition-Subuniverse-Inhabited-Finite-Type X = finite-Σ-Decomposition-Subuniverse-Inhabited-Finite-Type : {l : Level} (X : Inhabited-Finite-Type l) → Finite-Type (lsuc l) -pr1 (finite-Σ-Decomposition-Subuniverse-Inhabited-Finite-Type {l} X) = +pr1 (finite-Σ-Decomposition-Subuniverse-Inhabited-Finite-Type X) = Σ-Decomposition-Subuniverse - ( is-finite-and-inhabited-Prop {l}) + ( is-finite-and-inhabited-Prop) ( map-compute-Inhabited-Finite-Type' X) pr2 (finite-Σ-Decomposition-Subuniverse-Inhabited-Finite-Type X) = is-finite-Σ-Decomposition-Subuniverse-Inhabited-Finite-Type X @@ -94,7 +93,7 @@ module _ where finite-small-cauchy-composition-species-subuniverse : - ( S T : species-Inhabited-Finite-Type l1 (l1 ⊔ l2)) + (S T : species-Inhabited-Finite-Type l1 (l1 ⊔ l2)) (X : Inhabited-Finite-Type l1) → Finite-Type (lsuc l1 ⊔ l2) finite-small-cauchy-composition-species-subuniverse S T X = @@ -179,22 +178,19 @@ module _ C6 X = is-finite-is-decidable-Prop ( _ , - is-prop-equiv - ( inv-equiv - ( equiv-is-small - ( is-small-lmax l2 - ( is-contr - ( type-Inhabited-Finite-Type - ( map-inv-compute-Inhabited-Finite-Type' X)))))) - ( is-property-is-contr)) - ( is-decidable-equiv - ( inv-equiv + is-prop-equiv' ( equiv-is-small - ( is-small-lmax - ( l2) + ( is-small-lmax l2 ( is-contr ( type-Inhabited-Finite-Type - ( map-inv-compute-Inhabited-Finite-Type' X)))))) + ( map-inv-compute-Inhabited-Finite-Type' X))))) + ( is-property-is-contr)) + ( is-decidable-equiv' + ( equiv-is-small + ( is-small-lmax l2 + ( is-contr + ( type-Inhabited-Finite-Type + ( map-inv-compute-Inhabited-Finite-Type' X))))) ( is-decidable-is-contr-is-finite ( is-finite-Inhabited-Finite-Type ( map-inv-compute-Inhabited-Finite-Type' X)))) diff --git a/src/species/small-cauchy-composition-species-of-types-in-subuniverses.lagda.md b/src/species/small-cauchy-composition-species-of-types-in-subuniverses.lagda.md index 78eac4cbc1..0988bc7cc7 100644 --- a/src/species/small-cauchy-composition-species-of-types-in-subuniverses.lagda.md +++ b/src/species/small-cauchy-composition-species-of-types-in-subuniverses.lagda.md @@ -39,11 +39,11 @@ open import species.unit-cauchy-composition-species-of-types ## Idea -A species `S : Inhabited-Type → UU l` can be thought of as the analytic -endofunctor +A [species](species.species-of-types-in-subuniverses.md) +`S : Inhabited-Type → UU l` can be thought of as the analytic endofunctor ```text - X ↦ Σ (A : Inhabited-Type) (S A) × (A → X) + X ↦ Σ (A : Inhabited-Type), (S A) × (A → X). ``` Using the formula for composition of analytic endofunctors, we obtain a way to @@ -113,49 +113,33 @@ module _ ( Σ-extension-species-subuniverse P Q T) ( X)) equiv-small-cauchy-composition-Σ-extension-species-subuniverse S T X = - ( ( equiv-tot - ( λ D → - ( ( equiv-product id-equiv (inv-equiv distributive-Π-Σ)) ∘e - ( ( inv-equiv right-distributive-product-Σ) ∘e - ( ( equiv-tot (λ _ → inv-equiv (left-distributive-product-Σ)))))) ∘e - ( ( associative-Σ _ _ _)))) ∘e - ( ( associative-Σ - ( Relaxed-Σ-Decomposition l1 l1 X) + ( equiv-tot + ( λ D → + ( equiv-product-right inv-distributive-Π-Σ) ∘e + ( inv-equiv right-distributive-product-Σ) ∘e + ( equiv-tot (λ _ → inv-equiv left-distributive-product-Σ)) ∘e + ( associative-Σ _ _ _))) ∘e + ( associative-Σ _ _ _) ∘e + ( equiv-Σ-equiv-base + ( _) + ( ( equiv-remove-redundant-prop + ( is-prop-type-Prop (P X)) ( λ D → - is-in-subuniverse P (indexing-type-Relaxed-Σ-Decomposition D) × - ( (x : indexing-type-Relaxed-Σ-Decomposition D) → - is-in-subuniverse P (cotype-Relaxed-Σ-Decomposition D x))) - ( _)) ∘e - ( ( equiv-Σ-equiv-base - ( _) - ( ( inv-equiv - ( equiv-add-redundant-prop - ( is-prop-type-Prop (P X)) - ( λ D → - ( tr - ( is-in-subuniverse P) - ( eq-equiv - ( inv-equiv - ( matching-correspondence-Relaxed-Σ-Decomposition - (pr1 D)))) - ( C3 - ( indexing-type-Relaxed-Σ-Decomposition (pr1 D) , - pr1 (pr2 D)) - ( λ x → - ( cotype-Relaxed-Σ-Decomposition (pr1 D) x , - pr2 (pr2 D) x)))))) ∘e - ( commutative-product ∘e - ( equiv-tot - ( λ p → - equiv-total-is-in-subuniverse-Σ-Decomposition - ( P) - (X , p))))))) ∘e - ( ( inv-associative-Σ - ( is-in-subuniverse P X) - ( λ p → Σ-Decomposition-Subuniverse P (X , p)) - ( _)) ∘e - ( ( equiv-tot - ( λ p → inv-equiv (equiv-is-small (C1 S T (X , p)))))))))) + ( tr + ( is-in-subuniverse P) + ( eq-equiv + ( inv-equiv + ( matching-correspondence-Relaxed-Σ-Decomposition (pr1 D)))) + ( C3 + ( indexing-type-Relaxed-Σ-Decomposition (pr1 D) , pr1 (pr2 D)) + ( λ x → + ( cotype-Relaxed-Σ-Decomposition (pr1 D) x , + pr2 (pr2 D) x)))))) ∘e + ( commutative-product) ∘e + ( equiv-tot + ( λ p → equiv-total-is-in-subuniverse-Σ-Decomposition P (X , p))))) ∘e + ( inv-associative-Σ _ _ _) ∘e + ( equiv-tot (λ p → inv-equiv (equiv-is-small (C1 S T (X , p))))) ``` ### Unit laws for Cauchy composition of species-subuniverse @@ -203,8 +187,7 @@ module _ eq-pair ( eq-is-prop (is-prop-type-Prop (P X))) ( eq-is-prop - ( is-prop-equiv - ( inv-equiv (equiv-is-small (C5 X))) is-property-is-contr))) + ( is-prop-equiv' (equiv-is-small (C5 X)) is-property-is-contr))) htpy-left-unit-law-small-cauchy-composition-species-subuniverse : ( S : species-subuniverse P Q) @@ -216,26 +199,24 @@ module _ ( S) X) ≃ inclusion-subuniverse Q (S X) htpy-left-unit-law-small-cauchy-composition-species-subuniverse S X = - ( ( inv-equiv - ( equiv-Σ-extension-species-subuniverse P Q S X)) ∘e - ( ( left-unit-law-cauchy-composition-species-types - ( Σ-extension-species-subuniverse P Q S) - ( inclusion-subuniverse P X)) ∘e - ( ( equiv-tot - ( λ D → - equiv-product - ( equiv-Σ-extension-small-cauchy-composition-unit-subuniverse - ( indexing-type-Relaxed-Σ-Decomposition D)) - ( id-equiv))) ∘e - ( ( equiv-small-cauchy-composition-Σ-extension-species-subuniverse - ( small-cauchy-composition-unit-species-subuniverse) - ( S) - ( inclusion-subuniverse P X)) ∘e - ( ( equiv-Σ-extension-species-subuniverse P Q - ( small-cauchy-composition-species-subuniverse - ( small-cauchy-composition-unit-species-subuniverse) - ( S)) - ( X))))))) + ( inv-equiv (equiv-Σ-extension-species-subuniverse P Q S X)) ∘e + ( left-unit-law-cauchy-composition-species-types + ( Σ-extension-species-subuniverse P Q S) + ( inclusion-subuniverse P X)) ∘e + ( equiv-tot + ( λ D → + equiv-product-left + ( equiv-Σ-extension-small-cauchy-composition-unit-subuniverse + ( indexing-type-Relaxed-Σ-Decomposition D)))) ∘e + ( equiv-small-cauchy-composition-Σ-extension-species-subuniverse + ( small-cauchy-composition-unit-species-subuniverse) + ( S) + ( inclusion-subuniverse P X)) ∘e + ( equiv-Σ-extension-species-subuniverse P Q + ( small-cauchy-composition-species-subuniverse + ( small-cauchy-composition-unit-species-subuniverse) + ( S)) + ( X)) left-unit-law-small-cauchy-composition-species-subuniverse : ( S : species-subuniverse P Q) → @@ -261,29 +242,25 @@ module _ ( small-cauchy-composition-unit-species-subuniverse) X) ≃ inclusion-subuniverse Q (S X) htpy-right-unit-law-small-cauchy-composition-species-subuniverse S X = - ( ( inv-equiv (equiv-Σ-extension-species-subuniverse P Q S X)) ∘e - ( ( right-unit-law-cauchy-composition-species-types - ( Σ-extension-species-subuniverse P Q S) - ( inclusion-subuniverse P X)) ∘e - ( ( equiv-tot - ( λ D → - equiv-product - ( id-equiv) - ( equiv-Π - ( _) - ( id-equiv) - ( λ x → - equiv-Σ-extension-small-cauchy-composition-unit-subuniverse - ( cotype-Relaxed-Σ-Decomposition D x))))) ∘e - ( ( equiv-small-cauchy-composition-Σ-extension-species-subuniverse - ( S) - ( small-cauchy-composition-unit-species-subuniverse) - ( inclusion-subuniverse P X)) ∘e - ( ( equiv-Σ-extension-species-subuniverse P Q - ( small-cauchy-composition-species-subuniverse - S - small-cauchy-composition-unit-species-subuniverse) - ( X))))))) + ( inv-equiv (equiv-Σ-extension-species-subuniverse P Q S X)) ∘e + ( right-unit-law-cauchy-composition-species-types + ( Σ-extension-species-subuniverse P Q S) + ( inclusion-subuniverse P X)) ∘e + ( equiv-tot + ( λ D → + equiv-product-right + ( equiv-Π-equiv-family + ( λ x → + equiv-Σ-extension-small-cauchy-composition-unit-subuniverse + ( cotype-Relaxed-Σ-Decomposition D x))))) ∘e + ( equiv-small-cauchy-composition-Σ-extension-species-subuniverse + ( S) + ( small-cauchy-composition-unit-species-subuniverse) + ( inclusion-subuniverse P X)) ∘e + ( equiv-Σ-extension-species-subuniverse P Q + ( small-cauchy-composition-species-subuniverse S + small-cauchy-composition-unit-species-subuniverse) + ( X)) right-unit-law-small-cauchy-composition-species-subuniverse : ( S : species-subuniverse P Q) → @@ -321,55 +298,47 @@ module _ ( U) ( X)) htpy-associative-small-cauchy-composition-species-subuniverse S T U X = - ( ( inv-equiv - ( equiv-Σ-extension-species-subuniverse P Q - ( small-cauchy-composition-species-subuniverse - ( small-cauchy-composition-species-subuniverse S T) U) - ( X))) ∘e - ( ( inv-equiv - ( equiv-small-cauchy-composition-Σ-extension-species-subuniverse - ( small-cauchy-composition-species-subuniverse S T) - ( U) - ( inclusion-subuniverse P X))) ∘e - ( ( equiv-tot - ( λ D → - equiv-product - ( inv-equiv - ( equiv-small-cauchy-composition-Σ-extension-species-subuniverse - ( S) - ( T) - ( indexing-type-Relaxed-Σ-Decomposition D))) - ( id-equiv))) ∘e - ( ( equiv-associative-cauchy-composition-species-types - ( Σ-extension-species-subuniverse P Q S) - ( Σ-extension-species-subuniverse P Q T) - ( Σ-extension-species-subuniverse P Q U) - ( inclusion-subuniverse P X)) ∘e - ( ( equiv-tot - ( λ D → - equiv-product - ( id-equiv) - ( equiv-Π - ( λ y → - ( cauchy-composition-species-types - ( Σ-extension-species-subuniverse P Q T) - ( Σ-extension-species-subuniverse P Q U) - ( cotype-Relaxed-Σ-Decomposition D y))) - ( id-equiv) - ( λ y → - ( equiv-small-cauchy-composition-Σ-extension-species-subuniverse - ( T) - ( U) - ( cotype-Relaxed-Σ-Decomposition D y)))))) ∘e - ( ( equiv-small-cauchy-composition-Σ-extension-species-subuniverse - ( S) - ( small-cauchy-composition-species-subuniverse T U) - ( inclusion-subuniverse P X)) ∘e - ( ( equiv-Σ-extension-species-subuniverse P Q - ( small-cauchy-composition-species-subuniverse - ( S) - ( small-cauchy-composition-species-subuniverse T U)) - ( X))))))))) + ( inv-equiv + ( equiv-Σ-extension-species-subuniverse P Q + ( small-cauchy-composition-species-subuniverse + ( small-cauchy-composition-species-subuniverse S T) U) + ( X))) ∘e + ( inv-equiv + ( equiv-small-cauchy-composition-Σ-extension-species-subuniverse + ( small-cauchy-composition-species-subuniverse S T) + ( U) + ( inclusion-subuniverse P X))) ∘e + ( equiv-tot + ( λ D → + equiv-product-left + ( inv-equiv + ( equiv-small-cauchy-composition-Σ-extension-species-subuniverse + ( S) + ( T) + ( indexing-type-Relaxed-Σ-Decomposition D))))) ∘e + ( equiv-associative-cauchy-composition-species-types + ( Σ-extension-species-subuniverse P Q S) + ( Σ-extension-species-subuniverse P Q T) + ( Σ-extension-species-subuniverse P Q U) + ( inclusion-subuniverse P X)) ∘e + ( equiv-tot + ( λ D → + equiv-product-right + ( equiv-Π-equiv-family + ( λ y → + ( equiv-small-cauchy-composition-Σ-extension-species-subuniverse + ( T) + ( U) + ( cotype-Relaxed-Σ-Decomposition D y)))))) ∘e + ( equiv-small-cauchy-composition-Σ-extension-species-subuniverse + ( S) + ( small-cauchy-composition-species-subuniverse T U) + ( inclusion-subuniverse P X)) ∘e + ( equiv-Σ-extension-species-subuniverse P Q + ( small-cauchy-composition-species-subuniverse + ( S) + ( small-cauchy-composition-species-subuniverse T U)) + ( X)) associative-small-cauchy-composition-species-subuniverse : (S : species-subuniverse P Q) diff --git a/src/species/species-of-finite-inhabited-types.lagda.md b/src/species/species-of-finite-inhabited-types.lagda.md index fa9ba4bc14..967a14f475 100644 --- a/src/species/species-of-finite-inhabited-types.lagda.md +++ b/src/species/species-of-finite-inhabited-types.lagda.md @@ -19,8 +19,11 @@ open import univalent-combinatorics.inhabited-finite-types ## Idea -A **species of finite inhabited types** is a map from the subuniverse of finite -inhabited types to a universe of finite types. +A +{{#concept "species of finite inhabited types" Agda=species-Inhabited-Finite-Type}} +is a map from the [subuniverse](foundation.global-subuniverses.md) of +[finite inhabited types](univalent-combinatorics.inhabited-finite-types.md) to +the universe of [finite types](univalent-combinatorics.finite-types.md). ## Definition diff --git a/src/species/species-of-finite-types.lagda.md b/src/species/species-of-finite-types.lagda.md index 24eb4eb3b3..b71e979b86 100644 --- a/src/species/species-of-finite-types.lagda.md +++ b/src/species/species-of-finite-types.lagda.md @@ -18,7 +18,9 @@ open import univalent-combinatorics.finite-types ## Idea -A **species of finite types** is a map from `Finite-Type` to a `Finite-Type`. +A {{#concept "species of finite types" Agda=finite-species}} is a map from the +[subuniverse](foundation.global-subuniverses.md) of +[finite types](univalent-combinatorics.finite-types.md) to itself. ## Definition diff --git a/src/species/species-of-inhabited-types.lagda.md b/src/species/species-of-inhabited-types.lagda.md index 92c51b4adf..b6639428a8 100644 --- a/src/species/species-of-inhabited-types.lagda.md +++ b/src/species/species-of-inhabited-types.lagda.md @@ -18,13 +18,14 @@ open import species.species-of-types-in-subuniverses ## Idea -A **species of inhabited types** is a map from the subuniverse of inhabited -types to a universe. +A {{#concept "species of inhabited types" Agda=species-inhabited-types}} is a +map from the [subuniverse](foundation.global-subuniverses.md) of +[inhabited types](foundation.inhabited-types.md) to the universe of all types. ## Definition ```agda species-inhabited-types : (l1 l2 : Level) → UU (lsuc l1 ⊔ lsuc l2) species-inhabited-types l1 l2 = - species-subuniverse (is-inhabited-Prop {l1}) λ (X : UU l2) → unit-Prop + species-subuniverse (is-inhabited-Prop {l1}) (λ (X : UU l2) → unit-Prop) ``` diff --git a/src/species/species-of-types-in-subuniverses.lagda.md b/src/species/species-of-types-in-subuniverses.lagda.md index 1ef1c85fec..18725908fb 100644 --- a/src/species/species-of-types-in-subuniverses.lagda.md +++ b/src/species/species-of-types-in-subuniverses.lagda.md @@ -24,8 +24,8 @@ open import species.species-of-types ### Idea -A **species of types in a subuniverse** is a map from a subuniverse `P` to a -subuniverse `Q`. +A {{#concept "species of types in a subuniverse" Agda=species-subuniverse}} is a +map from a [subuniverse](foundation.subuniverses.md) `P` to a subuniverse `Q`. ## Definitions diff --git a/src/species/species-of-types.lagda.md b/src/species/species-of-types.lagda.md index e300981b9b..5468c0e314 100644 --- a/src/species/species-of-types.lagda.md +++ b/src/species/species-of-types.lagda.md @@ -18,7 +18,8 @@ open import foundation.universe-levels ### Idea -A **species of types** is defined to be a map from a universe to a universe. +A {{#concept "species of types" Agda=species-types}} is a map between +[universes](foundation.universe-levels.md) of types. ## Definitions diff --git a/src/species/unit-cauchy-composition-species-of-types-in-subuniverses.lagda.md b/src/species/unit-cauchy-composition-species-of-types-in-subuniverses.lagda.md index 030f8440d0..89e6858852 100644 --- a/src/species/unit-cauchy-composition-species-of-types-in-subuniverses.lagda.md +++ b/src/species/unit-cauchy-composition-species-of-types-in-subuniverses.lagda.md @@ -20,8 +20,12 @@ open import species.species-of-types-in-subuniverses ## Idea -Given a global subuniverse closed under `is-contr`, we define the unit of the -Cauchy composition of species of types in a subuniverse by +Given a [global subuniverse](foundation.global-subuniverses.md) closed under +`is-contr`, we define the unit of the +[Cauchy composition](species.cauchy-composition-species-of-types-in-subuniverses.md) +of +[species of types in a subuniverse](species.species-of-types-in-subuniverses.md) +by ```text X ↦ is-contr X. @@ -31,9 +35,8 @@ Cauchy composition of species of types in a subuniverse by ```agda module _ - {l1 l2 : Level} - (P : subuniverse l1 l2) - (Q : global-subuniverse (λ l → l)) + {α : Level → Level} {l1 l2 : Level} + (P : subuniverse l1 l2) (Q : global-subuniverse α) (C4 : is-closed-under-is-contr-subuniverses P ( subuniverse-global-subuniverse Q l1)) diff --git a/src/species/unit-cauchy-composition-species-of-types.lagda.md b/src/species/unit-cauchy-composition-species-of-types.lagda.md index 15884d5b45..8e699c5678 100644 --- a/src/species/unit-cauchy-composition-species-of-types.lagda.md +++ b/src/species/unit-cauchy-composition-species-of-types.lagda.md @@ -1,4 +1,4 @@ -# The unit of Cauchy composition of types +# The unit of Cauchy composition of species of types ```agda module species.unit-cauchy-composition-species-of-types where @@ -17,7 +17,10 @@ open import species.species-of-types ## Idea -The **unit** of Cauchy composition of species of types is the species +The +{{#concept "unit" Disambiguation="of Cauchy composition of species of types" Agda=unit-species-types}} +of [Cauchy composition](species.cauchy-composition-species-of-types.md) of +[species of types](species.species-of-types.md) is the species ```text X ↦ is-contr X. diff --git a/src/species/unlabeled-structures-species.lagda.md b/src/species/unlabeled-structures-species.lagda.md index 2ed30b8522..4df647fd62 100644 --- a/src/species/unlabeled-structures-species.lagda.md +++ b/src/species/unlabeled-structures-species.lagda.md @@ -21,8 +21,9 @@ open import univalent-combinatorics.finite-types ## Idea -The type of **unlabeled `F`-structures** of order `n` of a -[species](species.species-of-types.md) `F` is the type of +The type of +{{#concept "unlabeled `F`-structures" Disambiguation="of a species of types" Agda=unlabeled-structure-species-types}} +of order `n` of a [species](species.species-of-types.md) `F` is the type of [sets](foundation-core.sets.md) `X` of size `n` equipped with an `F`-structure. Two unlabeled `F`-structures of order `n` are considered to be the same if the underlying sets are isomorphic and the `F`-structure of the first transports diff --git a/src/trees/polynomial-endofunctors.lagda.md b/src/trees/polynomial-endofunctors.lagda.md index 6434bacb73..e43a9d39d7 100644 --- a/src/trees/polynomial-endofunctors.lagda.md +++ b/src/trees/polynomial-endofunctors.lagda.md @@ -30,8 +30,8 @@ open import foundation-core.torsorial-type-families ## Idea -Given a type `A` equipped with a type family `B` over `A`, the -{{#concept "polynomial endofunctor"}} `𝑃 A B` is defined by +Given a type `A` [equipped](foundation.structure.md) with a type family `B` over +`A`, the {{#concept "polynomial endofunctor"}} `𝑃 A B` is defined by ```text X ↦ Σ (x : A), (B x → X) @@ -115,7 +115,7 @@ module _ is-retraction-eq-Eq-type-polynomial-endofunctor x x refl ``` -### The action on morphisms of the polynomial endofunctor +### The action on maps of the polynomial endofunctor ```agda map-polynomial-endofunctor : @@ -151,3 +151,11 @@ coh-refl-htpy-polynomial-endofunctor A B f (x , α) = - [Multivariable polynomial functors](trees.multivariable-polynomial-functors.md) for the generalization of polynomial endofunctors to type families. +- [Cauchy series of species of types](species.cauchy-series-species-of-types.md) + are polynomial endofunctors of the form + ```text + X ↦ Σ (U : Type), S(U) × (U → X) + ``` + In other words, given a [species of types](species.species-of-types.md) `S`, + the shapes are types equipped with `S`-structure, and the positions are + points. diff --git a/src/univalent-combinatorics/cyclic-finite-types.lagda.md b/src/univalent-combinatorics/cyclic-finite-types.lagda.md index da2741d64a..160d23bc13 100644 --- a/src/univalent-combinatorics/cyclic-finite-types.lagda.md +++ b/src/univalent-combinatorics/cyclic-finite-types.lagda.md @@ -53,9 +53,10 @@ open import synthetic-homotopy-theory.loop-spaces ## Idea -A cyclic type is a type `X` equipped with an endomorphism `f : X → X` such that -the pair `(X, f)` is merely equivalent to the pair `(ℤ-Mod k, +1)` for some -`k : ℕ`. +A {{#concept "cyclic type" Agda=Cyclic-Type}} is a type `X` +[equipped](foundation.structure.md) with an endomorphism `f : X → X` such that +the pair `(X, f)` is [merely equivalent](foundation.mere-equivalences.md) to the +pair `(ℤ-Mod k, +1)` for some `k : ℕ`. ## Definitions diff --git a/src/univalent-combinatorics/decidable-equivalence-relations.lagda.md b/src/univalent-combinatorics/decidable-equivalence-relations.lagda.md index 46f0521430..c623cec35a 100644 --- a/src/univalent-combinatorics/decidable-equivalence-relations.lagda.md +++ b/src/univalent-combinatorics/decidable-equivalence-relations.lagda.md @@ -130,7 +130,7 @@ module _ is-finite-is-reflexive-Decidable-Relation-Finite-Type = is-finite-Π ( is-finite-type-Finite-Type A) - (λ x → is-finite-relation-Decidable-Relation-Finite-Type x x) + ( λ x → is-finite-relation-Decidable-Relation-Finite-Type x x) is-finite-is-symmetric-Decidable-Relation-Finite-Type : is-finite (is-symmetric-Relation-Prop (relation-Decidable-Relation R)) @@ -184,52 +184,43 @@ equiv-Surjection-Finite-Type-Decidable-Equivalence-Relation-Finite-Type : Surjection-Finite-Type l1 A equiv-Surjection-Finite-Type-Decidable-Equivalence-Relation-Finite-Type {l1} A = ( equiv-Σ-equiv-base - ( λ X → (type-Finite-Type A) ↠ (type-Finite-Type X)) - ( equiv-Σ - ( is-finite) - ( id-equiv) - ( λ X → - inv-equiv is-finite-iff-∃-surjection-has-decidable-equality)) ∘e - ( ( inv-associative-Σ - ( UU l1) - ( λ X → - has-decidable-equality X × - type-trunc-Prop (Σ ℕ (λ n → Fin n ↠ X))) - ( λ X → type-Finite-Type A ↠ pr1 X)) ∘e - ( ( equiv-Σ - (λ X → - Σ ( has-decidable-equality X × - type-trunc-Prop (Σ ℕ (λ n → Fin n ↠ X))) - ( λ _ → pr1 A ↠ X)) - ( id-equiv) - ( λ X → - ( ( inv-equiv - ( associative-product - ( has-decidable-equality X) - ( type-trunc-Prop (Σ ℕ (λ n → Fin n ↠ X))) - ( type-Finite-Type A ↠ X))) ∘e - ( ( equiv-product id-equiv commutative-product) ∘e - ( ( associative-product - ( has-decidable-equality (map-equiv id-equiv X)) - ( type-Finite-Type A ↠ X) - ( type-trunc-Prop (Σ ℕ (λ n → Fin n ↠ X)))) ∘e - ( ( equiv-product commutative-product id-equiv) ∘e - ( ( equiv-add-redundant-prop - ( is-prop-type-trunc-Prop) - ( λ x → - apply-universal-property-trunc-Prop - ( is-finite-type-Finite-Type A) - ( trunc-Prop ( Σ ℕ (λ n → Fin n ↠ X))) - ( λ count-A → - unit-trunc-Prop - ( number-of-elements-count count-A , - ( ( map-surjection (pr1 x) ∘ - map-equiv-count count-A) , - is-surjective-right-comp-equiv - ( is-surjective-map-surjection (pr1 x)) - ( equiv-count count-A)))))))))))) ∘e - ( equiv-Surjection-Into-Set-Decidable-Equivalence-Relation - ( type-Finite-Type A)))))) + ( λ X → (type-Finite-Type A) ↠ (type-Finite-Type X)) + ( equiv-tot + ( λ X → inv-equiv is-finite-iff-∃-surjection-has-decidable-equality))) ∘e + ( inv-associative-Σ + ( UU l1) + ( λ X → + has-decidable-equality X × + type-trunc-Prop (Σ ℕ (λ n → Fin n ↠ X))) + ( λ X → type-Finite-Type A ↠ pr1 X)) ∘e + ( equiv-tot + ( λ X → + ( ( inv-equiv + ( associative-product + ( has-decidable-equality X) + ( type-trunc-Prop (Σ ℕ (λ n → Fin n ↠ X))) + ( type-Finite-Type A ↠ X))) ∘e + ( equiv-product id-equiv commutative-product) ∘e + ( associative-product + ( has-decidable-equality (map-equiv id-equiv X)) + ( type-Finite-Type A ↠ X) + ( type-trunc-Prop (Σ ℕ (λ n → Fin n ↠ X)))) ∘e + ( equiv-product-left commutative-product) ∘e + ( equiv-add-redundant-prop + ( is-prop-type-trunc-Prop) + ( λ x → + apply-universal-property-trunc-Prop + ( is-finite-type-Finite-Type A) + ( trunc-Prop (Σ ℕ (λ n → Fin n ↠ X))) + ( λ count-A → + unit-trunc-Prop + ( number-of-elements-count count-A , + ( ( map-surjection (pr1 x) ∘ map-equiv-count count-A) , + is-surjective-right-comp-equiv + ( is-surjective-map-surjection (pr1 x)) + ( equiv-count count-A))))))))) ∘e + ( equiv-Surjection-Into-Set-Decidable-Equivalence-Relation + ( type-Finite-Type A)) ``` ### The type of decidable equivalence relations on a finite type is finite From f8079158edaeeb4a0993223af6526f1594e4c501 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Sat, 30 Aug 2025 08:29:14 -0700 Subject: [PATCH 29/97] Move sequences to `lists` namespace (#1476) Resolves #1436. --------- Co-authored-by: Fredrik Bakke --- .../convolution-sequences-commutative-rings.lagda.md | 5 +++-- ...onvolution-sequences-commutative-semirings.lagda.md | 5 +++-- ...hmetic-sequences-positive-rational-numbers.lagda.md | 3 ++- src/elementary-number-theory/catalan-numbers.lagda.md | 2 +- .../euclid-mullin-sequence.lagda.md | 2 +- .../fibonacci-sequence.lagda.md | 2 +- ...metric-sequences-positive-rational-numbers.lagda.md | 3 ++- src/elementary-number-theory/pisano-periods.lagda.md | 3 ++- .../sylvesters-sequence.lagda.md | 2 +- src/foundation.lagda.md | 6 ------ src/foundation/cantors-theorem.lagda.md | 4 ++-- .../cones-over-inverse-sequential-diagrams.lagda.md | 4 ++-- .../dependent-inverse-sequential-diagrams.lagda.md | 4 ++-- src/foundation/inverse-sequential-diagrams.lagda.md | 4 ++-- src/foundation/partial-elements.lagda.md | 2 +- src/foundation/partial-functions.lagda.md | 2 +- src/foundation/sequential-limits.lagda.md | 2 +- .../transfinite-cocomposition-of-maps.lagda.md | 3 +-- .../arithmetic-sequences-semigroups.lagda.md | 5 +++-- src/lists.lagda.md | 6 ++++++ src/{foundation => lists}/dependent-sequences.lagda.md | 2 +- src/lists/finite-sequences.lagda.md | 5 +++-- src/{foundation => lists}/partial-sequences.lagda.md | 2 +- .../repetitions-sequences.lagda.md | 5 +++-- src/{foundation => lists}/sequences.lagda.md | 5 +++-- src/{foundation => lists}/shifting-sequences.lagda.md | 2 +- src/{foundation => lists}/subsequences.lagda.md | 9 +++++---- .../cauchy-sequences-metric-spaces.lagda.md | 3 ++- .../convergent-sequences-metric-spaces.lagda.md | 3 ++- src/metric-spaces/isometries-metric-spaces.lagda.md | 2 ++ .../isometries-pseudometric-spaces.lagda.md | 3 ++- .../limits-of-sequences-metric-spaces.lagda.md | 3 ++- .../lipschitz-functions-metric-spaces.lagda.md | 3 ++- .../rational-sequences-approximating-zero.lagda.md | 5 +++-- src/metric-spaces/sequences-metric-spaces.lagda.md | 2 +- .../short-functions-metric-spaces.lagda.md | 3 ++- .../short-functions-pseudometric-spaces.lagda.md | 3 ++- src/order-theory/increasing-sequences-posets.lagda.md | 3 ++- src/order-theory/sequences-posets.lagda.md | 7 ++++--- src/order-theory/sequences-preorders.lagda.md | 7 ++++--- .../sequences-strictly-preordered-sets.lagda.md | 5 +++-- ...reasing-sequences-strictly-preordered-sets.lagda.md | 3 ++- .../arithmetic-sequences-semirings.lagda.md | 3 ++- src/ring-theory/arithmetic-series-semirings.lagda.md | 5 ++--- src/ring-theory/geometric-sequences-semirings.lagda.md | 3 ++- .../partial-sums-sequences-semirings.lagda.md | 4 ++-- src/set-theory/baire-space.lagda.md | 2 +- src/set-theory/cantor-space.lagda.md | 3 +-- src/set-theory/cantors-diagonal-argument.lagda.md | 4 ++-- src/set-theory/countable-sets.lagda.md | 3 ++- .../cocones-under-sequential-diagrams.lagda.md | 2 +- .../connective-prespectra.lagda.md | 2 +- .../connective-spectra.lagda.md | 2 +- ...ependent-cocones-under-sequential-diagrams.lagda.md | 4 ++-- .../dependent-sequential-diagrams.lagda.md | 7 +++---- .../equivalences-sequential-diagrams.lagda.md | 2 +- src/synthetic-homotopy-theory/homotopy-groups.lagda.md | 3 +-- .../maps-of-prespectra.lagda.md | 2 +- .../morphisms-sequential-diagrams.lagda.md | 4 ++-- src/synthetic-homotopy-theory/prespectra.lagda.md | 2 +- .../sequential-diagrams.lagda.md | 4 ++-- src/synthetic-homotopy-theory/spectra.lagda.md | 2 +- .../suspension-prespectra.lagda.md | 2 +- .../sequences-finite-types.lagda.md | 5 +++-- .../subfinite-indexing.lagda.md | 10 +++++----- 65 files changed, 129 insertions(+), 105 deletions(-) rename src/{foundation => lists}/dependent-sequences.lagda.md (94%) rename src/{foundation => lists}/partial-sequences.lagda.md (96%) rename src/{foundation => lists}/repetitions-sequences.lagda.md (98%) rename src/{foundation => lists}/sequences.lagda.md (92%) rename src/{foundation => lists}/shifting-sequences.lagda.md (92%) rename src/{foundation => lists}/subsequences.lagda.md (94%) diff --git a/src/commutative-algebra/convolution-sequences-commutative-rings.lagda.md b/src/commutative-algebra/convolution-sequences-commutative-rings.lagda.md index 4e13c0bd5b..17993d2021 100644 --- a/src/commutative-algebra/convolution-sequences-commutative-rings.lagda.md +++ b/src/commutative-algebra/convolution-sequences-commutative-rings.lagda.md @@ -15,13 +15,14 @@ open import elementary-number-theory.natural-numbers open import foundation.dependent-pair-types open import foundation.identity-types -open import foundation.sequences open import foundation.unital-binary-operations open import foundation.universe-levels open import group-theory.abelian-groups open import group-theory.semigroups +open import lists.sequences + open import ring-theory.rings open import univalent-combinatorics.dependent-pair-types @@ -34,7 +35,7 @@ open import univalent-combinatorics.standard-finite-types The {{#concept "convolution" WD="convolution" Disambiguation="of sequences in commutative rings" Agda=convolution-sequence-Commutative-Ring WDID=Q210857}} -of two [sequences](foundation.sequences.md) `aₙ` and `bₙ` of elements in a +of two [sequences](lists.sequences.md) `aₙ` and `bₙ` of elements in a [commutative ring](commutative-algebra.commutative-rings.md) is the new sequence ```text diff --git a/src/commutative-algebra/convolution-sequences-commutative-semirings.lagda.md b/src/commutative-algebra/convolution-sequences-commutative-semirings.lagda.md index 8cd9e4e512..e1a26981ec 100644 --- a/src/commutative-algebra/convolution-sequences-commutative-semirings.lagda.md +++ b/src/commutative-algebra/convolution-sequences-commutative-semirings.lagda.md @@ -22,7 +22,6 @@ open import foundation.function-extensionality open import foundation.function-types open import foundation.homotopies open import foundation.identity-types -open import foundation.sequences open import foundation.unit-type open import foundation.unital-binary-operations open import foundation.universe-levels @@ -30,6 +29,8 @@ open import foundation.universe-levels open import group-theory.commutative-monoids open import group-theory.semigroups +open import lists.sequences + open import ring-theory.semirings open import univalent-combinatorics.dependent-pair-types @@ -42,7 +43,7 @@ open import univalent-combinatorics.standard-finite-types The {{#concept "convolution" WD="convolution" Disambiguation="of sequences in commutative semirings" Agda=convolution-sequence-Commutative-Semiring WDID=Q210857}} -of two [sequences](foundation.sequences.md) `aₙ` and `bₙ` of elements in a +of two [sequences](lists.sequences.md) `aₙ` and `bₙ` of elements in a [commutative semiring](commutative-algebra.commutative-semirings.md) is the new sequence diff --git a/src/elementary-number-theory/arithmetic-sequences-positive-rational-numbers.lagda.md b/src/elementary-number-theory/arithmetic-sequences-positive-rational-numbers.lagda.md index 808ad7418e..0950117458 100644 --- a/src/elementary-number-theory/arithmetic-sequences-positive-rational-numbers.lagda.md +++ b/src/elementary-number-theory/arithmetic-sequences-positive-rational-numbers.lagda.md @@ -28,13 +28,14 @@ open import foundation.functoriality-dependent-pair-types open import foundation.homotopies open import foundation.identity-types open import foundation.propositional-truncations -open import foundation.sequences open import foundation.transport-along-identifications open import foundation.universe-levels open import group-theory.arithmetic-sequences-semigroups open import group-theory.powers-of-elements-monoids +open import lists.sequences + open import order-theory.increasing-sequences-posets open import order-theory.strictly-increasing-sequences-strictly-preordered-sets open import order-theory.strictly-preordered-sets diff --git a/src/elementary-number-theory/catalan-numbers.lagda.md b/src/elementary-number-theory/catalan-numbers.lagda.md index 55257b4c79..93135e4b6c 100644 --- a/src/elementary-number-theory/catalan-numbers.lagda.md +++ b/src/elementary-number-theory/catalan-numbers.lagda.md @@ -24,7 +24,7 @@ open import univalent-combinatorics.standard-finite-types The {{#concept "Catalan numbers" WD="Catalan number" WDID=Q270513 OEIS=A000108 Agda=catalan-numbers}} -$C_n$ is a [sequence](foundation.sequences.md) of +$C_n$ is a [sequence](lists.sequences.md) of [natural numbers](elementary-number-theory.natural-numbers.md) that occur in several combinatorics problems. The sequence starts diff --git a/src/elementary-number-theory/euclid-mullin-sequence.lagda.md b/src/elementary-number-theory/euclid-mullin-sequence.lagda.md index be53df7a65..aa0baaf757 100644 --- a/src/elementary-number-theory/euclid-mullin-sequence.lagda.md +++ b/src/elementary-number-theory/euclid-mullin-sequence.lagda.md @@ -26,7 +26,7 @@ open import univalent-combinatorics.standard-finite-types The {{#concept "Euclid–Mullin sequence" Agda=euclid-mullin-ℕ WDID=Q5406148 WD="Euclid-Mullin sequence"}} -is a [sequence](foundation.sequences.md) of +is a [sequence](lists.sequences.md) of [natural numbers](elementary-number-theory.natural-numbers.md), which is defined by [strong induction](elementary-number-theory.strong-induction-natural-numbers.md) diff --git a/src/elementary-number-theory/fibonacci-sequence.lagda.md b/src/elementary-number-theory/fibonacci-sequence.lagda.md index 89af95e039..1e10109934 100644 --- a/src/elementary-number-theory/fibonacci-sequence.lagda.md +++ b/src/elementary-number-theory/fibonacci-sequence.lagda.md @@ -26,7 +26,7 @@ open import foundation.transport-along-identifications The {{#concept "Fibonacci sequence" WD="Fibonacci sequence" WDID=Q23835349 Agda=Fibonacci-ℕ}} -is a recursively defined [sequence](foundation.sequences.md) of +is a recursively defined [sequence](lists.sequences.md) of [natural numbers](elementary-number-theory.natural-numbers.md) given by the equations diff --git a/src/elementary-number-theory/geometric-sequences-positive-rational-numbers.lagda.md b/src/elementary-number-theory/geometric-sequences-positive-rational-numbers.lagda.md index 31c51c44c9..69f19c0b20 100644 --- a/src/elementary-number-theory/geometric-sequences-positive-rational-numbers.lagda.md +++ b/src/elementary-number-theory/geometric-sequences-positive-rational-numbers.lagda.md @@ -29,13 +29,14 @@ open import foundation.function-types open import foundation.functoriality-dependent-pair-types open import foundation.homotopies open import foundation.identity-types -open import foundation.sequences open import foundation.transport-along-identifications open import foundation.universe-levels open import group-theory.arithmetic-sequences-semigroups open import group-theory.powers-of-elements-monoids +open import lists.sequences + open import order-theory.strictly-increasing-sequences-strictly-preordered-sets ``` diff --git a/src/elementary-number-theory/pisano-periods.lagda.md b/src/elementary-number-theory/pisano-periods.lagda.md index f765a59fb3..231db7df28 100644 --- a/src/elementary-number-theory/pisano-periods.lagda.md +++ b/src/elementary-number-theory/pisano-periods.lagda.md @@ -24,10 +24,11 @@ open import foundation.empty-types open import foundation.equivalences open import foundation.identity-types open import foundation.injective-maps -open import foundation.repetitions-sequences open import foundation.sets open import foundation.universe-levels +open import lists.repetitions-sequences + open import univalent-combinatorics.cartesian-product-types open import univalent-combinatorics.counting open import univalent-combinatorics.sequences-finite-types diff --git a/src/elementary-number-theory/sylvesters-sequence.lagda.md b/src/elementary-number-theory/sylvesters-sequence.lagda.md index 5b7094c31d..7c3e0fa00c 100644 --- a/src/elementary-number-theory/sylvesters-sequence.lagda.md +++ b/src/elementary-number-theory/sylvesters-sequence.lagda.md @@ -19,7 +19,7 @@ open import univalent-combinatorics.standard-finite-types ## Idea {{#concept "Sylvester's sequence" WD="Sylvester's sequence" WDID=Q2293800 Agda=sylvesters-sequence-ℕ}} -is the [sequence](foundation.sequences.md) `s` of +is the [sequence](lists.sequences.md) `s` of [natural numbers](elementary-number-theory.natural-numbers.md) in which `s n` is the successor of the [product](elementary-number-theory.products-of-natural-numbers.md) of all the diff --git a/src/foundation.lagda.md b/src/foundation.lagda.md index 468f95fd14..f0f52a7493 100644 --- a/src/foundation.lagda.md +++ b/src/foundation.lagda.md @@ -127,7 +127,6 @@ open import foundation.dependent-inverse-sequential-diagrams public open import foundation.dependent-pair-types public open import foundation.dependent-products-pullbacks public open import foundation.dependent-products-subtypes public -open import foundation.dependent-sequences public open import foundation.dependent-sums-pullbacks public open import foundation.dependent-telescopes public open import foundation.dependent-universal-property-equivalences public @@ -339,7 +338,6 @@ open import foundation.opposite-spans public open import foundation.pairs-of-distinct-elements public open import foundation.partial-elements public open import foundation.partial-functions public -open import foundation.partial-sequences public open import foundation.partitions public open import foundation.path-algebra public open import foundation.path-cosplit-maps public @@ -386,21 +384,18 @@ open import foundation.reflexive-relations public open import foundation.regensburg-extension-fundamental-theorem-of-identity-types public open import foundation.relaxed-sigma-decompositions public open import foundation.repetitions-of-values public -open import foundation.repetitions-sequences public open import foundation.replacement public open import foundation.retractions public open import foundation.retracts-of-maps public open import foundation.retracts-of-types public open import foundation.sections public open import foundation.separated-types-subuniverses public -open import foundation.sequences public open import foundation.sequential-limits public open import foundation.set-coequalizers public open import foundation.set-presented-types public open import foundation.set-quotients public open import foundation.set-truncations public open import foundation.sets public -open import foundation.shifting-sequences public open import foundation.sigma-closed-subuniverses public open import foundation.sigma-decomposition-subuniverse public open import foundation.sigma-decompositions public @@ -430,7 +425,6 @@ open import foundation.structure public open import foundation.structure-identity-principle public open import foundation.structured-equality-duality public open import foundation.structured-type-duality public -open import foundation.subsequences public open import foundation.subsingleton-induction public open import foundation.subterminal-types public open import foundation.subtype-duality public diff --git a/src/foundation/cantors-theorem.lagda.md b/src/foundation/cantors-theorem.lagda.md index 1ec52a1179..c2dd97cfd5 100644 --- a/src/foundation/cantors-theorem.lagda.md +++ b/src/foundation/cantors-theorem.lagda.md @@ -212,8 +212,8 @@ was considered in the context of [infinite sets](set-theory.infinite-sets.md). - Cantor's theorem generalizes [Cantor's diagonal argument](set-theory.cantors-diagonal-argument.md), which shows that the [set](foundation-core.sets.md) of - [infinite sequences](foundation.sequences.md) on a set with at least two - distinct elements is [uncountable](set-theory.uncountable-sets.md). + [infinite sequences](lists.sequences.md) on a set with at least two distinct + elements is [uncountable](set-theory.uncountable-sets.md). - Cantor's theorem is generalized by [Lawvere's fixed point theorem](foundation.lawveres-fixed-point-theorem.md). diff --git a/src/foundation/cones-over-inverse-sequential-diagrams.lagda.md b/src/foundation/cones-over-inverse-sequential-diagrams.lagda.md index a062c7b9d4..0a0efc9b2a 100644 --- a/src/foundation/cones-over-inverse-sequential-diagrams.lagda.md +++ b/src/foundation/cones-over-inverse-sequential-diagrams.lagda.md @@ -33,8 +33,8 @@ open import foundation-core.torsorial-type-families A **cone over an [inverse sequential diagram](foundation.inverse-sequential-diagrams.md) `A` with -domain `X`** is a [sequence](foundation.dependent-sequences.md) of functions -from `X` into the sequence of types of `A` such that the triangles +domain `X`** is a [sequence](lists.dependent-sequences.md) of functions from `X` +into the sequence of types of `A` such that the triangles ```text X diff --git a/src/foundation/dependent-inverse-sequential-diagrams.lagda.md b/src/foundation/dependent-inverse-sequential-diagrams.lagda.md index f48ea9d065..4344f25d53 100644 --- a/src/foundation/dependent-inverse-sequential-diagrams.lagda.md +++ b/src/foundation/dependent-inverse-sequential-diagrams.lagda.md @@ -25,8 +25,8 @@ open import foundation-core.homotopies A **dependent inverse sequential diagram** `B` over a base [inverse sequential diagram](foundation.inverse-sequential-diagrams.md) `A` is a -[sequence](foundation.sequences.md) of families over each `Aₙ` together with -maps of fibers +[sequence](lists.sequences.md) of families over each `Aₙ` together with maps of +fibers ```text gₙ : (xₙ₊₁ : Aₙ₊₁) → Bₙ₊₁(xₙ₊₁) → Bₙ(fₙ(xₙ₊₁)), diff --git a/src/foundation/inverse-sequential-diagrams.lagda.md b/src/foundation/inverse-sequential-diagrams.lagda.md index 28053d466e..32d5c1c80e 100644 --- a/src/foundation/inverse-sequential-diagrams.lagda.md +++ b/src/foundation/inverse-sequential-diagrams.lagda.md @@ -21,8 +21,8 @@ open import foundation.universe-levels An {{#concept "inverse sequential diagram" Disambiguation="types" Agda=inverse-sequential-diagram}} -of types `A` is a [sequence](foundation.sequences.md) of types together with -maps between every two consecutive types +of types `A` is a [sequence](lists.sequences.md) of types together with maps +between every two consecutive types ```text fₙ : Aₙ₊₁ → Aₙ diff --git a/src/foundation/partial-elements.lagda.md b/src/foundation/partial-elements.lagda.md index 36964902ad..4b9fda48f3 100644 --- a/src/foundation/partial-elements.lagda.md +++ b/src/foundation/partial-elements.lagda.md @@ -86,5 +86,5 @@ This remains to be shown. - [Copartial elements](foundation.copartial-elements.md) - [Partial functions](foundation.partial-functions.md) -- [Partial sequences](foundation.partial-sequences.md) +- [Partial sequences](lists.partial-sequences.md) - [Total partial functions](foundation.total-partial-functions.md) diff --git a/src/foundation/partial-functions.lagda.md b/src/foundation/partial-functions.lagda.md index 9b23765ad7..ce995eb628 100644 --- a/src/foundation/partial-functions.lagda.md +++ b/src/foundation/partial-functions.lagda.md @@ -128,4 +128,4 @@ module _ - [Copartial functions](foundation.copartial-functions.md) - [Partial elements](foundation.partial-elements.md) -- [Partial sequences](foundation.partial-sequences.md) +- [Partial sequences](lists.partial-sequences.md) diff --git a/src/foundation/sequential-limits.lagda.md b/src/foundation/sequential-limits.lagda.md index f2891ee0db..1743b65f53 100644 --- a/src/foundation/sequential-limits.lagda.md +++ b/src/foundation/sequential-limits.lagda.md @@ -52,7 +52,7 @@ of `Aₙ` thus completing the diagram ``` The standard sequential limit consists of "points at infinity", which can be -recorded as [sequences](foundation.dependent-sequences.md) of terms whose images +recorded as [sequences](lists.dependent-sequences.md) of terms whose images under `f` agree: ```text diff --git a/src/foundation/transfinite-cocomposition-of-maps.lagda.md b/src/foundation/transfinite-cocomposition-of-maps.lagda.md index 9d3f7d02ca..16c6832604 100644 --- a/src/foundation/transfinite-cocomposition-of-maps.lagda.md +++ b/src/foundation/transfinite-cocomposition-of-maps.lagda.md @@ -18,8 +18,7 @@ open import foundation.universe-levels Given an [inverse sequential diagram of types](foundation.inverse-sequential-diagrams.md), -i.e. a certain infinite [sequence](foundation.dependent-sequences.md) of maps -`fₙ`: +i.e. a certain infinite [sequence](lists.dependent-sequences.md) of maps `fₙ`: ```text ⋯ fₙ ⋯ f₁ f₀ diff --git a/src/group-theory/arithmetic-sequences-semigroups.lagda.md b/src/group-theory/arithmetic-sequences-semigroups.lagda.md index 91845eda0e..f58aa8571c 100644 --- a/src/group-theory/arithmetic-sequences-semigroups.lagda.md +++ b/src/group-theory/arithmetic-sequences-semigroups.lagda.md @@ -16,18 +16,19 @@ open import foundation.dependent-pair-types open import foundation.homotopies open import foundation.identity-types open import foundation.propositions -open import foundation.sequences open import foundation.sets open import foundation.universe-levels open import group-theory.semigroups + +open import lists.sequences ``` ## Ideas -A [sequence](foundation.sequences.md) `u` in a +A [sequence](lists.sequences.md) `u` in a [semigroup](group-theory.semigroups.md) `G` is called {{#concept "arithmetic" Disambiguation="sequence in a semigroup" Agda=arithmetic-sequence-Semigroup WD="arithmetic progression" WDID=Q170008}} with common difference `d : type-Semigroup G` if the successor term of `u` is diff --git a/src/lists.lagda.md b/src/lists.lagda.md index bb36916d48..373398754b 100644 --- a/src/lists.lagda.md +++ b/src/lists.lagda.md @@ -7,6 +7,7 @@ module lists where open import lists.arrays public open import lists.concatenation-lists public +open import lists.dependent-sequences public open import lists.equivalence-tuples-finite-sequences public open import lists.finite-sequences public open import lists.flattening-lists public @@ -16,17 +17,22 @@ open import lists.functoriality-tuples public open import lists.functoriality-tuples-finite-sequences public open import lists.lists public open import lists.lists-discrete-types public +open import lists.partial-sequences public open import lists.permutation-lists public open import lists.permutation-tuples public open import lists.predicates-on-lists public open import lists.quicksort-lists public +open import lists.repetitions-sequences public open import lists.reversing-lists public +open import lists.sequences public +open import lists.shifting-sequences public open import lists.sort-by-insertion-lists public open import lists.sort-by-insertion-tuples public open import lists.sorted-lists public open import lists.sorted-tuples public open import lists.sorting-algorithms-lists public open import lists.sorting-algorithms-tuples public +open import lists.subsequences public open import lists.tuples public open import lists.universal-property-lists-wild-monoids public ``` diff --git a/src/foundation/dependent-sequences.lagda.md b/src/lists/dependent-sequences.lagda.md similarity index 94% rename from src/foundation/dependent-sequences.lagda.md rename to src/lists/dependent-sequences.lagda.md index 7590315c29..e19e9aff5e 100644 --- a/src/foundation/dependent-sequences.lagda.md +++ b/src/lists/dependent-sequences.lagda.md @@ -1,7 +1,7 @@ # Dependent sequences ```agda -module foundation.dependent-sequences where +module lists.dependent-sequences where ```
Imports diff --git a/src/lists/finite-sequences.lagda.md b/src/lists/finite-sequences.lagda.md index 2a12be3f5a..db7607278b 100644 --- a/src/lists/finite-sequences.lagda.md +++ b/src/lists/finite-sequences.lagda.md @@ -16,13 +16,14 @@ open import foundation.function-extensionality open import foundation.function-types open import foundation.homotopies open import foundation.identity-types -open import foundation.sequences open import foundation.sets open import foundation.truncated-types open import foundation.truncation-levels open import foundation.unit-type open import foundation.universe-levels +open import lists.sequences + open import univalent-combinatorics.involution-standard-finite-types open import univalent-combinatorics.standard-finite-types ``` @@ -179,4 +180,4 @@ module _ ## See also -- [Sequences](foundation.sequences.md) +- [Sequences](lists.sequences.md) diff --git a/src/foundation/partial-sequences.lagda.md b/src/lists/partial-sequences.lagda.md similarity index 96% rename from src/foundation/partial-sequences.lagda.md rename to src/lists/partial-sequences.lagda.md index a45abe530c..5c1006399f 100644 --- a/src/foundation/partial-sequences.lagda.md +++ b/src/lists/partial-sequences.lagda.md @@ -1,7 +1,7 @@ # Partial sequences ```agda -module foundation.partial-sequences where +module lists.partial-sequences where ```
Imports diff --git a/src/foundation/repetitions-sequences.lagda.md b/src/lists/repetitions-sequences.lagda.md similarity index 98% rename from src/foundation/repetitions-sequences.lagda.md rename to src/lists/repetitions-sequences.lagda.md index c52b33a71d..c07cf3d2b0 100644 --- a/src/foundation/repetitions-sequences.lagda.md +++ b/src/lists/repetitions-sequences.lagda.md @@ -1,7 +1,7 @@ # Repetitions in sequences ```agda -module foundation.repetitions-sequences where +module lists.repetitions-sequences where ```
Imports @@ -15,7 +15,6 @@ open import foundation.dependent-pair-types open import foundation.negated-equality open import foundation.pairs-of-distinct-elements open import foundation.repetitions-of-values -open import foundation.sequences open import foundation.unit-type open import foundation.universe-levels @@ -25,6 +24,8 @@ open import foundation-core.function-types open import foundation-core.functoriality-dependent-pair-types open import foundation-core.identity-types open import foundation-core.injective-maps + +open import lists.sequences ```
diff --git a/src/foundation/sequences.lagda.md b/src/lists/sequences.lagda.md similarity index 92% rename from src/foundation/sequences.lagda.md rename to src/lists/sequences.lagda.md index 82a24c7127..2549a666e1 100644 --- a/src/foundation/sequences.lagda.md +++ b/src/lists/sequences.lagda.md @@ -1,16 +1,17 @@ # Sequences ```agda -module foundation.sequences where +module lists.sequences where ```
Imports ```agda -open import foundation.dependent-sequences open import foundation.universe-levels open import foundation-core.function-types + +open import lists.dependent-sequences ```
diff --git a/src/foundation/shifting-sequences.lagda.md b/src/lists/shifting-sequences.lagda.md similarity index 92% rename from src/foundation/shifting-sequences.lagda.md rename to src/lists/shifting-sequences.lagda.md index 5686c321c4..b5b655cf1b 100644 --- a/src/foundation/shifting-sequences.lagda.md +++ b/src/lists/shifting-sequences.lagda.md @@ -1,7 +1,7 @@ # Shifting sequences ```agda -module foundation.shifting-sequences where +module lists.shifting-sequences where ```
Imports diff --git a/src/foundation/subsequences.lagda.md b/src/lists/subsequences.lagda.md similarity index 94% rename from src/foundation/subsequences.lagda.md rename to src/lists/subsequences.lagda.md index a9d95cf95b..383d37dc59 100644 --- a/src/foundation/subsequences.lagda.md +++ b/src/lists/subsequences.lagda.md @@ -1,7 +1,7 @@ # Subsequences ```agda -module foundation.subsequences where +module lists.subsequences where ```
Imports @@ -16,9 +16,10 @@ open import foundation.function-types open import foundation.functoriality-dependent-pair-types open import foundation.identity-types open import foundation.propositional-truncations -open import foundation.sequences open import foundation.universe-levels +open import lists.sequences + open import order-theory.strict-order-preserving-maps open import order-theory.strictly-increasing-sequences-strictly-preordered-sets ``` @@ -27,8 +28,8 @@ open import order-theory.strictly-increasing-sequences-strictly-preordered-sets ## Idea -A {{concept "subsequence" Agda=subsequence}} of a -[sequence](foundation.sequences.md) `u : ℕ → A` is a sequence `u ∘ f` for some +A {{concept "subsequence" Agda=subsequence}} of a [sequence](lists.sequences.md) +`u : ℕ → A` is a sequence `u ∘ f` for some [strictly increasing](order-theory.strict-order-preserving-maps.md) sequence `f : ℕ → ℕ`. diff --git a/src/metric-spaces/cauchy-sequences-metric-spaces.lagda.md b/src/metric-spaces/cauchy-sequences-metric-spaces.lagda.md index 2d487414d8..b098c9cdd5 100644 --- a/src/metric-spaces/cauchy-sequences-metric-spaces.lagda.md +++ b/src/metric-spaces/cauchy-sequences-metric-spaces.lagda.md @@ -29,10 +29,11 @@ open import foundation.functoriality-dependent-pair-types open import foundation.identity-types open import foundation.propositional-truncations open import foundation.propositions -open import foundation.sequences open import foundation.transport-along-identifications open import foundation.universe-levels +open import lists.sequences + open import metric-spaces.cauchy-approximations-metric-spaces open import metric-spaces.convergent-cauchy-approximations-metric-spaces open import metric-spaces.convergent-sequences-metric-spaces diff --git a/src/metric-spaces/convergent-sequences-metric-spaces.lagda.md b/src/metric-spaces/convergent-sequences-metric-spaces.lagda.md index 7ee9da772c..26c7c16338 100644 --- a/src/metric-spaces/convergent-sequences-metric-spaces.lagda.md +++ b/src/metric-spaces/convergent-sequences-metric-spaces.lagda.md @@ -9,10 +9,11 @@ module metric-spaces.convergent-sequences-metric-spaces where ```agda open import foundation.dependent-pair-types open import foundation.identity-types -open import foundation.sequences open import foundation.subtypes open import foundation.universe-levels +open import lists.sequences + open import metric-spaces.limits-of-sequences-metric-spaces open import metric-spaces.metric-spaces open import metric-spaces.sequences-metric-spaces diff --git a/src/metric-spaces/isometries-metric-spaces.lagda.md b/src/metric-spaces/isometries-metric-spaces.lagda.md index 04edaf2f91..a209bfed08 100644 --- a/src/metric-spaces/isometries-metric-spaces.lagda.md +++ b/src/metric-spaces/isometries-metric-spaces.lagda.md @@ -22,6 +22,8 @@ open import foundation.sets open import foundation.subtypes open import foundation.universe-levels +open import lists.sequences + open import metric-spaces.functions-metric-spaces open import metric-spaces.isometries-pseudometric-spaces open import metric-spaces.metric-spaces diff --git a/src/metric-spaces/isometries-pseudometric-spaces.lagda.md b/src/metric-spaces/isometries-pseudometric-spaces.lagda.md index 7dfdd87f64..35d81a521c 100644 --- a/src/metric-spaces/isometries-pseudometric-spaces.lagda.md +++ b/src/metric-spaces/isometries-pseudometric-spaces.lagda.md @@ -18,10 +18,11 @@ open import foundation.homotopies open import foundation.identity-types open import foundation.logical-equivalences open import foundation.propositions -open import foundation.sequences open import foundation.subtypes open import foundation.universe-levels +open import lists.sequences + open import metric-spaces.functions-pseudometric-spaces open import metric-spaces.preimages-rational-neighborhood-relations open import metric-spaces.pseudometric-spaces diff --git a/src/metric-spaces/limits-of-sequences-metric-spaces.lagda.md b/src/metric-spaces/limits-of-sequences-metric-spaces.lagda.md index 45c5140b71..9ecb196dbd 100644 --- a/src/metric-spaces/limits-of-sequences-metric-spaces.lagda.md +++ b/src/metric-spaces/limits-of-sequences-metric-spaces.lagda.md @@ -20,11 +20,12 @@ open import foundation.inhabited-subtypes open import foundation.inhabited-types open import foundation.propositional-truncations open import foundation.propositions -open import foundation.sequences open import foundation.subtypes open import foundation.transport-along-identifications open import foundation.universe-levels +open import lists.sequences + open import metric-spaces.metric-spaces open import metric-spaces.sequences-metric-spaces open import metric-spaces.short-functions-metric-spaces diff --git a/src/metric-spaces/lipschitz-functions-metric-spaces.lagda.md b/src/metric-spaces/lipschitz-functions-metric-spaces.lagda.md index bbf3ef92a2..e3b1e61b2c 100644 --- a/src/metric-spaces/lipschitz-functions-metric-spaces.lagda.md +++ b/src/metric-spaces/lipschitz-functions-metric-spaces.lagda.md @@ -27,12 +27,13 @@ open import foundation.inhabited-types open import foundation.logical-equivalences open import foundation.propositional-truncations open import foundation.propositions -open import foundation.sequences open import foundation.sets open import foundation.subtypes open import foundation.transport-along-identifications open import foundation.universe-levels +open import lists.sequences + open import logic.functoriality-existential-quantification open import metric-spaces.elements-at-bounded-distance-metric-spaces diff --git a/src/metric-spaces/rational-sequences-approximating-zero.lagda.md b/src/metric-spaces/rational-sequences-approximating-zero.lagda.md index b86311f7fc..dc29336abc 100644 --- a/src/metric-spaces/rational-sequences-approximating-zero.lagda.md +++ b/src/metric-spaces/rational-sequences-approximating-zero.lagda.md @@ -32,11 +32,12 @@ open import foundation.identity-types open import foundation.inhabited-types open import foundation.propositional-truncations open import foundation.propositions -open import foundation.sequences open import foundation.subtypes open import foundation.transport-along-identifications open import foundation.universe-levels +open import lists.sequences + open import metric-spaces.cauchy-approximations-metric-spaces open import metric-spaces.convergent-cauchy-approximations-metric-spaces open import metric-spaces.limits-of-cauchy-approximations-metric-spaces @@ -52,7 +53,7 @@ open import metric-spaces.sequences-metric-spaces ## Idea -A [sequence](foundation.sequences.md) of +A [sequence](lists.sequences.md) of [rational numbers](elementary-number-theory.rational-numbers.md) is an {{#concept "approximation of zero" Disambiguation="sequence of rational numbers" Agda=zero-limit-sequence-ℚ}} if it [converges](metric-spaces.limits-of-sequences-metric-spaces.md) to 0 in diff --git a/src/metric-spaces/sequences-metric-spaces.lagda.md b/src/metric-spaces/sequences-metric-spaces.lagda.md index 739550c4da..4ad270d9ac 100644 --- a/src/metric-spaces/sequences-metric-spaces.lagda.md +++ b/src/metric-spaces/sequences-metric-spaces.lagda.md @@ -22,7 +22,7 @@ open import metric-spaces.metric-spaces A {{#concept "sequence" Disambiguation="in a metric space" Agda=sequence-type-Metric-Space}} in a [metric space](metric-spaces.metric-spaces.md) is a -[sequence](foundation.sequences.md) in its underlying type. +[sequence](lists.sequences.md) in its underlying type. ## Definitions diff --git a/src/metric-spaces/short-functions-metric-spaces.lagda.md b/src/metric-spaces/short-functions-metric-spaces.lagda.md index 6b7f17584b..64e55931bc 100644 --- a/src/metric-spaces/short-functions-metric-spaces.lagda.md +++ b/src/metric-spaces/short-functions-metric-spaces.lagda.md @@ -19,11 +19,12 @@ open import foundation.homotopies open import foundation.identity-types open import foundation.propositional-truncations open import foundation.propositions -open import foundation.sequences open import foundation.sets open import foundation.subtypes open import foundation.universe-levels +open import lists.sequences + open import metric-spaces.functions-metric-spaces open import metric-spaces.isometries-metric-spaces open import metric-spaces.metric-spaces diff --git a/src/metric-spaces/short-functions-pseudometric-spaces.lagda.md b/src/metric-spaces/short-functions-pseudometric-spaces.lagda.md index c8789e3cb6..2075b6e100 100644 --- a/src/metric-spaces/short-functions-pseudometric-spaces.lagda.md +++ b/src/metric-spaces/short-functions-pseudometric-spaces.lagda.md @@ -19,11 +19,12 @@ open import foundation.homotopies open import foundation.identity-types open import foundation.propositional-truncations open import foundation.propositions -open import foundation.sequences open import foundation.sets open import foundation.subtypes open import foundation.universe-levels +open import lists.sequences + open import metric-spaces.functions-pseudometric-spaces open import metric-spaces.isometries-pseudometric-spaces open import metric-spaces.poset-of-rational-neighborhood-relations diff --git a/src/order-theory/increasing-sequences-posets.lagda.md b/src/order-theory/increasing-sequences-posets.lagda.md index d74478d47f..f822eec21b 100644 --- a/src/order-theory/increasing-sequences-posets.lagda.md +++ b/src/order-theory/increasing-sequences-posets.lagda.md @@ -15,9 +15,10 @@ open import foundation.dependent-pair-types open import foundation.function-types open import foundation.identity-types open import foundation.propositions -open import foundation.sequences open import foundation.universe-levels +open import lists.sequences + open import order-theory.order-preserving-maps-posets open import order-theory.posets open import order-theory.sequences-posets diff --git a/src/order-theory/sequences-posets.lagda.md b/src/order-theory/sequences-posets.lagda.md index d3ba989eba..5d2dc2cb12 100644 --- a/src/order-theory/sequences-posets.lagda.md +++ b/src/order-theory/sequences-posets.lagda.md @@ -14,9 +14,10 @@ open import foundation.dependent-pair-types open import foundation.function-extensionality open import foundation.function-types open import foundation.propositions -open import foundation.sequences open import foundation.universe-levels +open import lists.sequences + open import order-theory.posets open import order-theory.sequences-preorders ``` @@ -26,8 +27,8 @@ open import order-theory.sequences-preorders ## Idea A {{#concept "sequence" Disambiguation="in a poset" Agda=sequence-type-Poset}} -in a [poset](order-theory.posets.md) is a [sequence](foundation.sequences.md) in -its underlying type. +in a [poset](order-theory.posets.md) is a [sequence](lists.sequences.md) in its +underlying type. ## Definitions diff --git a/src/order-theory/sequences-preorders.lagda.md b/src/order-theory/sequences-preorders.lagda.md index fad9190cf1..1592fcd311 100644 --- a/src/order-theory/sequences-preorders.lagda.md +++ b/src/order-theory/sequences-preorders.lagda.md @@ -14,9 +14,10 @@ open import foundation.dependent-pair-types open import foundation.function-extensionality open import foundation.function-types open import foundation.propositions -open import foundation.sequences open import foundation.universe-levels +open import lists.sequences + open import order-theory.preorders ``` @@ -26,8 +27,8 @@ open import order-theory.preorders A {{#concept "sequence" Disambiguation="in a preorder" Agda=sequence-type-Preorder}} -in a [preorder](order-theory.preorders.md) is a -[sequence](foundation.sequences.md) in its underlying type. +in a [preorder](order-theory.preorders.md) is a [sequence](lists.sequences.md) +in its underlying type. ## Definitions diff --git a/src/order-theory/sequences-strictly-preordered-sets.lagda.md b/src/order-theory/sequences-strictly-preordered-sets.lagda.md index 379f538e28..da3bdb2e39 100644 --- a/src/order-theory/sequences-strictly-preordered-sets.lagda.md +++ b/src/order-theory/sequences-strictly-preordered-sets.lagda.md @@ -7,9 +7,10 @@ module order-theory.sequences-strictly-preordered-sets where
Imports ```agda -open import foundation.sequences open import foundation.universe-levels +open import lists.sequences + open import order-theory.strictly-preordered-sets ``` @@ -20,7 +21,7 @@ open import order-theory.strictly-preordered-sets A {{#concept "sequence" Disambiguation="in a strictly preordered set" Agda=type-sequence-Strictly-Preordered-Set}} in a [strictly preordered set](order-theory.strictly-preordered-sets.md) is a -[sequence](foundation.sequences.md) in its underlying type. +[sequence](lists.sequences.md) in its underlying type. ## Definition diff --git a/src/order-theory/strictly-increasing-sequences-strictly-preordered-sets.lagda.md b/src/order-theory/strictly-increasing-sequences-strictly-preordered-sets.lagda.md index a0b31cef61..cbbb6a2b83 100644 --- a/src/order-theory/strictly-increasing-sequences-strictly-preordered-sets.lagda.md +++ b/src/order-theory/strictly-increasing-sequences-strictly-preordered-sets.lagda.md @@ -16,9 +16,10 @@ open import foundation.dependent-pair-types open import foundation.function-types open import foundation.identity-types open import foundation.propositions -open import foundation.sequences open import foundation.universe-levels +open import lists.sequences + open import order-theory.sequences-strictly-preordered-sets open import order-theory.strict-order-preserving-maps open import order-theory.strictly-preordered-sets diff --git a/src/ring-theory/arithmetic-sequences-semirings.lagda.md b/src/ring-theory/arithmetic-sequences-semirings.lagda.md index e8259ab286..a0273d433d 100644 --- a/src/ring-theory/arithmetic-sequences-semirings.lagda.md +++ b/src/ring-theory/arithmetic-sequences-semirings.lagda.md @@ -16,12 +16,13 @@ open import foundation.dependent-pair-types open import foundation.homotopies open import foundation.identity-types open import foundation.propositions -open import foundation.sequences open import foundation.sets open import foundation.universe-levels open import group-theory.arithmetic-sequences-semigroups +open import lists.sequences + open import ring-theory.semirings ``` diff --git a/src/ring-theory/arithmetic-series-semirings.lagda.md b/src/ring-theory/arithmetic-series-semirings.lagda.md index c36e5d0e8d..8ccd0fdc53 100644 --- a/src/ring-theory/arithmetic-series-semirings.lagda.md +++ b/src/ring-theory/arithmetic-series-semirings.lagda.md @@ -32,9 +32,8 @@ open import ring-theory.sums-of-finite-sequences-of-elements-semirings An {{#concept "arithmetic series" Disambiguation="in a semiring" Agda=seq-sum-arithmetic-sequence-Semiring}} -in a [semiring](ring-theory.semirings.md) is the -[sequence](foundation.sequences.md) of -[partial sums](ring-theory.partial-sums-sequences-semirings.md) +in a [semiring](ring-theory.semirings.md) is the [sequence](lists.sequences.md) +of [partial sums](ring-theory.partial-sums-sequences-semirings.md) ```text n ↦ Σ (k ≤ n) (u k) diff --git a/src/ring-theory/geometric-sequences-semirings.lagda.md b/src/ring-theory/geometric-sequences-semirings.lagda.md index 384e558179..2b0107a2db 100644 --- a/src/ring-theory/geometric-sequences-semirings.lagda.md +++ b/src/ring-theory/geometric-sequences-semirings.lagda.md @@ -16,12 +16,13 @@ open import foundation.dependent-pair-types open import foundation.homotopies open import foundation.identity-types open import foundation.propositions -open import foundation.sequences open import foundation.sets open import foundation.universe-levels open import group-theory.arithmetic-sequences-semigroups +open import lists.sequences + open import ring-theory.powers-of-elements-semirings open import ring-theory.semirings ``` diff --git a/src/ring-theory/partial-sums-sequences-semirings.lagda.md b/src/ring-theory/partial-sums-sequences-semirings.lagda.md index 0c0edb66d3..6b79628381 100644 --- a/src/ring-theory/partial-sums-sequences-semirings.lagda.md +++ b/src/ring-theory/partial-sums-sequences-semirings.lagda.md @@ -11,10 +11,10 @@ open import elementary-number-theory.natural-numbers open import foundation.homotopies open import foundation.identity-types -open import foundation.sequences open import foundation.universe-levels open import lists.finite-sequences +open import lists.sequences open import ring-theory.semirings open import ring-theory.sums-of-finite-sequences-of-elements-semirings @@ -26,7 +26,7 @@ open import ring-theory.sums-of-finite-sequences-of-elements-semirings The {{#concept "sequence of partial sums" Disambiguation="of a sequence in a semiring" Agda=seq-sum-sequence-Semiring}} -of a [sequence](foundation.sequences.md) `u` in a +of a [sequence](lists.sequences.md) `u` in a [semiring](ring-theory.semirings.md) is the sequence of sums of terms of `u`: ```text diff --git a/src/set-theory/baire-space.lagda.md b/src/set-theory/baire-space.lagda.md index 8ca4b8d72d..1d9a68ef9a 100644 --- a/src/set-theory/baire-space.lagda.md +++ b/src/set-theory/baire-space.lagda.md @@ -37,7 +37,7 @@ The {{#concept "Baire space" Disambiguation="as a type" Agda=baire-space WD="Baire space" WDID=Q803936}} is the [set](foundation-core.sets.md) of [functions](foundation-core.function-types.md) `ℕ → ℕ`. In other words, it is -the set of infinite [sequences](foundation.sequences.md) of +the set of infinite [sequences](lists.sequences.md) of [natural numbers](elementary-number-theory.natural-numbers.md). ## Definition diff --git a/src/set-theory/cantor-space.lagda.md b/src/set-theory/cantor-space.lagda.md index 41ea6e9e47..f30c9ef25e 100644 --- a/src/set-theory/cantor-space.lagda.md +++ b/src/set-theory/cantor-space.lagda.md @@ -37,8 +37,7 @@ The {{#concept "Cantor space" Disambiguation="as a type" Agda=cantor-space WD="Cantor space" WDID=Q616653}} is the [set](foundation-core.sets.md) of [functions](foundation-core.function-types.md) `ℕ → Fin 2`. In other words, it -is the set of [binary](foundation.booleans.md) -[sequences](foundation.sequences.md). +is the set of [binary](foundation.booleans.md) [sequences](lists.sequences.md). ## Definition diff --git a/src/set-theory/cantors-diagonal-argument.lagda.md b/src/set-theory/cantors-diagonal-argument.lagda.md index 083b3aff85..f3588a5a8c 100644 --- a/src/set-theory/cantors-diagonal-argument.lagda.md +++ b/src/set-theory/cantors-diagonal-argument.lagda.md @@ -46,8 +46,8 @@ open import set-theory.uncountable-sets {{#concept "Cantor's diagonal argument" Agda=diagonal-argument-Cantor WD="Cantor's diagonal argument" WDID=Q729471}} is the argument Georg Cantor used to establish that -[sets](foundation-core.sets.md) of infinite [sequences](foundation.sequences.md) -of elements from a ([discrete](foundation-core.discrete-types.md)) set with +[sets](foundation-core.sets.md) of infinite [sequences](lists.sequences.md) of +elements from a ([discrete](foundation-core.discrete-types.md)) set with [two distinct elements](foundation.pairs-of-distinct-elements.md) are [uncountable](set-theory.uncountable-sets.md). The argument first appeared in {{#cite Cantor1890/91}}. Although it is not the first uncountability argument to diff --git a/src/set-theory/countable-sets.lagda.md b/src/set-theory/countable-sets.lagda.md index 3120ed2ef1..b501136f9e 100644 --- a/src/set-theory/countable-sets.lagda.md +++ b/src/set-theory/countable-sets.lagda.md @@ -37,7 +37,6 @@ open import foundation.propositions open import foundation.raising-universe-levels open import foundation.retracts-of-types open import foundation.sets -open import foundation.shifting-sequences open import foundation.subtypes open import foundation.surjective-maps open import foundation.unit-type @@ -47,6 +46,8 @@ open import foundation-core.cartesian-product-types open import foundation-core.fibers-of-maps open import foundation-core.identity-types +open import lists.shifting-sequences + open import univalent-combinatorics.standard-finite-types ``` diff --git a/src/synthetic-homotopy-theory/cocones-under-sequential-diagrams.lagda.md b/src/synthetic-homotopy-theory/cocones-under-sequential-diagrams.lagda.md index ca4adb47b0..91c53f0aa9 100644 --- a/src/synthetic-homotopy-theory/cocones-under-sequential-diagrams.lagda.md +++ b/src/synthetic-homotopy-theory/cocones-under-sequential-diagrams.lagda.md @@ -99,7 +99,7 @@ module _ ### Homotopies of cocones under a sequential diagram A **homotopy** between two cocones `(X, i, H)` and `(X, j, L)` with the same -vertex consists of a [sequence](foundation.dependent-sequences.md) of +vertex consists of a [sequence](lists.dependent-sequences.md) of [homotopies](foundation.homotopies.md) `Kₙ : iₙ ~ jₙ` and a coherence datum filling the "pinched cylinder" with the faces `Kₙ`, `Hₙ`, `Lₙ` and `Kₙ₊₁`. diff --git a/src/synthetic-homotopy-theory/connective-prespectra.lagda.md b/src/synthetic-homotopy-theory/connective-prespectra.lagda.md index db0ebe5577..49b80d0e87 100644 --- a/src/synthetic-homotopy-theory/connective-prespectra.lagda.md +++ b/src/synthetic-homotopy-theory/connective-prespectra.lagda.md @@ -34,7 +34,7 @@ open import synthetic-homotopy-theory.suspensions-of-types A [prespectrum](synthetic-homotopy-theory.prespectra.md) is {{#concept "connective" Disambiguation="prespectrum" Agda=is-connective-Prespectrum}} -if the $n$th type in the [sequence](foundation.sequences.md) is +if the $n$th type in the [sequence](lists.sequences.md) is $n$-[connected](foundation.connected-types.md). ### The predicate on prespectra of being connective diff --git a/src/synthetic-homotopy-theory/connective-spectra.lagda.md b/src/synthetic-homotopy-theory/connective-spectra.lagda.md index 939ec9243c..eeb58ff2b4 100644 --- a/src/synthetic-homotopy-theory/connective-spectra.lagda.md +++ b/src/synthetic-homotopy-theory/connective-spectra.lagda.md @@ -38,7 +38,7 @@ A [spectrum](synthetic-homotopy-theory.spectra.md) is {{#concept "connective" Disambiguation="spectrum" Agda=is-connective-Spectrum}} if the underlying [prespectrum](synthetic-homotopy-theory.prespectra.md) is [connective](synthetic-homotopy-theory.connective-prespectra.md). I.e., if the -$n$th type in the [sequence](foundation.sequences.md) is +$n$th type in the [sequence](lists.sequences.md) is $n$-[connected](foundation.connected-types.md) for all $n$. ### The predicate on spectra of being connective diff --git a/src/synthetic-homotopy-theory/dependent-cocones-under-sequential-diagrams.lagda.md b/src/synthetic-homotopy-theory/dependent-cocones-under-sequential-diagrams.lagda.md index debb9262d7..42ad11e399 100644 --- a/src/synthetic-homotopy-theory/dependent-cocones-under-sequential-diagrams.lagda.md +++ b/src/synthetic-homotopy-theory/dependent-cocones-under-sequential-diagrams.lagda.md @@ -46,8 +46,8 @@ _dependent_ cocones on `P` over `c`. A **dependent cocone under a [sequential diagram](synthetic-homotopy-theory.sequential-diagrams.md)** on `P` -over `c ≐ (X, i, H)` consists of a [sequence](foundation.dependent-sequences.md) -of dependent maps `i'ₙ : (x : Aₙ) → P (iₙ x)` and a sequence of +over `c ≐ (X, i, H)` consists of a [sequence](lists.dependent-sequences.md) of +dependent maps `i'ₙ : (x : Aₙ) → P (iₙ x)` and a sequence of [dependent homotopies](foundation.dependent-homotopies.md) `H'ₙ : i'ₙ ~ i'ₙ₊₁ ∘ aₙ` over `H`. diff --git a/src/synthetic-homotopy-theory/dependent-sequential-diagrams.lagda.md b/src/synthetic-homotopy-theory/dependent-sequential-diagrams.lagda.md index 36c7fc52eb..2677eb5ca2 100644 --- a/src/synthetic-homotopy-theory/dependent-sequential-diagrams.lagda.md +++ b/src/synthetic-homotopy-theory/dependent-sequential-diagrams.lagda.md @@ -23,7 +23,7 @@ open import synthetic-homotopy-theory.sequential-diagrams A **dependent sequential diagram** over a [sequential diagram](synthetic-homotopy-theory.sequential-diagrams.md) `(A, a)` -is a [sequence](foundation.dependent-sequences.md) of families of types +is a [sequence](lists.dependent-sequences.md) of families of types `B : (n : ℕ) → Aₙ → 𝒰` over the types in the base sequential diagram, equipped with fiberwise maps @@ -104,9 +104,8 @@ module _ ### Sections of dependent sequential diagrams A **section of a dependent sequential diagram** `(B, b)` is a -[sequence](foundation.dependent-sequences.md) of sections -`sₙ : (x : Aₙ) → Bₙ(x)` satisfying the naturality condition that all squares of -the form +[sequence](lists.dependent-sequences.md) of sections `sₙ : (x : Aₙ) → Bₙ(x)` +satisfying the naturality condition that all squares of the form ```text bₙ(x) diff --git a/src/synthetic-homotopy-theory/equivalences-sequential-diagrams.lagda.md b/src/synthetic-homotopy-theory/equivalences-sequential-diagrams.lagda.md index b82afe8957..e2ee70a5fc 100644 --- a/src/synthetic-homotopy-theory/equivalences-sequential-diagrams.lagda.md +++ b/src/synthetic-homotopy-theory/equivalences-sequential-diagrams.lagda.md @@ -33,7 +33,7 @@ open import synthetic-homotopy-theory.sequential-diagrams ## Idea An **equivalence of sequential diagrams** `(A, a)` and `(B, b)` is a -[sequence](foundation.dependent-sequences.md) of +[sequence](lists.dependent-sequences.md) of [equivalences](foundation.equivalences.md) `eₙ : Aₙ ≃ Bₙ` such that their underlying maps form a [morphism of sequential diagrams](synthetic-homotopy-theory.morphisms-sequential-diagrams.md). diff --git a/src/synthetic-homotopy-theory/homotopy-groups.lagda.md b/src/synthetic-homotopy-theory/homotopy-groups.lagda.md index e6f739ed10..aecd33cc9b 100644 --- a/src/synthetic-homotopy-theory/homotopy-groups.lagda.md +++ b/src/synthetic-homotopy-theory/homotopy-groups.lagda.md @@ -31,8 +31,7 @@ open import synthetic-homotopy-theory.iterated-loop-spaces The {{#concept "(abstract) homotopy groups" Disambiguation="of a pointed type"}} of a [pointed type](structured-types.pointed-types.md) `A` are a -[sequence](foundation.sequences.md) `i ↦ πᵢ A` of [sets](foundation.sets.md) -where +[sequence](lists.sequences.md) `i ↦ πᵢ A` of [sets](foundation.sets.md) where - `π₀ A` is the set of [connected components](foundation.connected-components.md) of `A`, and diff --git a/src/synthetic-homotopy-theory/maps-of-prespectra.lagda.md b/src/synthetic-homotopy-theory/maps-of-prespectra.lagda.md index 4f3e139b27..5cbc0e0b19 100644 --- a/src/synthetic-homotopy-theory/maps-of-prespectra.lagda.md +++ b/src/synthetic-homotopy-theory/maps-of-prespectra.lagda.md @@ -32,7 +32,7 @@ open import synthetic-homotopy-theory.prespectra A {{#concept "map" Disambiguation="of prespectra" Agda=map-Prespectrum}} of [prespectra](synthetic-homotopy-theory.prespectra.md) `f : A → B` is a -[sequence](foundation.dependent-sequences.md) of +[sequence](lists.dependent-sequences.md) of [pointed maps](structured-types.pointed-maps.md) ```text diff --git a/src/synthetic-homotopy-theory/morphisms-sequential-diagrams.lagda.md b/src/synthetic-homotopy-theory/morphisms-sequential-diagrams.lagda.md index a094834153..ea261ae9dd 100644 --- a/src/synthetic-homotopy-theory/morphisms-sequential-diagrams.lagda.md +++ b/src/synthetic-homotopy-theory/morphisms-sequential-diagrams.lagda.md @@ -35,7 +35,7 @@ open import synthetic-homotopy-theory.sequential-diagrams A **morphism between [sequential diagrams](synthetic-homotopy-theory.sequential-diagrams.md)** -`f : (A, a) → (B, b)` is a [sequence](foundation.dependent-sequences.md) of maps +`f : (A, a) → (B, b)` is a [sequence](lists.dependent-sequences.md) of maps `fₙ : Aₙ → Bₙ` satisfying the naturality condition that all squares of the form ```text @@ -153,7 +153,7 @@ module _ ### Homotopies between morphisms of sequential diagrams A **homotopy** between morphisms `f, g : (A, a) → (B, b)` consists of a -[sequence](foundation.dependent-sequences.md) of +[sequence](lists.dependent-sequences.md) of [homotopies](foundation.homotopies.md) `Hₙ : fₙ ~ gₙ` and a coherence datum filling the cylinders diff --git a/src/synthetic-homotopy-theory/prespectra.lagda.md b/src/synthetic-homotopy-theory/prespectra.lagda.md index b4318725d3..b8a9780e4b 100644 --- a/src/synthetic-homotopy-theory/prespectra.lagda.md +++ b/src/synthetic-homotopy-theory/prespectra.lagda.md @@ -26,7 +26,7 @@ open import synthetic-homotopy-theory.universal-property-suspensions-of-pointed- ## Idea -A **prespectrum** is a [sequence](foundation.sequences.md) of +A **prespectrum** is a [sequence](lists.sequences.md) of [pointed types](structured-types.pointed-types.md) `Aₙ` [equipped](foundation.structure.md) with [pointed maps](structured-types.pointed-maps.md) diff --git a/src/synthetic-homotopy-theory/sequential-diagrams.lagda.md b/src/synthetic-homotopy-theory/sequential-diagrams.lagda.md index 44b7e094cb..43b5fcf539 100644 --- a/src/synthetic-homotopy-theory/sequential-diagrams.lagda.md +++ b/src/synthetic-homotopy-theory/sequential-diagrams.lagda.md @@ -19,8 +19,8 @@ open import foundation.universe-levels ## Idea -A **sequential diagram** `(A, a)` is a [sequence](foundation.sequences.md) of -types `A : ℕ → 𝒰` over the natural numbers, equipped with a family of maps +A **sequential diagram** `(A, a)` is a [sequence](lists.sequences.md) of types +`A : ℕ → 𝒰` over the natural numbers, equipped with a family of maps `aₙ : Aₙ → Aₙ₊₁` for all `n`. They can be represented by diagrams diff --git a/src/synthetic-homotopy-theory/spectra.lagda.md b/src/synthetic-homotopy-theory/spectra.lagda.md index ba8278a8ec..b3534a3c0a 100644 --- a/src/synthetic-homotopy-theory/spectra.lagda.md +++ b/src/synthetic-homotopy-theory/spectra.lagda.md @@ -30,7 +30,7 @@ open import synthetic-homotopy-theory.suspensions-of-types ## Idea -A **spectrum** is a [sequence](foundation.sequences.md) of +A **spectrum** is a [sequence](lists.sequences.md) of [pointed types](structured-types.pointed-types.md) `A` equipped with an equivalence diff --git a/src/synthetic-homotopy-theory/suspension-prespectra.lagda.md b/src/synthetic-homotopy-theory/suspension-prespectra.lagda.md index 54a0453fb9..1ec11abbe5 100644 --- a/src/synthetic-homotopy-theory/suspension-prespectra.lagda.md +++ b/src/synthetic-homotopy-theory/suspension-prespectra.lagda.md @@ -27,7 +27,7 @@ open import synthetic-homotopy-theory.universal-property-suspensions-of-pointed- ## Idea Given a [pointed type](structured-types.pointed-types.md) `A`, the -[sequence](foundation.sequences.md) of +[sequence](lists.sequences.md) of [iterated suspensions](synthetic-homotopy-theory.iterated-suspensions-of-pointed-types.md) of `A` diff --git a/src/univalent-combinatorics/sequences-finite-types.lagda.md b/src/univalent-combinatorics/sequences-finite-types.lagda.md index 5c6f8ce478..aa9ed385fc 100644 --- a/src/univalent-combinatorics/sequences-finite-types.lagda.md +++ b/src/univalent-combinatorics/sequences-finite-types.lagda.md @@ -22,11 +22,12 @@ open import foundation.injective-maps open import foundation.negated-equality open import foundation.pairs-of-distinct-elements open import foundation.repetitions-of-values -open import foundation.repetitions-sequences -open import foundation.sequences open import foundation.sets open import foundation.universe-levels +open import lists.repetitions-sequences +open import lists.sequences + open import univalent-combinatorics.counting open import univalent-combinatorics.equality-standard-finite-types open import univalent-combinatorics.pigeonhole-principle diff --git a/src/univalent-combinatorics/subfinite-indexing.lagda.md b/src/univalent-combinatorics/subfinite-indexing.lagda.md index 4be08e1dd4..9edf3ff63a 100644 --- a/src/univalent-combinatorics/subfinite-indexing.lagda.md +++ b/src/univalent-combinatorics/subfinite-indexing.lagda.md @@ -302,11 +302,11 @@ $f : X ↪ X$ be an arbitrary self-embedding. To conclude $f$ is an surjective, so we want to show that given an arbitrary $x : X$ there exists a $z : X$ such that $x = f(z)$. -The mapping $i ↦ fⁱ(x)$ defines a [sequence](foundation.sequences.md) of -elements of $X$. By surjectivity of $h$ each $fⁱ(x)$ merely has a representative -in $D$, so by [finite choice](univalent-combinatorics.finite-choice.md) there -exists a [finite sequence](lists.finite-sequences.md) -$y₋ : \operatorname{Fin}n → D$ lifting $x,f(x),…,f^{n-1}(x)$. +The mapping $i ↦ fⁱ(x)$ defines a [sequence](lists.sequences.md) of elements of +$X$. By surjectivity of $h$ each $fⁱ(x)$ merely has a representative in $D$, so +by [finite choice](univalent-combinatorics.finite-choice.md) there exists a +[finite sequence](lists.finite-sequences.md) $y₋ : \operatorname{Fin}n → D$ +lifting $x,f(x),…,f^{n-1}(x)$. Now, the [pigeonhole principle](univalent-combinatorics.pigeonhole-principle.md) applies to $\operatorname{Fin}n$, so there has to be $i < j$ in From 2ad5af0df938f7d961d8140363cbaa68b9b0865b Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sat, 30 Aug 2025 17:30:59 +0200 Subject: [PATCH 30/97] Finitely enumerable types are Dedekind finite (#1505) and inequality of cardinality of kuratowski finite sets is antisymmetric. --- src/set-theory/cardinalities.lagda.md | 13 ++-- .../finitely-enumerable-types.lagda.md | 68 +++++++++++++++++++ .../kuratowski-finite-sets.lagda.md | 45 +++++++++++- .../subfinitely-enumerable-types.lagda.md | 6 ++ 4 files changed, 126 insertions(+), 6 deletions(-) diff --git a/src/set-theory/cardinalities.lagda.md b/src/set-theory/cardinalities.lagda.md index 0ab8653a6f..26956dc000 100644 --- a/src/set-theory/cardinalities.lagda.md +++ b/src/set-theory/cardinalities.lagda.md @@ -176,6 +176,11 @@ is-effective-cardinality : is-effective-cardinality X Y = ( equiv-trunc-Prop (extensionality-Set X Y)) ∘e ( is-effective-unit-trunc-Set (Set _) X Y) + +eq-mere-equiv-cardinality : + {l : Level} (X Y : Set l) → + mere-equiv (type-Set X) (type-Set Y) → cardinality X = cardinality Y +eq-mere-equiv-cardinality X Y = map-inv-equiv (is-effective-cardinality X Y) ``` ### Assuming excluded middle we can show that `leq-cardinality` is a partial order @@ -206,10 +211,10 @@ antisymmetric-leq-cardinality {l1} X Y lem = ( leq-cardinality v (cardinality a)) ( Id-Prop (cardinal-Set l1) (cardinality a) v)))) ( λ b a Date: Sat, 30 Aug 2025 08:36:55 -0700 Subject: [PATCH 31/97] Suprema and infima of families of real numbers (#1504) As alluded to by nLab, constructive analysis often requires a definition of suprema and infima that is stronger than the least-upper-bound property. This introduces that stronger definition. --- ...reatest-lower-bounds-large-posets.lagda.md | 45 +++ src/real-numbers.lagda.md | 3 + .../absolute-value-real-numbers.lagda.md | 1 + .../infima-families-real-numbers.lagda.md | 334 ++++++++++++++++++ .../maximum-real-numbers.lagda.md | 81 ++++- .../minimum-real-numbers.lagda.md | 108 +++++- .../rational-real-numbers.lagda.md | 4 + .../strict-inequality-real-numbers.lagda.md | 59 +++- .../subsets-real-numbers.lagda.md | 49 +++ .../suprema-families-real-numbers.lagda.md | 238 +++++++++++++ 10 files changed, 890 insertions(+), 32 deletions(-) create mode 100644 src/real-numbers/infima-families-real-numbers.lagda.md create mode 100644 src/real-numbers/subsets-real-numbers.lagda.md create mode 100644 src/real-numbers/suprema-families-real-numbers.lagda.md diff --git a/src/order-theory/greatest-lower-bounds-large-posets.lagda.md b/src/order-theory/greatest-lower-bounds-large-posets.lagda.md index c7a54580f2..5014fb3ef1 100644 --- a/src/order-theory/greatest-lower-bounds-large-posets.lagda.md +++ b/src/order-theory/greatest-lower-bounds-large-posets.lagda.md @@ -7,12 +7,14 @@ module order-theory.greatest-lower-bounds-large-posets where
Imports ```agda +open import foundation.dependent-pair-types open import foundation.logical-equivalences open import foundation.universe-levels open import order-theory.dependent-products-large-posets open import order-theory.large-posets open import order-theory.lower-bounds-large-posets +open import order-theory.similarity-of-elements-large-posets ```
@@ -175,3 +177,46 @@ module _ by iff-Π-iff-family (λ i → H i (y i)) ``` + +### Greatest lower bounds of families of elements are lower bounds + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} + (P : Large-Poset α β) + {l1 l2 : Level} {I : UU l1} {x : I → type-Large-Poset P l2} + where + + is-lower-bound-is-greatest-lower-bound-family-of-elements-Large-Poset : + {l3 : Level} {y : type-Large-Poset P l3} → + is-greatest-lower-bound-family-of-elements-Large-Poset P x y → + is-lower-bound-family-of-elements-Large-Poset P x y + is-lower-bound-is-greatest-lower-bound-family-of-elements-Large-Poset H = + backward-implication (H _) (refl-leq-Large-Poset P _) +``` + +### Greatest lower bounds of families of elements are unique up to similarity of elements + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} + (P : Large-Poset α β) + {l1 l2 : Level} {I : UU l1} {x : I → type-Large-Poset P l2} + where + + sim-is-greatest-lower-bound-family-of-elements-Large-Poset : + {l3 l4 : Level} {y : type-Large-Poset P l3} {z : type-Large-Poset P l4} → + is-greatest-lower-bound-family-of-elements-Large-Poset P x y → + is-greatest-lower-bound-family-of-elements-Large-Poset P x z → + sim-Large-Poset P y z + pr1 (sim-is-greatest-lower-bound-family-of-elements-Large-Poset H K) = + forward-implication + ( K _) + ( is-lower-bound-is-greatest-lower-bound-family-of-elements-Large-Poset + P H) + pr2 (sim-is-greatest-lower-bound-family-of-elements-Large-Poset H K) = + forward-implication + ( H _) + ( is-lower-bound-is-greatest-lower-bound-family-of-elements-Large-Poset + P K) +``` diff --git a/src/real-numbers.lagda.md b/src/real-numbers.lagda.md index e463a15bca..7fc4654d36 100644 --- a/src/real-numbers.lagda.md +++ b/src/real-numbers.lagda.md @@ -18,6 +18,7 @@ open import real-numbers.distance-real-numbers public open import real-numbers.inequality-lower-dedekind-real-numbers public open import real-numbers.inequality-real-numbers public open import real-numbers.inequality-upper-dedekind-real-numbers public +open import real-numbers.infima-families-real-numbers public open import real-numbers.isometry-addition-real-numbers public open import real-numbers.isometry-negation-real-numbers public open import real-numbers.lower-dedekind-real-numbers public @@ -40,6 +41,8 @@ open import real-numbers.real-numbers-from-lower-dedekind-real-numbers public open import real-numbers.real-numbers-from-upper-dedekind-real-numbers public open import real-numbers.similarity-real-numbers public open import real-numbers.strict-inequality-real-numbers public +open import real-numbers.subsets-real-numbers public +open import real-numbers.suprema-families-real-numbers public open import real-numbers.transposition-addition-subtraction-cuts-dedekind-real-numbers public open import real-numbers.upper-dedekind-real-numbers public ``` diff --git a/src/real-numbers/absolute-value-real-numbers.lagda.md b/src/real-numbers/absolute-value-real-numbers.lagda.md index cd18c3e3d4..b03b295ecb 100644 --- a/src/real-numbers/absolute-value-real-numbers.lagda.md +++ b/src/real-numbers/absolute-value-real-numbers.lagda.md @@ -74,6 +74,7 @@ opaque opaque unfolding abs-ℝ unfolding neg-ℚ + unfolding max-ℝ is-nonnegative-abs-ℝ : {l : Level} → (x : ℝ l) → is-nonnegative-ℝ (abs-ℝ x) is-nonnegative-abs-ℝ x q q<0 = diff --git a/src/real-numbers/infima-families-real-numbers.lagda.md b/src/real-numbers/infima-families-real-numbers.lagda.md new file mode 100644 index 0000000000..0ec835a0de --- /dev/null +++ b/src/real-numbers/infima-families-real-numbers.lagda.md @@ -0,0 +1,334 @@ +# Infima of families of real numbers + +```agda +{-# OPTIONS --lossy-unification #-} + +module real-numbers.infima-families-real-numbers where +``` + +
Imports + +```agda +open import elementary-number-theory.positive-rational-numbers + +open import foundation.binary-transport +open import foundation.conjunction +open import foundation.dependent-pair-types +open import foundation.empty-types +open import foundation.existential-quantification +open import foundation.function-types +open import foundation.identity-types +open import foundation.logical-equivalences +open import foundation.propositional-truncations +open import foundation.propositions +open import foundation.subtypes +open import foundation.transport-along-identifications +open import foundation.universe-levels + +open import logic.functoriality-existential-quantification + +open import order-theory.greatest-lower-bounds-large-posets +open import order-theory.lower-bounds-large-posets +open import order-theory.upper-bounds-large-posets + +open import real-numbers.addition-real-numbers +open import real-numbers.dedekind-real-numbers +open import real-numbers.difference-real-numbers +open import real-numbers.inequality-real-numbers +open import real-numbers.negation-real-numbers +open import real-numbers.positive-real-numbers +open import real-numbers.rational-real-numbers +open import real-numbers.similarity-real-numbers +open import real-numbers.strict-inequality-real-numbers +open import real-numbers.subsets-real-numbers +open import real-numbers.suprema-families-real-numbers +``` + +
+ +## Idea + +A [real number](real-numbers.dedekind-real-numbers.md) `x` is the +{{#concept "infimum" disambiguation="of a set of real numbers" Agda=is-infimum-family-ℝ WD="infimum" WDID=Q1199948}} +of a family `y` of real numbers indexed by `I` if `x` is a +[lower bound](order-theory.lower-bounds-large-posets.md) of `y` in the +[large poset of real numbers](real-numbers.inequality-real-numbers.md) and `x` +is approximated above by the `yᵢ`: for all `ε : ℚ⁺`, there +[exists](foundation.existential-quantification.md) an `i : I` such that +`yᵢ < x + ε`. + +Classically, infima and +[greatest lower bounds](order-theory.greatest-lower-bounds-large-posets.md) are +equivalent, but constructively being an infimum is a stronger condition, often +required for constructive analysis. + +## Definition + +### Infima of families of real numbers + +```agda +module _ + {l1 l2 : Level} {I : UU l1} (y : I → ℝ l2) + where + + is-approximated-above-prop-family-ℝ : + {l3 : Level} → ℝ l3 → Prop (l1 ⊔ l2 ⊔ l3) + is-approximated-above-prop-family-ℝ x = + Π-Prop + ( ℚ⁺) + ( λ ε → ∃ I (λ i → le-ℝ-Prop (y i) (x +ℝ real-ℚ⁺ ε))) + + is-approximated-above-family-ℝ : {l3 : Level} → ℝ l3 → UU (l1 ⊔ l2 ⊔ l3) + is-approximated-above-family-ℝ x = + type-Prop (is-approximated-above-prop-family-ℝ x) + + is-infimum-prop-family-ℝ : {l3 : Level} → ℝ l3 → Prop (l1 ⊔ l2 ⊔ l3) + is-infimum-prop-family-ℝ x = + is-lower-bound-prop-family-of-elements-Large-Poset + ( ℝ-Large-Poset) + ( y) + ( x) ∧ + is-approximated-above-prop-family-ℝ x + + is-infimum-family-ℝ : {l3 : Level} → ℝ l3 → UU (l1 ⊔ l2 ⊔ l3) + is-infimum-family-ℝ x = type-Prop (is-infimum-prop-family-ℝ x) + + is-lower-bound-is-infimum-family-ℝ : + {l3 : Level} → (x : ℝ l3) → is-infimum-family-ℝ x → + is-lower-bound-family-of-elements-Large-Poset ℝ-Large-Poset y x + is-lower-bound-is-infimum-family-ℝ _ = pr1 + + is-approximated-above-is-infimum-family-ℝ : + {l3 : Level} → (x : ℝ l3) → is-infimum-family-ℝ x → + is-approximated-above-family-ℝ x + is-approximated-above-is-infimum-family-ℝ _ = pr2 +``` + +### Infima of subsets of real numbers + +```agda +module _ + {l1 l2 : Level} (S : subset-ℝ l1 l2) where + + is-infimum-prop-subset-ℝ : + {l3 : Level} → ℝ l3 → Prop (l1 ⊔ lsuc l2 ⊔ l3) + is-infimum-prop-subset-ℝ = + is-infimum-prop-family-ℝ (inclusion-subset-ℝ S) + + is-infimum-subset-ℝ : {l3 : Level} → ℝ l3 → UU (l1 ⊔ lsuc l2 ⊔ l3) + is-infimum-subset-ℝ x = type-Prop (is-infimum-prop-subset-ℝ x) +``` + +## Properties + +### An infimum is a greatest lower bound + +```agda +module _ + {l1 l2 l3 : Level} {I : UU l1} (y : I → ℝ l2) (x : ℝ l3) + (is-infimum-x-yᵢ : is-infimum-family-ℝ y x) + where + + abstract + is-greatest-lower-bound-is-infimum-family-ℝ : + is-greatest-lower-bound-family-of-elements-Large-Poset + ( ℝ-Large-Poset) + ( y) + ( x) + pr1 (is-greatest-lower-bound-is-infimum-family-ℝ z) z≤yᵢ = + leq-not-le-ℝ x z + ( λ xImports ```agda +open import elementary-number-theory.positive-rational-numbers + open import foundation.dependent-pair-types open import foundation.disjunction open import foundation.empty-types +open import foundation.logical-equivalences +open import foundation.propositional-truncations open import foundation.propositions open import foundation.universe-levels open import order-theory.greatest-lower-bounds-large-posets open import order-theory.large-meet-semilattices +open import real-numbers.addition-real-numbers open import real-numbers.dedekind-real-numbers open import real-numbers.inequality-real-numbers open import real-numbers.lower-dedekind-real-numbers open import real-numbers.minimum-lower-dedekind-real-numbers open import real-numbers.minimum-upper-dedekind-real-numbers +open import real-numbers.positive-real-numbers +open import real-numbers.rational-real-numbers +open import real-numbers.strict-inequality-real-numbers open import real-numbers.upper-dedekind-real-numbers ``` @@ -79,13 +87,14 @@ module _ cut-lower-ℝ lower-real-min-ℝ p ∨ cut-upper-ℝ upper-real-min-ℝ q - min-ℝ : ℝ (l1 ⊔ l2) - min-ℝ = - real-lower-upper-ℝ - ( lower-real-min-ℝ) - ( upper-real-min-ℝ) - ( is-disjoint-lower-upper-min-ℝ) - ( is-located-lower-upper-min-ℝ) + opaque + min-ℝ : ℝ (l1 ⊔ l2) + min-ℝ = + real-lower-upper-ℝ + ( lower-real-min-ℝ) + ( upper-real-min-ℝ) + ( is-disjoint-lower-upper-min-ℝ) + ( is-located-lower-upper-min-ℝ) ``` ## Properties @@ -98,17 +107,26 @@ module _ (x : ℝ l1) (y : ℝ l2) where - is-greatest-binary-lower-bound-min-ℝ : - is-greatest-binary-lower-bound-Large-Poset - ( ℝ-Large-Poset) - ( x) - ( y) - ( min-ℝ x y) - is-greatest-binary-lower-bound-min-ℝ z = - is-greatest-binary-lower-bound-binary-min-lower-ℝ - ( lower-real-ℝ x) - ( lower-real-ℝ y) - ( lower-real-ℝ z) + opaque + unfolding min-ℝ + + is-greatest-binary-lower-bound-min-ℝ : + is-greatest-binary-lower-bound-Large-Poset + ( ℝ-Large-Poset) + ( x) + ( y) + ( min-ℝ x y) + is-greatest-binary-lower-bound-min-ℝ z = + is-greatest-binary-lower-bound-binary-min-lower-ℝ + ( lower-real-ℝ x) + ( lower-real-ℝ y) + ( lower-real-ℝ z) + + abstract + leq-min-leq-leq-ℝ : + {l3 : Level} (z : ℝ l3) → leq-ℝ z x → leq-ℝ z y → leq-ℝ z (min-ℝ x y) + leq-min-leq-leq-ℝ z x≤z y≤z = + forward-implication (is-greatest-binary-lower-bound-min-ℝ z) (x≤z , y≤z) ``` ### The large poset of real numbers has meets @@ -119,3 +137,57 @@ meet-has-meets-Large-Poset has-meets-ℝ-Large-Poset = min-ℝ is-greatest-binary-lower-bound-meet-has-meets-Large-Poset has-meets-ℝ-Large-Poset = is-greatest-binary-lower-bound-min-ℝ ``` + +### For any `ε : ℚ⁺`, `(x < min-ℝ x y + ε) ∨ (y < min-ℝ x y + ε)` + +```agda +module _ + {l1 l2 : Level} (x : ℝ l1) (y : ℝ l2) + where + + abstract + approximate-above-min-ℝ : + (ε : ℚ⁺) → + type-disjunction-Prop + ( le-ℝ-Prop x (min-ℝ x y +ℝ real-ℚ⁺ ε)) + ( le-ℝ-Prop y (min-ℝ x y +ℝ real-ℚ⁺ ε)) + approximate-above-min-ℝ ε⁺@(ε , _) = + let + motive = + ( le-ℝ-Prop x (min-ℝ x y +ℝ real-ℚ ε)) ∨ + ( le-ℝ-Prop y (min-ℝ x y +ℝ real-ℚ ε)) + open do-syntax-trunc-Prop motive + in do + (r , minImports + +```agda +open import foundation.images-subtypes +open import foundation.sets +open import foundation.subtypes +open import foundation.universe-levels + +open import real-numbers.dedekind-real-numbers +``` + +
+ +## Idea + +A {{#concept "subset" Disambiguation="of the real numbers" Agda=subset-ℝ}} of +the [real numbers](real-numbers.dedekind-real-numbers.md) is a +[subtype](foundation.subtypes.md). + +## Definition + +```agda +subset-ℝ : (l1 l2 : Level) → UU (lsuc l1 ⊔ lsuc l2) +subset-ℝ l1 l2 = subtype l1 (ℝ l2) + +type-subset-ℝ : {l1 l2 : Level} → subset-ℝ l1 l2 → UU (l1 ⊔ lsuc l2) +type-subset-ℝ = type-subtype + +inclusion-subset-ℝ : + {l1 l2 : Level} → (S : subset-ℝ l1 l2) → type-subset-ℝ S → ℝ l2 +inclusion-subset-ℝ = inclusion-subtype +``` + +## Properties + +### Subsets of the real numbers are sets + +```agda +abstract + is-set-subset-ℝ : + {l1 l2 : Level} → (S : subset-ℝ l1 l2) → is-set (type-subset-ℝ S) + is-set-subset-ℝ S = is-set-type-subtype S (is-set-type-Set (ℝ-Set _)) +``` diff --git a/src/real-numbers/suprema-families-real-numbers.lagda.md b/src/real-numbers/suprema-families-real-numbers.lagda.md new file mode 100644 index 0000000000..40ce8d5ad2 --- /dev/null +++ b/src/real-numbers/suprema-families-real-numbers.lagda.md @@ -0,0 +1,238 @@ +# Suprema of families of real numbers + +```agda +{-# OPTIONS --lossy-unification #-} + +module real-numbers.suprema-families-real-numbers where +``` + +
Imports + +```agda +open import elementary-number-theory.positive-rational-numbers + +open import foundation.conjunction +open import foundation.dependent-pair-types +open import foundation.empty-types +open import foundation.existential-quantification +open import foundation.logical-equivalences +open import foundation.propositional-truncations +open import foundation.propositions +open import foundation.subtypes +open import foundation.universe-levels + +open import order-theory.least-upper-bounds-large-posets +open import order-theory.upper-bounds-large-posets + +open import real-numbers.dedekind-real-numbers +open import real-numbers.difference-real-numbers +open import real-numbers.inequality-real-numbers +open import real-numbers.positive-real-numbers +open import real-numbers.rational-real-numbers +open import real-numbers.similarity-real-numbers +open import real-numbers.strict-inequality-real-numbers +open import real-numbers.subsets-real-numbers +``` + +
+ +## Idea + +A [real number](real-numbers.dedekind-real-numbers.md) `x` is the +{{#concept "supremum" disambiguation="of a set of real numbers" Agda=is-supremum-family-ℝ WD="supremum" WDID=Q215071}} +of a family `y` of real numbers indexed by `I` if `x` is an +[upper bound](order-theory.upper-bounds-large-posets.md) of `y` in the +[large poset of real numbers](real-numbers.inequality-real-numbers.md) and `x` +is approximated below by the `yᵢ`: for all `ε : ℚ⁺`, there +[exists](foundation.existential-quantification.md) an `i : I` such that +`x - yᵢ < ε`. + +Classically, suprema and +[least upper bounds](order-theory.least-upper-bounds-large-posets.md) are +equivalent, but constructively being a supremum is a stronger condition, often +required for constructive analysis. + +## Definition + +### Suprema of families of real numbers + +```agda +module _ + {l1 l2 : Level} {I : UU l1} (y : I → ℝ l2) + where + + is-approximated-below-prop-family-ℝ : + {l3 : Level} → ℝ l3 → Prop (l1 ⊔ l2 ⊔ l3) + is-approximated-below-prop-family-ℝ x = + Π-Prop + ( ℚ⁺) + ( λ ε → ∃ I (λ i → le-ℝ-Prop (x -ℝ real-ℚ⁺ ε) (y i))) + + is-approximated-below-family-ℝ : {l3 : Level} → ℝ l3 → UU (l1 ⊔ l2 ⊔ l3) + is-approximated-below-family-ℝ x = + type-Prop (is-approximated-below-prop-family-ℝ x) + + is-supremum-prop-family-ℝ : {l3 : Level} → ℝ l3 → Prop (l1 ⊔ l2 ⊔ l3) + is-supremum-prop-family-ℝ x = + is-upper-bound-prop-family-of-elements-Large-Poset + ( ℝ-Large-Poset) + ( y) + ( x) ∧ + is-approximated-below-prop-family-ℝ x + + is-supremum-family-ℝ : {l3 : Level} → ℝ l3 → UU (l1 ⊔ l2 ⊔ l3) + is-supremum-family-ℝ x = type-Prop (is-supremum-prop-family-ℝ x) + + is-upper-bound-is-supremum-family-ℝ : + {l3 : Level} → (x : ℝ l3) → is-supremum-family-ℝ x → + is-upper-bound-family-of-elements-Large-Poset ℝ-Large-Poset y x + is-upper-bound-is-supremum-family-ℝ _ = pr1 + + is-approximated-below-is-supremum-family-ℝ : + {l3 : Level} → (x : ℝ l3) → is-supremum-family-ℝ x → + is-approximated-below-family-ℝ x + is-approximated-below-is-supremum-family-ℝ _ = pr2 +``` + +### Suprema of subsets of real numbers + +```agda +module _ + {l1 l2 : Level} (S : subset-ℝ l1 l2) where + + is-supremum-prop-subset-ℝ : + {l3 : Level} → ℝ l3 → Prop (l1 ⊔ lsuc l2 ⊔ l3) + is-supremum-prop-subset-ℝ = + is-supremum-prop-family-ℝ (inclusion-subset-ℝ S) + + is-supremum-subset-ℝ : {l3 : Level} → ℝ l3 → UU (l1 ⊔ lsuc l2 ⊔ l3) + is-supremum-subset-ℝ x = type-Prop (is-supremum-prop-subset-ℝ x) +``` + +## Properties + +### A supremum is a least upper bound + +```agda +module _ + {l1 l2 l3 : Level} {I : UU l1} (y : I → ℝ l2) (x : ℝ l3) + (is-supremum-x-yᵢ : is-supremum-family-ℝ y x) + where + + abstract + is-least-upper-bound-is-supremum-family-ℝ : + is-least-upper-bound-family-of-elements-Large-Poset + ( ℝ-Large-Poset) + ( y) + ( x) + pr1 (is-least-upper-bound-is-supremum-family-ℝ z) yᵢ≤z = + leq-not-le-ℝ z x + ( λ z Date: Sat, 30 Aug 2025 17:43:39 +0200 Subject: [PATCH 32/97] Bounded distance decompositions of metric spaces (#1482) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Given a metric space `A`, this PR introduces the bounded distance decomposition of a metric space `A`: the metric space ```agda bounded-distance-decompsition-Metric-Space : Metric-Space (l1 ⊔ l2) (l1 ⊔ l2) bounded-distance-decompsition-Metric-Space = indexed-sum-Metric-Space ( set-bounded-distance-component-Metric-Space A) ( subspace-bounded-distance-component-Metric-Space A) ``` where - `set-bounded-distance-component-Metric-Space A` is the quotient set of `A` by the equivalence relation of being at bounded distance; - `subspace-bounded-distance-component-Metric-Space A` is the subspace of elements in a given quotient class. In each subspace `subspace-bounded-distance-component-Metric-Space A X`, all elements are at bounded distance. Any metric space is isometrically equivalent to its bounded distance decomposition. The underlying equivalence is provided by the following new results for quotient sets and equivalence classes: ```agda module _ {l1 l2 : Level} {A : UU l1} (R : equivalence-relation l2 A) where equiv-total-equivalence-class : Σ (equivalence-class R) (type-subtype ∘ is-in-equivalence-class-Prop R) ≃ A equiv-total-equivalence-class = [...] equiv-total-set-quotient : Σ ( set-quotient R) ( type-subtype ∘ is-in-equivalence-class-set-quotient-Prop R) ≃ ( A) equiv-total-set-quotient = [...] ``` --- src/foundation/equivalence-classes.lagda.md | 34 +- src/foundation/set-quotients.lagda.md | 174 +++++- src/metric-spaces.lagda.md | 1 + ...e-decompositions-of-metric-spaces.lagda.md | 522 ++++++++++++++++++ ...at-bounded-distance-metric-spaces.lagda.md | 25 + .../subspaces-metric-spaces.lagda.md | 19 + 6 files changed, 765 insertions(+), 10 deletions(-) create mode 100644 src/metric-spaces/bounded-distance-decompositions-of-metric-spaces.lagda.md diff --git a/src/foundation/equivalence-classes.lagda.md b/src/foundation/equivalence-classes.lagda.md index 71954bae57..de99e886e9 100644 --- a/src/foundation/equivalence-classes.lagda.md +++ b/src/foundation/equivalence-classes.lagda.md @@ -8,11 +8,15 @@ module foundation.equivalence-classes where ```agda open import foundation.conjunction +open import foundation.contractible-types open import foundation.dependent-pair-types open import foundation.effective-maps-equivalence-relations +open import foundation.equivalences open import foundation.existential-quantification +open import foundation.function-types open import foundation.functoriality-propositional-truncation open import foundation.fundamental-theorem-of-identity-types +open import foundation.homotopies open import foundation.inhabited-subtypes open import foundation.locally-small-types open import foundation.logical-equivalences @@ -23,13 +27,13 @@ open import foundation.small-types open import foundation.subtype-identity-principle open import foundation.subtypes open import foundation.surjective-maps +open import foundation.type-arithmetic-dependent-pair-types open import foundation.universal-property-image open import foundation.universe-levels open import foundation-core.cartesian-product-types open import foundation-core.embeddings open import foundation-core.equivalence-relations -open import foundation-core.equivalences open import foundation-core.functoriality-dependent-pair-types open import foundation-core.identity-types open import foundation-core.propositions @@ -315,12 +319,13 @@ module _ ( λ D → is-in-equivalence-class-Prop R D a) ( eq-class-equivalence-class R C H) - is-torsorial-is-in-equivalence-class : - is-torsorial (λ P → is-in-equivalence-class R P a) - pr1 is-torsorial-is-in-equivalence-class = - center-total-is-in-equivalence-class - pr2 is-torsorial-is-in-equivalence-class = - contraction-total-is-in-equivalence-class + abstract + is-torsorial-is-in-equivalence-class : + is-torsorial (λ P → is-in-equivalence-class R P a) + pr1 is-torsorial-is-in-equivalence-class = + center-total-is-in-equivalence-class + pr2 is-torsorial-is-in-equivalence-class = + contraction-total-is-in-equivalence-class is-in-equivalence-class-eq-equivalence-class : (q : equivalence-class R) → class R a = q → @@ -338,6 +343,21 @@ module _ ( is-in-equivalence-class-eq-equivalence-class) ``` +### Σ-decompositions of types induced by equivalence classes + +```agda +module _ + {l1 l2 : Level} {A : UU l1} (R : equivalence-relation l2 A) + where + + equiv-total-equivalence-class : + Σ (equivalence-class R) (type-subtype ∘ is-in-equivalence-class-Prop R) ≃ A + equiv-total-equivalence-class = + ( right-unit-law-Σ-is-contr + ( is-torsorial-is-in-equivalence-class R)) ∘e + ( equiv-left-swap-Σ) +``` + ### The map `class : A → equivalence-class R` is an effective quotient map ```agda diff --git a/src/foundation/set-quotients.lagda.md b/src/foundation/set-quotients.lagda.md index 26fd53a4bf..ade9bc71ec 100644 --- a/src/foundation/set-quotients.lagda.md +++ b/src/foundation/set-quotients.lagda.md @@ -8,18 +8,29 @@ module foundation.set-quotients where ```agda open import foundation.action-on-identifications-functions +open import foundation.contractible-maps +open import foundation.contractible-types open import foundation.dependent-pair-types open import foundation.effective-maps-equivalence-relations open import foundation.embeddings +open import foundation.equality-dependent-pair-types open import foundation.equivalence-classes open import foundation.equivalences +open import foundation.fibers-of-maps open import foundation.function-extensionality +open import foundation.function-types +open import foundation.functoriality-dependent-pair-types +open import foundation.homotopies open import foundation.identity-types open import foundation.inhabited-subtypes +open import foundation.logical-equivalences open import foundation.reflecting-maps-equivalence-relations open import foundation.sets open import foundation.slice open import foundation.surjective-maps +open import foundation.torsorial-type-families +open import foundation.transport-along-identifications +open import foundation.type-arithmetic-dependent-pair-types open import foundation.uniqueness-set-quotients open import foundation.universal-property-image open import foundation.universal-property-set-quotients @@ -27,9 +38,7 @@ open import foundation.universe-levels open import foundation.whiskering-homotopies-composition open import foundation-core.equivalence-relations -open import foundation-core.function-types open import foundation-core.functoriality-dependent-function-types -open import foundation-core.homotopies open import foundation-core.propositions open import foundation-core.small-types open import foundation-core.subtypes @@ -152,7 +161,37 @@ module _ ( is-surjective-quotient-map) ``` -### The map `class : A → equivalence-class R` is an effective quotient map +## Properties + +### Any element is in the class of its quotient + +```agda +module _ + {l1 l2 : Level} {A : UU l1} (R : equivalence-relation l2 A) + (x : A) + where + + is-in-equivalence-class-quotient-map-set-quotient : + is-in-equivalence-class-set-quotient + ( R) + ( quotient-map R x) + ( x) + is-in-equivalence-class-quotient-map-set-quotient = + is-in-equivalence-class-eq-equivalence-class + ( R) + ( x) + ( equivalence-class-set-quotient R (quotient-map R x)) + ( inv + ( is-retraction-equivalence-class-set-quotient R (class R x))) + + inhabitant-equivalence-class-quotient-map-set-quotient : + type-subtype + ( subtype-set-quotient R (quotient-map R x)) + inhabitant-equivalence-class-quotient-map-set-quotient = + (x , is-in-equivalence-class-quotient-map-set-quotient) +``` + +### The map `class : A → set-quotient R` is an effective quotient map ```agda module _ @@ -417,6 +456,135 @@ module _ B f Uf ``` +### Any quotient class containing a given element `x` is equal to `quotient-map x` + +```agda +module _ + {l1 l2 : Level} {A : UU l1} (R : equivalence-relation l2 A) + where + + eq-set-quotient-equivalence-class-set-quotient : + (X : set-quotient R) {x : A} → + is-in-equivalence-class-set-quotient R X x → + quotient-map R x = X + eq-set-quotient-equivalence-class-set-quotient X {x} H = + ( ap + ( set-quotient-equivalence-class R) + ( eq-class-equivalence-class + ( R) + ( equivalence-class-set-quotient R X) + ( H))) ∙ + ( is-section-equivalence-class-set-quotient R X) +``` + +### Two quotient classes that contain similar elements are equal + +```agda +module _ + {l1 l2 : Level} {A : UU l1} (R : equivalence-relation l2 A) + where + + eq-set-quotient-sim-element-set-quotient : + (X : set-quotient R) {x : A} → + (Y : set-quotient R) {y : A} → + is-in-equivalence-class-set-quotient R X x → + is-in-equivalence-class-set-quotient R Y y → + sim-equivalence-relation R x y → + X = Y + eq-set-quotient-sim-element-set-quotient X {x} Y {y} x∈X y∈Y x~y = + ( ( inv (eq-set-quotient-equivalence-class-set-quotient R X x∈X)) ∙ + ( apply-effectiveness-quotient-map' R x~y) ∙ + ( eq-set-quotient-equivalence-class-set-quotient R Y y∈Y)) +``` + +### Two elements in the same quotient class are similar + +```agda +module _ + {l1 l2 : Level} {A : UU l1} (R : equivalence-relation l2 A) + where + + sim-is-in-equivalence-class-set-quotient : + (X : set-quotient R) {x y : A} → + is-in-equivalence-class-set-quotient R X x → + is-in-equivalence-class-set-quotient R X y → + sim-equivalence-relation R x y + sim-is-in-equivalence-class-set-quotient X {x} {y} x∈X y∈X = + apply-effectiveness-quotient-map + ( R) + ( ( eq-set-quotient-equivalence-class-set-quotient R X x∈X) ∙ + ( inv (eq-set-quotient-equivalence-class-set-quotient R X y∈X))) +``` + +### Any element in the quotient class of another is similar to it + +```agda +module _ + {l1 l2 : Level} {A : UU l1} (R : equivalence-relation l2 A) + where + + sim-is-in-equivalence-class-quotient-map-set-quotient : + (x y : A) → + is-in-equivalence-class-set-quotient + ( R) + ( quotient-map R x) + ( y) → + sim-equivalence-relation R x y + sim-is-in-equivalence-class-quotient-map-set-quotient x y = + sim-is-in-equivalence-class-set-quotient + ( R) + ( quotient-map R x) + ( is-in-equivalence-class-quotient-map-set-quotient R x) +``` + +### Σ-decompositions of types induced by set quotients + +```agda +module _ + {l1 l2 : Level} {A : UU l1} (R : equivalence-relation l2 A) + where + + abstract + is-torsorial-is-in-equivalence-class-set-quotient : + (x : A) → + is-contr + ( Σ ( set-quotient R) + ( λ X → is-in-equivalence-class-set-quotient R X x)) + is-torsorial-is-in-equivalence-class-set-quotient x = + is-contr-equiv' + ( Σ (equivalence-class R) (λ X → is-in-equivalence-class R X x)) + ( equiv-Σ + ( λ X → is-in-equivalence-class-set-quotient R X x) + ( compute-set-quotient R) + ( λ X → + equiv-iff-is-prop + ( is-prop-is-in-equivalence-class R X x) + ( is-prop-is-in-equivalence-class-set-quotient + ( R) + ( set-quotient-equivalence-class R X) + ( x)) + ( λ x∈X → + inv-tr + ( λ Y → is-in-equivalence-class R Y x) + ( is-retraction-equivalence-class-set-quotient R X) + ( x∈X)) + ( λ x∈X → + tr + ( λ Y → is-in-equivalence-class R Y x) + ( is-retraction-equivalence-class-set-quotient R X) + ( x∈X)))) + ( is-torsorial-is-in-equivalence-class R x) + + equiv-total-set-quotient : + Σ ( set-quotient R) + ( type-subtype ∘ is-in-equivalence-class-set-quotient-Prop R) ≃ + ( A) + equiv-total-set-quotient = + ( right-unit-law-Σ-is-contr + ( is-torsorial-is-in-equivalence-class-set-quotient)) ∘e + ( equiv-left-swap-Σ) +``` + ## See also - [Set coequalizers](foundation.set-coequalizers.md) for an equivalent notion diff --git a/src/metric-spaces.lagda.md b/src/metric-spaces.lagda.md index 4fb7769770..e60c82f1cd 100644 --- a/src/metric-spaces.lagda.md +++ b/src/metric-spaces.lagda.md @@ -47,6 +47,7 @@ module metric-spaces where open import metric-spaces.approximations-located-metric-spaces public open import metric-spaces.approximations-metric-spaces public +open import metric-spaces.bounded-distance-decompositions-of-metric-spaces public open import metric-spaces.cartesian-products-metric-spaces public open import metric-spaces.category-of-metric-spaces-and-isometries public open import metric-spaces.category-of-metric-spaces-and-short-functions public diff --git a/src/metric-spaces/bounded-distance-decompositions-of-metric-spaces.lagda.md b/src/metric-spaces/bounded-distance-decompositions-of-metric-spaces.lagda.md new file mode 100644 index 0000000000..ea2bf3aa07 --- /dev/null +++ b/src/metric-spaces/bounded-distance-decompositions-of-metric-spaces.lagda.md @@ -0,0 +1,522 @@ +# The bounded distance decomposition of metric spaces + +```agda +{-# OPTIONS --lossy-unification #-} + +module metric-spaces.bounded-distance-decompositions-of-metric-spaces where +``` + +
Imports + +```agda +open import elementary-number-theory.positive-rational-numbers + +open import foundation.contractible-maps +open import foundation.contractible-types +open import foundation.dependent-pair-types +open import foundation.equality-dependent-pair-types +open import foundation.equivalence-classes +open import foundation.equivalence-relations +open import foundation.equivalences +open import foundation.existential-quantification +open import foundation.function-types +open import foundation.functoriality-dependent-pair-types +open import foundation.functoriality-propositional-truncation +open import foundation.homotopies +open import foundation.identity-types +open import foundation.logical-equivalences +open import foundation.propositional-truncations +open import foundation.propositions +open import foundation.set-quotients +open import foundation.sets +open import foundation.subtypes +open import foundation.transport-along-identifications +open import foundation.universe-levels + +open import metric-spaces.cauchy-approximations-metric-spaces +open import metric-spaces.elements-at-bounded-distance-metric-spaces +open import metric-spaces.equality-of-metric-spaces +open import metric-spaces.functions-metric-spaces +open import metric-spaces.indexed-sums-metric-spaces +open import metric-spaces.isometries-metric-spaces +open import metric-spaces.metric-spaces +open import metric-spaces.subspaces-metric-spaces +``` + +
+ +## Idea + +Any [metric space](metric-spaces.metric-spaces.md) is +[isometrically equivalent](metric-spaces.equality-of-metric-spaces.md) to its +{{#concept "bounded distance decomposition" Agda=bounded-distance-decomposition-Metric-Space}}, +the [indexed sum](metric-spaces.indexed-sums-metric-spaces.md) of its +[subspaces](metric-spaces.subspaces-metric-spaces.md) of +[elements at bounded distance](metric-spaces.elements-at-bounded-distance-metric-spaces.md) +indexed by the [set quotient](foundation.set-quotients.md) of the metric space +by the [equivalence relation](foundation.equivalence-relations.md) of being at +bounded distance. + +## Definitions + +### The set of bounded distance components of a metric space + +```agda +module _ + {l1 l2 : Level} (A : Metric-Space l1 l2) + where + + set-bounded-distance-component-Metric-Space : Set (l1 ⊔ l2) + set-bounded-distance-component-Metric-Space = + quotient-Set + ( equivalence-relation-bounded-dist-Metric-Space A) + + type-bounded-distance-component-Metric-Space : UU (l1 ⊔ l2) + type-bounded-distance-component-Metric-Space = + type-Set set-bounded-distance-component-Metric-Space + + map-type-bounded-distance-component-Metric-Space : + type-Metric-Space A → + type-bounded-distance-component-Metric-Space + map-type-bounded-distance-component-Metric-Space = + quotient-map + ( equivalence-relation-bounded-dist-Metric-Space A) +``` + +### The family of metric subspaces of elements at bounded distance + +```agda +module _ + {l1 l2 : Level} (A : Metric-Space l1 l2) + (x : type-bounded-distance-component-Metric-Space A) + where + + subtype-bounded-distance-component-Metric-Space : subset-Metric-Space l2 A + subtype-bounded-distance-component-Metric-Space = + subtype-set-quotient + ( equivalence-relation-bounded-dist-Metric-Space A) + ( x) + + subspace-bounded-distance-component-Metric-Space : + Metric-Space (l1 ⊔ l2) l2 + subspace-bounded-distance-component-Metric-Space = + subspace-Metric-Space + ( A) + ( subtype-bounded-distance-component-Metric-Space) + + type-subspace-bounded-distance-component-Metric-Space : UU (l1 ⊔ l2) + type-subspace-bounded-distance-component-Metric-Space = + type-Metric-Space + subspace-bounded-distance-component-Metric-Space +``` + +### The bounded distance decomposition of a metric space + +```agda +module _ + {l1 l2 : Level} (A : Metric-Space l1 l2) + where + + bounded-distance-decomposition-Metric-Space : + Metric-Space (l1 ⊔ l2) (l1 ⊔ l2) + bounded-distance-decomposition-Metric-Space = + indexed-sum-Metric-Space + ( set-bounded-distance-component-Metric-Space A) + ( subspace-bounded-distance-component-Metric-Space A) + + type-bounded-distance-decomposition-Metric-Space : UU (l1 ⊔ l2) + type-bounded-distance-decomposition-Metric-Space = + type-Metric-Space bounded-distance-decomposition-Metric-Space +``` + +## Properties + +### All elements of a bounded distance subspace are at bounded distance + +```agda +module _ + {l1 l2 : Level} (A : Metric-Space l1 l2) + (X : type-bounded-distance-component-Metric-Space A) + where + + all-elements-at-bounded-distance-subspace-bounded-distance-component-Metric-Space : + (x y : type-subspace-bounded-distance-component-Metric-Space A X) → + bounded-dist-Metric-Space + ( subspace-bounded-distance-component-Metric-Space A X) + ( x) + ( y) + all-elements-at-bounded-distance-subspace-bounded-distance-component-Metric-Space + (x , x∈X) (y , y∈X) = + sim-is-in-equivalence-class-set-quotient + ( equivalence-relation-bounded-dist-Metric-Space A) + ( X) + ( x∈X) + ( y∈X) +``` + +### Neighborhoods in subspaces of equal components are neigborhoods in the ambient metric space + +```agda +module _ + {l1 l2 : Level} (A : Metric-Space l1 l2) + where + + lemma-iff-neighborhood-bounded-distance-decomposition-Metric-Space : + ( d : ℚ⁺) → + ( X Y : type-bounded-distance-component-Metric-Space A) → + ( eqXY : X = Y) → + ( x : type-subspace-bounded-distance-component-Metric-Space A X) → + ( y : type-subspace-bounded-distance-component-Metric-Space A Y) → + ( neighborhood-Metric-Space + ( subspace-bounded-distance-component-Metric-Space A Y) + ( d) + ( tr + ( type-Metric-Space ∘ + subspace-bounded-distance-component-Metric-Space A) + ( eqXY) + ( x)) + ( y)) ↔ + neighborhood-Metric-Space A d (pr1 x) (pr1 y) + lemma-iff-neighborhood-bounded-distance-decomposition-Metric-Space + d X .X refl (x , x∈X) (y , y∈X) = id-iff +``` + +### Metric spaces are isometrically equivalent to their bounded distance decomposition + +#### Equivalence of underlying types + +```agda +module _ + {l1 l2 : Level} (A : Metric-Space l1 l2) + where + + equiv-type-bounded-distance-decomposition-Metric-Space : + type-bounded-distance-decomposition-Metric-Space A ≃ + type-Metric-Space A + equiv-type-bounded-distance-decomposition-Metric-Space = + equiv-total-set-quotient + ( equivalence-relation-bounded-dist-Metric-Space A) + + map-equiv-bounded-distance-decomposition-Metric-Space : + type-function-Metric-Space + ( bounded-distance-decomposition-Metric-Space A) + ( A) + map-equiv-bounded-distance-decomposition-Metric-Space = + map-equiv + ( equiv-type-bounded-distance-decomposition-Metric-Space) +``` + +#### The equivalence between a metric space and its bounded distance decomposition is an isometry + +```agda +module _ + {l1 l2 : Level} (A : Metric-Space l1 l2) + where + + preserves-neighborhood-map-equiv-bounded-distance-decomposition-Metric-Space : + ( d : ℚ⁺) + ( x y : type-bounded-distance-decomposition-Metric-Space A) → + neighborhood-Metric-Space + ( bounded-distance-decomposition-Metric-Space A) + ( d) + ( x) + ( y) → + neighborhood-Metric-Space A d + ( map-equiv-bounded-distance-decomposition-Metric-Space A x) + ( map-equiv-bounded-distance-decomposition-Metric-Space A y) + preserves-neighborhood-map-equiv-bounded-distance-decomposition-Metric-Space + d (X , x , x∈X) (Y , y , y∈Y) (X=Y , Nxy) = + forward-implication + ( lemma-iff-neighborhood-bounded-distance-decomposition-Metric-Space + ( A) + ( d) + ( X) + ( Y) + ( X=Y) + ( x , x∈X) + ( y , y∈Y)) + ( Nxy) + + reflects-neighborhood-map-equiv-bounded-distance-decomposition-Metric-Space : + ( d : ℚ⁺) + ( x y : type-bounded-distance-decomposition-Metric-Space A) → + neighborhood-Metric-Space A d + ( map-equiv-bounded-distance-decomposition-Metric-Space A x) + ( map-equiv-bounded-distance-decomposition-Metric-Space A y) → + neighborhood-Metric-Space + ( bounded-distance-decomposition-Metric-Space A) + ( d) + ( x) + ( y) + reflects-neighborhood-map-equiv-bounded-distance-decomposition-Metric-Space + d (X , x , x∈X) (Y , y , y∈Y) Nxy = + ( lemma-eq , + backward-implication + ( lemma-iff-neighborhood-bounded-distance-decomposition-Metric-Space + ( A) + ( d) + ( X) + ( Y) + ( lemma-eq) + ( x , x∈X) + ( y , y∈Y)) + ( Nxy)) + where + + lemma-eq : X = Y + lemma-eq = + eq-set-quotient-sim-element-set-quotient + ( equivalence-relation-bounded-dist-Metric-Space A) + ( X) + ( Y) + ( x∈X) + ( y∈Y) + ( unit-trunc-Prop (d , Nxy)) + + is-isometry-map-equiv-bounded-distance-decomposition-Metric-Space : + is-isometry-Metric-Space + ( bounded-distance-decomposition-Metric-Space A) + ( A) + ( map-equiv-bounded-distance-decomposition-Metric-Space A) + is-isometry-map-equiv-bounded-distance-decomposition-Metric-Space + d x y = + ( ( preserves-neighborhood-map-equiv-bounded-distance-decomposition-Metric-Space + ( d) + ( x) + ( y)) , + ( reflects-neighborhood-map-equiv-bounded-distance-decomposition-Metric-Space + ( d) + ( x) + ( y))) +``` + +#### The isometric equivalence between a metric space and its bounded distance decomposition + +```agda +module _ + {l1 l2 : Level} (A : Metric-Space l1 l2) + where + + isometric-equiv-bounded-distance-decomposition-Metric-Space : + isometric-equiv-Metric-Space + ( bounded-distance-decomposition-Metric-Space A) + ( A) + isometric-equiv-bounded-distance-decomposition-Metric-Space = + ( equiv-type-bounded-distance-decomposition-Metric-Space A , + is-isometry-map-equiv-bounded-distance-decomposition-Metric-Space A) +``` + +### The bounded distance decomposition operation is idempotent + +```agda +module _ + {l1 l2 : Level} (A : Metric-Space l1 l2) + where + + is-idempotent-bounded-distance-decomposition-Metric-Space : + bounded-distance-decomposition-Metric-Space + ( bounded-distance-decomposition-Metric-Space A) = + bounded-distance-decomposition-Metric-Space A + is-idempotent-bounded-distance-decomposition-Metric-Space = + eq-isometric-equiv-Metric-Space + ( bounded-distance-decomposition-Metric-Space + ( bounded-distance-decomposition-Metric-Space A)) + ( bounded-distance-decomposition-Metric-Space A) + ( isometric-equiv-bounded-distance-decomposition-Metric-Space + ( bounded-distance-decomposition-Metric-Space A)) +``` + +### Cauchy approximations in the bounded distance decomposition of a metric space + +#### Cauchy approximations in bounded distance subspaces are Cauchy approximations in the ambient metric space + +```agda +module _ + { l1 l2 : Level} (A : Metric-Space l1 l2) + ( X : type-bounded-distance-component-Metric-Space A) + ( f : + cauchy-approximation-Metric-Space + ( subspace-bounded-distance-component-Metric-Space A X)) + where + + map-cauchy-approximation-subspace-bounded-distance-component-Metric-Space : + cauchy-approximation-Metric-Space A + map-cauchy-approximation-subspace-bounded-distance-component-Metric-Space = + map-short-function-cauchy-approximation-Metric-Space + ( subspace-bounded-distance-component-Metric-Space A X) + ( A) + ( short-inclusion-subspace-Metric-Space + ( A) + ( subtype-bounded-distance-component-Metric-Space A X)) + ( f) + + is-in-subspace-map-cauchy-approximation-bounded-distance-component-Metric-Space : + (d : ℚ⁺) → + is-in-subtype + ( subtype-bounded-distance-component-Metric-Space A X) + ( map-cauchy-approximation-Metric-Space + ( A) + ( map-cauchy-approximation-subspace-bounded-distance-component-Metric-Space) + ( d)) + is-in-subspace-map-cauchy-approximation-bounded-distance-component-Metric-Space + d = + is-in-subtype-inclusion-subtype + ( subtype-bounded-distance-component-Metric-Space A X) + ( map-cauchy-approximation-Metric-Space + ( subspace-bounded-distance-component-Metric-Space A X) + ( f) + ( d)) +``` + +#### Cauchy approximations take values in a unique bounded distance component + +```agda +module _ + {l1 l2 : Level} (A : Metric-Space l1 l2) + (f : cauchy-approximation-Metric-Space A) + where + + is-bounded-distance-component-prop-cauchy-approximation-Metric-Space : + subtype l2 (type-bounded-distance-component-Metric-Space A) + is-bounded-distance-component-prop-cauchy-approximation-Metric-Space X = + Π-Prop + ( ℚ⁺) + ( λ d → + subtype-bounded-distance-component-Metric-Space A X + ( map-cauchy-approximation-Metric-Space A f d)) + + is-bounded-distance-component-cauchy-approximation-Metric-Space : + type-bounded-distance-component-Metric-Space A → UU l2 + is-bounded-distance-component-cauchy-approximation-Metric-Space X = + type-Prop + (is-bounded-distance-component-prop-cauchy-approximation-Metric-Space X) + + all-eq-is-bounded-distance-component-cauchy-approximation-Metric-Space : + (X Y : type-bounded-distance-component-Metric-Space A) → + is-bounded-distance-component-cauchy-approximation-Metric-Space X → + is-bounded-distance-component-cauchy-approximation-Metric-Space Y → + X = Y + all-eq-is-bounded-distance-component-cauchy-approximation-Metric-Space + X Y f∈X f∈Y = + let + open + do-syntax-trunc-Prop + ( Id-Prop + ( quotient-Set + ( equivalence-relation-bounded-dist-Metric-Space A)) + ( X) + ( Y)) + in do + d ← is-inhabited-ℚ⁺ + eq-set-quotient-sim-element-set-quotient + ( equivalence-relation-bounded-dist-Metric-Space A) + ( X) + ( Y) + ( f∈X d) + ( f∈Y d) + ( refl-bounded-dist-Metric-Space A _) + + type-bounded-distance-component-cauchy-approximation-Metric-Space : + UU (l1 ⊔ l2) + type-bounded-distance-component-cauchy-approximation-Metric-Space = + type-subtype + is-bounded-distance-component-prop-cauchy-approximation-Metric-Space + + abstract + all-eq-type-bounded-distance-component-cauchy-approximation-Metric-Space : + ( X Y : + type-bounded-distance-component-cauchy-approximation-Metric-Space) → + ( X = Y) + all-eq-type-bounded-distance-component-cauchy-approximation-Metric-Space + (X , f∈X) (Y , f∈Y) = + eq-type-subtype + ( is-bounded-distance-component-prop-cauchy-approximation-Metric-Space) + ( all-eq-is-bounded-distance-component-cauchy-approximation-Metric-Space + ( X) + ( Y) + ( f∈X) + ( f∈Y)) + + is-prop-type-bounded-distance-component-cauchy-approximation-Metric-Space : + is-prop type-bounded-distance-component-cauchy-approximation-Metric-Space + is-prop-type-bounded-distance-component-cauchy-approximation-Metric-Space = + is-prop-all-elements-equal + ( all-eq-type-bounded-distance-component-cauchy-approximation-Metric-Space) + + bounded-distance-component-prop-cauchy-approximation-Metric-Space : + Prop (l1 ⊔ l2) + bounded-distance-component-prop-cauchy-approximation-Metric-Space = + ( type-bounded-distance-component-cauchy-approximation-Metric-Space , + is-prop-type-bounded-distance-component-cauchy-approximation-Metric-Space) + + is-bounded-distance-component-map-component-cauchy-approximation-Metric-Space : + (d : ℚ⁺) → + is-bounded-distance-component-cauchy-approximation-Metric-Space + ( map-type-bounded-distance-component-Metric-Space A + ( map-cauchy-approximation-Metric-Space A f d)) + is-bounded-distance-component-map-component-cauchy-approximation-Metric-Space + ε δ = + inv-tr + ( λ X → + is-in-equivalence-class-set-quotient + ( equivalence-relation-bounded-dist-Metric-Space A) + ( X) + ( map-cauchy-approximation-Metric-Space A f δ)) + ( apply-effectiveness-quotient-map' + ( equivalence-relation-bounded-dist-Metric-Space A) + ( bounded-dist-map-cauchy-approximation-Metric-Space A f ε δ)) + ( is-in-equivalence-class-quotient-map-set-quotient + ( equivalence-relation-bounded-dist-Metric-Space A) + ( _)) + + center-bounded-distance-component-cauchy-appromimation-Metric-Space : + type-bounded-distance-component-cauchy-approximation-Metric-Space + center-bounded-distance-component-cauchy-appromimation-Metric-Space = + rec-trunc-Prop + ( bounded-distance-component-prop-cauchy-approximation-Metric-Space) + ( λ d → + ( ( map-type-bounded-distance-component-Metric-Space A + ( map-cauchy-approximation-Metric-Space A f d)) , + ( is-bounded-distance-component-map-component-cauchy-approximation-Metric-Space + ( d)))) + ( is-inhabited-ℚ⁺) + + is-contr-type-bounded-distance-component-cauchy-approximation-Metric-Space : + is-contr type-bounded-distance-component-cauchy-approximation-Metric-Space + is-contr-type-bounded-distance-component-cauchy-approximation-Metric-Space = + ( center-bounded-distance-component-cauchy-appromimation-Metric-Space , + all-eq-type-bounded-distance-component-cauchy-approximation-Metric-Space + ( center-bounded-distance-component-cauchy-appromimation-Metric-Space)) + + bounded-distance-component-cauchy-approximation-Metric-Space : + type-bounded-distance-component-Metric-Space A + bounded-distance-component-cauchy-approximation-Metric-Space = + pr1 center-bounded-distance-component-cauchy-appromimation-Metric-Space + + is-bounded-distance-component-bounded-distance-component-cauchy-approximation-Metric-Space : + is-bounded-distance-component-cauchy-approximation-Metric-Space + bounded-distance-component-cauchy-approximation-Metric-Space + is-bounded-distance-component-bounded-distance-component-cauchy-approximation-Metric-Space + = pr2 center-bounded-distance-component-cauchy-appromimation-Metric-Space + + map-subspace-bounded-distance-component-cauchy-approximation-Metric-Space : + cauchy-approximation-Metric-Space + ( subspace-bounded-distance-component-Metric-Space + ( A) + ( bounded-distance-component-cauchy-approximation-Metric-Space)) + pr1 map-subspace-bounded-distance-component-cauchy-approximation-Metric-Space + d = + ( ( map-cauchy-approximation-Metric-Space A f d) , + ( is-bounded-distance-component-bounded-distance-component-cauchy-approximation-Metric-Space + ( d))) + pr2 map-subspace-bounded-distance-component-cauchy-approximation-Metric-Space + = is-cauchy-approximation-map-cauchy-approximation-Metric-Space A f + + map-cauchy-approximation-bounded-distance-decomposition-Metric-Space : + Σ ( type-bounded-distance-component-Metric-Space A) + ( ( cauchy-approximation-Metric-Space) ∘ + ( subspace-bounded-distance-component-Metric-Space A)) + map-cauchy-approximation-bounded-distance-decomposition-Metric-Space = + ( bounded-distance-component-cauchy-approximation-Metric-Space , + map-subspace-bounded-distance-component-cauchy-approximation-Metric-Space) +``` diff --git a/src/metric-spaces/elements-at-bounded-distance-metric-spaces.lagda.md b/src/metric-spaces/elements-at-bounded-distance-metric-spaces.lagda.md index 22848a33d8..5658add67d 100644 --- a/src/metric-spaces/elements-at-bounded-distance-metric-spaces.lagda.md +++ b/src/metric-spaces/elements-at-bounded-distance-metric-spaces.lagda.md @@ -28,6 +28,7 @@ open import foundation.universe-levels open import logic.functoriality-existential-quantification +open import metric-spaces.cauchy-approximations-metric-spaces open import metric-spaces.metric-spaces open import order-theory.preorders @@ -189,6 +190,30 @@ module _ ( transitive-bounded-dist-Metric A) ``` +### All the values of a Cauchy approximation in a metric space are at bounded distance + +```agda +module _ + {l1 l2 : Level} (A : Metric-Space l1 l2) + (f : cauchy-approximation-Metric-Space A) + where + + bounded-dist-map-cauchy-approximation-Metric-Space : + (ε δ : ℚ⁺) → + bounded-dist-Metric-Space + ( A) + ( map-cauchy-approximation-Metric-Space A f ε) + ( map-cauchy-approximation-Metric-Space A f δ) + bounded-dist-map-cauchy-approximation-Metric-Space ε δ = + unit-trunc-Prop + ( ( ε +ℚ⁺ δ) , + ( is-cauchy-approximation-map-cauchy-approximation-Metric-Space + ( A) + ( f) + ( ε) + ( δ))) +``` + ### Elements at bounded distance can be assigned an upper real distance ```agda diff --git a/src/metric-spaces/subspaces-metric-spaces.lagda.md b/src/metric-spaces/subspaces-metric-spaces.lagda.md index 0944224797..7e45d42eaf 100644 --- a/src/metric-spaces/subspaces-metric-spaces.lagda.md +++ b/src/metric-spaces/subspaces-metric-spaces.lagda.md @@ -23,6 +23,7 @@ open import metric-spaces.pseudometric-spaces open import metric-spaces.rational-neighborhood-relations open import metric-spaces.reflexive-rational-neighborhood-relations open import metric-spaces.saturated-rational-neighborhood-relations +open import metric-spaces.short-functions-metric-spaces open import metric-spaces.symmetric-rational-neighborhood-relations open import metric-spaces.triangular-rational-neighborhood-relations ``` @@ -176,3 +177,21 @@ module _ inclusion-subspace-Metric-Space A S , is-isometry-inclusion-subspace-Metric-Space ``` + +### The inclusion of a subspace into its ambient space is short + +```agda +module _ + {l l1 l2 : Level} + (A : Metric-Space l1 l2) + (S : subset-Metric-Space l A) + where + + short-inclusion-subspace-Metric-Space : + short-function-Metric-Space (subspace-Metric-Space A S) A + short-inclusion-subspace-Metric-Space = + short-isometry-Metric-Space + ( subspace-Metric-Space A S) + ( A) + ( isometry-inclusion-subspace-Metric-Space A S) +``` From ddbe55222441346f8adcbed0e2d4e9dae92dd5ab Mon Sep 17 00:00:00 2001 From: malarbol Date: Sat, 30 Aug 2025 22:01:02 +0200 Subject: [PATCH 33/97] Cross multiplication difference of rational numbers and other lemmas (#1508) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR introduces `cross-mul-diff-ℚ`, the cross-multiplication difference to two rational numbers (the cross-multiplication difference of their underlying reduced fractions) and a few other miscellaneous results on integer fractions and rational numbers. --- src/elementary-number-theory.lagda.md | 1 + ...ation-difference-rational-numbers.lagda.md | 159 ++++++++++++++++++ .../mediant-integer-fractions.lagda.md | 82 +++++++++ .../reduced-integer-fractions.lagda.md | 36 ++++ ...trict-inequality-rational-numbers.lagda.md | 11 ++ 5 files changed, 289 insertions(+) create mode 100644 src/elementary-number-theory/cross-multiplication-difference-rational-numbers.lagda.md diff --git a/src/elementary-number-theory.lagda.md b/src/elementary-number-theory.lagda.md index af8b23d19a..da0bfbea2b 100644 --- a/src/elementary-number-theory.lagda.md +++ b/src/elementary-number-theory.lagda.md @@ -46,6 +46,7 @@ open import elementary-number-theory.conatural-numbers public open import elementary-number-theory.congruence-integers public open import elementary-number-theory.congruence-natural-numbers public open import elementary-number-theory.cross-multiplication-difference-integer-fractions public +open import elementary-number-theory.cross-multiplication-difference-rational-numbers public open import elementary-number-theory.cubes-natural-numbers public open import elementary-number-theory.decidable-dependent-function-types public open import elementary-number-theory.decidable-total-order-integers public diff --git a/src/elementary-number-theory/cross-multiplication-difference-rational-numbers.lagda.md b/src/elementary-number-theory/cross-multiplication-difference-rational-numbers.lagda.md new file mode 100644 index 0000000000..8c33bdc0df --- /dev/null +++ b/src/elementary-number-theory/cross-multiplication-difference-rational-numbers.lagda.md @@ -0,0 +1,159 @@ +# The cross-multiplication difference of two rational numbers + +```agda +module elementary-number-theory.cross-multiplication-difference-rational-numbers where +``` + +
Imports + +```agda +open import elementary-number-theory.addition-integers +open import elementary-number-theory.cross-multiplication-difference-integer-fractions +open import elementary-number-theory.difference-integers +open import elementary-number-theory.inequality-rational-numbers +open import elementary-number-theory.integer-fractions +open import elementary-number-theory.integers +open import elementary-number-theory.mediant-integer-fractions +open import elementary-number-theory.multiplication-integers +open import elementary-number-theory.nonnegative-integers +open import elementary-number-theory.positive-integers +open import elementary-number-theory.rational-numbers +open import elementary-number-theory.strict-inequality-rational-numbers + +open import foundation.action-on-identifications-binary-functions +open import foundation.action-on-identifications-functions +open import foundation.binary-transport +open import foundation.dependent-pair-types +open import foundation.identity-types +open import foundation.negation +open import foundation.propositions +open import foundation.transport-along-identifications +``` + +
+ +## Idea + +The {{#concept "cross-multiplication difference" Agda=cross-mul-diff-ℚ}} of two +[rational numbers](elementary-number-theory.rational-numbers.md) `p` and `q` is +the +[cross-multiplication difference](elementary-number-theory.cross-multiplication-difference-integer-fractions.md) +of their reduced factions `a/b` and `c/d`, the +[difference](elementary-number-theory.difference-integers.md) of the +[products](elementary-number-theory.multiplication-integers.md) of the numerator +of each rational with the denominator of the other: `c * b - a * d`. + +## Definitions + +### The cross-multiplication difference of two rational numbers + +```agda +cross-mul-diff-ℚ : ℚ → ℚ → ℤ +cross-mul-diff-ℚ p q = + cross-mul-diff-fraction-ℤ + ( fraction-ℚ p) + ( fraction-ℚ q) +``` + +## Properties + +### Swapping the arguments switches the sign of the cross-multiplication difference + +```agda +abstract + skew-commutative-cross-mul-diff-ℚ : + (x y : ℚ) → + neg-ℤ (cross-mul-diff-ℚ x y) = + cross-mul-diff-ℚ y x + skew-commutative-cross-mul-diff-ℚ x y = + skew-commutative-cross-mul-diff-fraction-ℤ + ( fraction-ℚ x) + ( fraction-ℚ y) +``` + +### The cross-multiplication difference of zero and a rational number is its numerator + +```agda +module _ + (x : ℚ) + where + + abstract + cross-mul-diff-zero-ℚ : cross-mul-diff-ℚ zero-ℚ x = numerator-ℚ x + cross-mul-diff-zero-ℚ = cross-mul-diff-zero-fraction-ℤ (fraction-ℚ x) +``` + +### The cross-multiplication difference of two rational numbers is zero if and only if they are equal + +```agda +abstract + is-zero-cross-mul-diff-eq-ℚ : + (x y : ℚ) → + x = y → + is-zero-ℤ (cross-mul-diff-ℚ x y) + is-zero-cross-mul-diff-eq-ℚ x .x refl = + is-zero-cross-mul-diff-sim-fraction-ℤ + ( fraction-ℚ x) + ( fraction-ℚ x) + ( refl-sim-fraction-ℤ (fraction-ℚ x)) + + eq-is-zero-cross-mul-diff-ℚ : + (x y : ℚ) → + is-zero-ℤ (cross-mul-diff-ℚ x y) → + x = y + eq-is-zero-cross-mul-diff-ℚ x y H = + binary-tr + ( Id) + ( is-retraction-rational-fraction-ℚ x) + ( is-retraction-rational-fraction-ℚ y) + ( eq-ℚ-sim-fraction-ℤ + ( fraction-ℚ x) + ( fraction-ℚ y) + ( sim-is-zero-coss-mul-diff-fraction-ℤ + ( fraction-ℚ x) + ( fraction-ℚ y) + ( H))) +``` + +### The cross-multiplication difference of `p` and `q` with `p ≤ q` is nonnegative + +```agda +module _ + (p q : ℚ) + where + + opaque + unfolding leq-ℚ-Prop + + is-nonnegative-cross-mul-diff-leq-ℚ : + leq-ℚ p q → is-nonnegative-ℤ (cross-mul-diff-ℚ p q) + is-nonnegative-cross-mul-diff-leq-ℚ H = H + + leq-is-nonnegative-cross-mul-diff-ℚ : + is-nonnegative-ℤ (cross-mul-diff-ℚ p q) → leq-ℚ p q + leq-is-nonnegative-cross-mul-diff-ℚ H = H +``` + +### The cross-multiplication difference of `p` and `q` with `p < q` is positive + +```agda +module _ + (p q : ℚ) + where + + opaque + unfolding le-ℚ-Prop + + is-positive-cross-mul-diff-le-ℚ : + le-ℚ p q → is-positive-ℤ (cross-mul-diff-ℚ p q) + is-positive-cross-mul-diff-le-ℚ H = H + + le-is-positive-cross-mul-diff-ℚ : + is-positive-ℤ (cross-mul-diff-ℚ p q) → le-ℚ p q + le-is-positive-cross-mul-diff-ℚ H = H +``` + +## External links + +- [Cross-multiplication](https://en.wikipedia.org/wiki/Cross-multiplication) at + Wikipedia diff --git a/src/elementary-number-theory/mediant-integer-fractions.lagda.md b/src/elementary-number-theory/mediant-integer-fractions.lagda.md index 96adcb2df1..d9e2828280 100644 --- a/src/elementary-number-theory/mediant-integer-fractions.lagda.md +++ b/src/elementary-number-theory/mediant-integer-fractions.lagda.md @@ -11,11 +11,20 @@ open import elementary-number-theory.addition-integers open import elementary-number-theory.addition-positive-and-negative-integers open import elementary-number-theory.cross-multiplication-difference-integer-fractions open import elementary-number-theory.difference-integers +open import elementary-number-theory.divisibility-integers +open import elementary-number-theory.greatest-common-divisor-integers open import elementary-number-theory.integer-fractions +open import elementary-number-theory.integers open import elementary-number-theory.multiplication-integers +open import elementary-number-theory.negative-integers +open import elementary-number-theory.positive-and-negative-integers +open import elementary-number-theory.reduced-integer-fractions +open import foundation.coproduct-types open import foundation.dependent-pair-types +open import foundation.empty-types open import foundation.identity-types +open import foundation.transport-along-identifications ```
@@ -80,6 +89,79 @@ cross-mul-diff-right-mediant-fraction-ℤ (nx , dx , px) (ny , dy , py) = ( inv (right-distributive-mul-add-ℤ nx ny dy)) ``` +### Common divisors of the numerator and denominator of the mediant of two integer fractions divide their cross-multiplication difference + +```agda +div-cross-mul-diff-common-divisor-mediant-fraction-ℤ : + (x y : fraction-ℤ) → + (k : ℤ) → + is-common-divisor-ℤ + ( numerator-fraction-ℤ (mediant-fraction-ℤ x y)) + ( denominator-fraction-ℤ (mediant-fraction-ℤ x y)) + ( k) → + div-ℤ k (cross-mul-diff-fraction-ℤ x y) +div-cross-mul-diff-common-divisor-mediant-fraction-ℤ + x@(nx , dx , _) y@(ny , dy , _) k (div-N , div-D) = + inv-tr + ( div-ℤ k) + ( cross-mul-diff-left-mediant-fraction-ℤ x y) + ( div-add-ℤ + ( k) + ( (nx +ℤ ny) *ℤ dx) + ( neg-ℤ (nx *ℤ (dx +ℤ dy))) + ( inv-tr + ( div-ℤ k) + ( commutative-mul-ℤ (nx +ℤ ny) dx) + ( div-mul-ℤ dx k (nx +ℤ ny) div-N)) + ( div-neg-ℤ + ( k) + ( nx *ℤ (dx +ℤ dy)) + ( div-mul-ℤ + ( nx) + ( k) + ( dx +ℤ dy) + ( div-D)))) +``` + +### If the cross-multiplication difference of two fractions is 1 their mediant integer fraction is reduced + +```agda +is-reduced-mediant-is-one-cross-mul-diff-fraction-ℤ : + (x y : fraction-ℤ) → + is-one-ℤ (cross-mul-diff-fraction-ℤ x y) → + is-reduced-fraction-ℤ (mediant-fraction-ℤ x y) +is-reduced-mediant-is-one-cross-mul-diff-fraction-ℤ x y H = + let + n = numerator-fraction-ℤ (mediant-fraction-ℤ x y) + d = denominator-fraction-ℤ (mediant-fraction-ℤ x y) + + is-unit-gcd-mediant : is-unit-ℤ (gcd-ℤ n d) + is-unit-gcd-mediant = + tr + ( div-ℤ (gcd-ℤ n d)) + ( H) + ( div-cross-mul-diff-common-divisor-mediant-fraction-ℤ + ( x) + ( y) + ( gcd-ℤ n d) + ( is-common-divisor-gcd-ℤ n d)) + in + rec-coproduct + ( λ K → K) + ( λ K → + ex-falso + ( is-not-negative-and-nonnegative-ℤ + ( gcd-ℤ n d) + ( ( inv-tr + ( is-negative-ℤ) + ( K) + ( _)) , + ( is-nonnegative-gcd-ℤ n d)))) + ( is-one-or-neg-one-is-unit-ℤ + ( gcd-ℤ n d) + ( is-unit-gcd-mediant)) +``` + ## External links - [Mediant fraction]() at diff --git a/src/elementary-number-theory/reduced-integer-fractions.lagda.md b/src/elementary-number-theory/reduced-integer-fractions.lagda.md index b74d316dd3..a532182a02 100644 --- a/src/elementary-number-theory/reduced-integer-fractions.lagda.md +++ b/src/elementary-number-theory/reduced-integer-fractions.lagda.md @@ -580,3 +580,39 @@ unique-reduce-fraction-ℤ x y H = ( eq-is-prop ( is-prop-is-positive-ℤ (int-reduce-denominator-fraction-ℤ y)))))) ``` + +### A reduced fraction is its own reduction + +```agda +eq-reduce-is-reduced-fraction-ℤ : + (x : fraction-ℤ) → + is-reduced-fraction-ℤ x → + reduce-fraction-ℤ x = x +eq-reduce-is-reduced-fraction-ℤ x red-x = + eq-pair + ( eq-quotient-div-is-one-ℤ + ( gcd-ℤ (numerator-fraction-ℤ x) (denominator-fraction-ℤ x)) + ( numerator-fraction-ℤ x) + ( red-x) + ( div-left-gcd-ℤ (numerator-fraction-ℤ x) (denominator-fraction-ℤ x))) + ( eq-type-subtype + ( subtype-positive-ℤ) + ( eq-quotient-div-is-one-ℤ + ( gcd-ℤ (numerator-fraction-ℤ x) (denominator-fraction-ℤ x)) + ( denominator-fraction-ℤ x) + ( red-x) + ( div-right-gcd-ℤ (numerator-fraction-ℤ x) (denominator-fraction-ℤ x)))) +``` + +### The reduction operation on integer fractions is idempotent + +```agda +is-idempotent-reduce-fraction-ℤ : + (x : fraction-ℤ) → + reduce-fraction-ℤ (reduce-fraction-ℤ x) = + reduce-fraction-ℤ x +is-idempotent-reduce-fraction-ℤ x = + eq-reduce-is-reduced-fraction-ℤ + ( reduce-fraction-ℤ x) + ( is-reduced-reduce-fraction-ℤ x) +``` diff --git a/src/elementary-number-theory/strict-inequality-rational-numbers.lagda.md b/src/elementary-number-theory/strict-inequality-rational-numbers.lagda.md index 1ed22a4051..e3986f030d 100644 --- a/src/elementary-number-theory/strict-inequality-rational-numbers.lagda.md +++ b/src/elementary-number-theory/strict-inequality-rational-numbers.lagda.md @@ -48,6 +48,7 @@ open import foundation.negation open import foundation.propositional-truncations open import foundation.propositions open import foundation.transport-along-identifications +open import foundation.unit-type open import foundation.universe-levels open import group-theory.groups @@ -86,6 +87,16 @@ is-prop-le-ℚ x y = is-prop-type-Prop (le-ℚ-Prop x y) ## Properties +### Zero is strictly less than one + +```agda +opaque + unfolding le-ℚ-Prop + + le-zero-one-ℚ : le-ℚ zero-ℚ one-ℚ + le-zero-one-ℚ = star +``` + ### Strict inequality on the rational numbers is decidable ```agda From 94c44d7ac81b85866c77ae40284eaae4936a530d Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Sun, 31 Aug 2025 10:45:19 -0700 Subject: [PATCH 34/97] Commutative semigroups (#1494) I probably need to add sums over finite types, not just the standard finite type, too. I would love to get away without this, but soon we will need maxima and minima over finite families, and max and min are not monoids in general (and certainly not for the rationals and reals where we need them). --- src/group-theory.lagda.md | 4 + src/group-theory/commutative-monoids.lagda.md | 29 +- .../commutative-semigroups.lagda.md | 141 ++++++ ...s-of-elements-commutative-monoids.lagda.md | 91 ++-- ...f-elements-commutative-semigroups.lagda.md | 446 ++++++++++++++++++ ...s-of-elements-commutative-monoids.lagda.md | 143 ++---- ...f-elements-commutative-semigroups.lagda.md | 214 +++++++++ ...ite-sequences-of-elements-monoids.lagda.md | 4 + ...-sequences-of-elements-semigroups.lagda.md | 94 ++++ src/linear-algebra.lagda.md | 2 + ...quences-in-commutative-semigroups.lagda.md | 113 +++++ .../finite-sequences-in-monoids.lagda.md | 14 +- .../finite-sequences-in-semigroups.lagda.md | 97 ++++ src/univalent-combinatorics.lagda.md | 1 + ...coproducts-inhabited-finite-types.lagda.md | 40 ++ .../inhabited-finite-types.lagda.md | 8 +- 16 files changed, 1291 insertions(+), 150 deletions(-) create mode 100644 src/group-theory/commutative-semigroups.lagda.md create mode 100644 src/group-theory/sums-of-finite-families-of-elements-commutative-semigroups.lagda.md create mode 100644 src/group-theory/sums-of-finite-sequences-of-elements-commutative-semigroups.lagda.md create mode 100644 src/group-theory/sums-of-finite-sequences-of-elements-semigroups.lagda.md create mode 100644 src/linear-algebra/finite-sequences-in-commutative-semigroups.lagda.md create mode 100644 src/linear-algebra/finite-sequences-in-semigroups.lagda.md create mode 100644 src/univalent-combinatorics/coproducts-inhabited-finite-types.lagda.md diff --git a/src/group-theory.lagda.md b/src/group-theory.lagda.md index 0f885ea6f5..ec2473987c 100644 --- a/src/group-theory.lagda.md +++ b/src/group-theory.lagda.md @@ -32,6 +32,7 @@ open import group-theory.central-elements-semigroups public open import group-theory.centralizer-subgroups public open import group-theory.characteristic-subgroups public open import group-theory.commutative-monoids public +open import group-theory.commutative-semigroups public open import group-theory.commutator-subgroups public open import group-theory.commutators-of-elements-groups public open import group-theory.commuting-elements-groups public @@ -190,8 +191,11 @@ open import group-theory.subsets-semigroups public open import group-theory.substitution-functor-concrete-group-actions public open import group-theory.substitution-functor-group-actions public open import group-theory.sums-of-finite-families-of-elements-commutative-monoids public +open import group-theory.sums-of-finite-families-of-elements-commutative-semigroups public open import group-theory.sums-of-finite-sequences-of-elements-commutative-monoids public +open import group-theory.sums-of-finite-sequences-of-elements-commutative-semigroups public open import group-theory.sums-of-finite-sequences-of-elements-monoids public +open import group-theory.sums-of-finite-sequences-of-elements-semigroups public open import group-theory.surjective-group-homomorphisms public open import group-theory.surjective-semigroup-homomorphisms public open import group-theory.symmetric-concrete-groups public diff --git a/src/group-theory/commutative-monoids.lagda.md b/src/group-theory/commutative-monoids.lagda.md index 89b8b3f6aa..79b4faf392 100644 --- a/src/group-theory/commutative-monoids.lagda.md +++ b/src/group-theory/commutative-monoids.lagda.md @@ -17,6 +17,7 @@ open import foundation.sets open import foundation.unital-binary-operations open import foundation.universe-levels +open import group-theory.commutative-semigroups open import group-theory.monoids open import group-theory.semigroups ``` @@ -69,6 +70,10 @@ module _ semigroup-Commutative-Monoid : Semigroup l semigroup-Commutative-Monoid = semigroup-Monoid monoid-Commutative-Monoid + commutative-semigroup-Commutative-Monoid : Commutative-Semigroup l + commutative-semigroup-Commutative-Monoid = + ( semigroup-Commutative-Monoid , pr2 M) + set-Commutative-Monoid : Set l set-Commutative-Monoid = set-Monoid monoid-Commutative-Monoid @@ -124,32 +129,24 @@ module _ ( mul-Commutative-Monoid x x') ( mul-Commutative-Monoid y y')) interchange-mul-mul-Commutative-Monoid = - interchange-law-commutative-and-associative - mul-Commutative-Monoid - commutative-mul-Commutative-Monoid - associative-mul-Commutative-Monoid + interchange-mul-mul-Commutative-Semigroup + commutative-semigroup-Commutative-Monoid right-swap-mul-Commutative-Monoid : (x y z : type-Commutative-Monoid) → mul-Commutative-Monoid (mul-Commutative-Monoid x y) z = mul-Commutative-Monoid (mul-Commutative-Monoid x z) y - right-swap-mul-Commutative-Monoid x y z = - ( associative-mul-Commutative-Monoid x y z) ∙ - ( ap - ( mul-Commutative-Monoid x) - ( commutative-mul-Commutative-Monoid y z)) ∙ - ( inv (associative-mul-Commutative-Monoid x z y)) + right-swap-mul-Commutative-Monoid = + right-swap-mul-Commutative-Semigroup + commutative-semigroup-Commutative-Monoid left-swap-mul-Commutative-Monoid : (x y z : type-Commutative-Monoid) → mul-Commutative-Monoid x (mul-Commutative-Monoid y z) = mul-Commutative-Monoid y (mul-Commutative-Monoid x z) - left-swap-mul-Commutative-Monoid x y z = - ( inv (associative-mul-Commutative-Monoid x y z)) ∙ - ( ap - ( mul-Commutative-Monoid' z) - ( commutative-mul-Commutative-Monoid x y)) ∙ - ( associative-mul-Commutative-Monoid y x z) + left-swap-mul-Commutative-Monoid = + left-swap-mul-Commutative-Semigroup + commutative-semigroup-Commutative-Monoid ``` ### The unit element of a commutative monoid diff --git a/src/group-theory/commutative-semigroups.lagda.md b/src/group-theory/commutative-semigroups.lagda.md new file mode 100644 index 0000000000..53b591d79f --- /dev/null +++ b/src/group-theory/commutative-semigroups.lagda.md @@ -0,0 +1,141 @@ +# Commutative semigroups + +```agda +module group-theory.commutative-semigroups where +``` + +
Imports + +```agda +open import foundation.action-on-identifications-functions +open import foundation.dependent-pair-types +open import foundation.identity-types +open import foundation.interchange-law +open import foundation.propositions +open import foundation.sets +open import foundation.subtypes +open import foundation.universe-levels + +open import group-theory.semigroups +``` + +
+ +## Idea + +A +{{#concept "commutative semigroup" WDID=Q27672715 WD="commutative semigroup" Agda=Commutative-Semigroup}} +is a [semigroup](group-theory.semigroups.md) `G` in which `xy = yx` for all +`x y : G`. + +## Definition + +```agda +module _ + {l : Level} (G : Semigroup l) + where + + is-commutative-prop-Semigroup : Prop l + is-commutative-prop-Semigroup = + Π-Prop + ( type-Semigroup G) + ( λ x → + Π-Prop + ( type-Semigroup G) + ( λ y → + Id-Prop + ( set-Semigroup G) + ( mul-Semigroup G x y) + ( mul-Semigroup G y x))) + + is-commutative-Semigroup : UU l + is-commutative-Semigroup = type-Prop is-commutative-prop-Semigroup + +Commutative-Semigroup : (l : Level) → UU (lsuc l) +Commutative-Semigroup l = type-subtype (is-commutative-prop-Semigroup {l}) + +module _ + {l : Level} (G : Commutative-Semigroup l) + where + + semigroup-Commutative-Semigroup : Semigroup l + semigroup-Commutative-Semigroup = pr1 G + + commutative-mul-Commutative-Semigroup : + is-commutative-Semigroup semigroup-Commutative-Semigroup + commutative-mul-Commutative-Semigroup = pr2 G + + type-Commutative-Semigroup : UU l + type-Commutative-Semigroup = type-Semigroup semigroup-Commutative-Semigroup + + set-Commutative-Semigroup : Set l + set-Commutative-Semigroup = set-Semigroup semigroup-Commutative-Semigroup + + mul-Commutative-Semigroup : + type-Commutative-Semigroup → type-Commutative-Semigroup → + type-Commutative-Semigroup + mul-Commutative-Semigroup = mul-Semigroup semigroup-Commutative-Semigroup + + mul-Commutative-Semigroup' : + type-Commutative-Semigroup → type-Commutative-Semigroup → + type-Commutative-Semigroup + mul-Commutative-Semigroup' y x = mul-Commutative-Semigroup x y + + ap-mul-Commutative-Semigroup : + {x x' y y' : type-Commutative-Semigroup} → + x = x' → y = y' → + mul-Commutative-Semigroup x y = mul-Commutative-Semigroup x' y' + ap-mul-Commutative-Semigroup = + ap-mul-Semigroup semigroup-Commutative-Semigroup + + associative-mul-Commutative-Semigroup : + (x y z : type-Commutative-Semigroup) → + mul-Commutative-Semigroup (mul-Commutative-Semigroup x y) z = + mul-Commutative-Semigroup x (mul-Commutative-Semigroup y z) + associative-mul-Commutative-Semigroup = + associative-mul-Semigroup semigroup-Commutative-Semigroup + + interchange-mul-mul-Commutative-Semigroup : + (a b c d : type-Commutative-Semigroup) → + mul-Commutative-Semigroup + ( mul-Commutative-Semigroup a b) + ( mul-Commutative-Semigroup c d) = + mul-Commutative-Semigroup + ( mul-Commutative-Semigroup a c) + ( mul-Commutative-Semigroup b d) + interchange-mul-mul-Commutative-Semigroup = + interchange-law-commutative-and-associative + mul-Commutative-Semigroup + commutative-mul-Commutative-Semigroup + associative-mul-Commutative-Semigroup + + right-swap-mul-Commutative-Semigroup : + (x y z : type-Commutative-Semigroup) → + mul-Commutative-Semigroup + ( mul-Commutative-Semigroup x y) + ( z) = + mul-Commutative-Semigroup + ( mul-Commutative-Semigroup x z) + ( y) + right-swap-mul-Commutative-Semigroup x y z = + ( associative-mul-Commutative-Semigroup x y z) ∙ + ( ap + ( mul-Commutative-Semigroup x) + ( commutative-mul-Commutative-Semigroup y z)) ∙ + ( inv (associative-mul-Commutative-Semigroup x z y)) + + left-swap-mul-Commutative-Semigroup : + (x y z : type-Commutative-Semigroup) → + mul-Commutative-Semigroup + ( x) + ( mul-Commutative-Semigroup y z) = + mul-Commutative-Semigroup + ( y) + ( mul-Commutative-Semigroup x z) + left-swap-mul-Commutative-Semigroup x y z = + inv (associative-mul-Commutative-Semigroup x y z) ∙ + ap + ( mul-Commutative-Semigroup' z) + ( commutative-mul-Commutative-Semigroup x y) ∙ + associative-mul-Commutative-Semigroup y x z +``` diff --git a/src/group-theory/sums-of-finite-families-of-elements-commutative-monoids.lagda.md b/src/group-theory/sums-of-finite-families-of-elements-commutative-monoids.lagda.md index b531615530..1554075883 100644 --- a/src/group-theory/sums-of-finite-families-of-elements-commutative-monoids.lagda.md +++ b/src/group-theory/sums-of-finite-families-of-elements-commutative-monoids.lagda.md @@ -23,6 +23,7 @@ open import foundation.functoriality-coproduct-types open import foundation.functoriality-dependent-pair-types open import foundation.homotopies open import foundation.identity-types +open import foundation.inhabited-types open import foundation.propositional-truncations open import foundation.sets open import foundation.type-arithmetic-coproduct-types @@ -33,6 +34,7 @@ open import foundation.universal-property-propositional-truncation-into-sets open import foundation.universe-levels open import group-theory.commutative-monoids +open import group-theory.sums-of-finite-families-of-elements-commutative-semigroups open import group-theory.sums-of-finite-sequences-of-elements-commutative-monoids open import univalent-combinatorics.coproduct-types @@ -55,6 +57,11 @@ extends the binary operation on a elements of `M` indexed by a [finite type](univalent-combinatorics.finite-types.md). +We use additive terminology consistently with the linear algebra definition of +[finite sequences in commutative monoids](linear-algebra.finite-sequences-in-commutative-monoids.md) +despite the use of multiplicative terminology for commutative monoids in +general. + ## Sums over counted types ### Definition @@ -69,6 +76,38 @@ sum-count-Commutative-Monoid M A (n , Fin-n≃A) f = ### Properties +#### Sums for counts in a commutative monoid equal sums in the corresponding commutative semigroup + +```agda +module _ + {l1 l2 : Level} (M : Commutative-Monoid l1) (A : UU l2) + (|A| : is-inhabited A) + where + + abstract + eq-sum-commutative-semigroup-sum-count-Commutative-Monoid : + (cA : count A) (f : A → type-Commutative-Monoid M) → + sum-count-Commutative-Monoid M A cA f = + sum-count-Commutative-Semigroup + ( commutative-semigroup-Commutative-Monoid M) + ( A) + ( |A|) + ( cA) + ( f) + eq-sum-commutative-semigroup-sum-count-Commutative-Monoid cA@(zero-ℕ , _) _ + = + ex-falso + ( is-nonempty-is-inhabited + ( |A|) + ( is-empty-is-zero-number-of-elements-count cA refl)) + eq-sum-commutative-semigroup-sum-count-Commutative-Monoid + cA@(succ-ℕ n , Fin-sn≃A) f = + eq-sum-commutative-semigroup-sum-fin-sequence-type-Commutative-Monoid + ( M) + ( n) + ( f ∘ map-equiv Fin-sn≃A) +``` + #### Sums for a counted type are homotopy invariant ```agda @@ -93,42 +132,32 @@ module _ where abstract - eq-sum-count-equiv-Commutative-Monoid : - (n : ℕ) → (equiv1 equiv2 : Fin n ≃ A) → - (f : A → type-Commutative-Monoid M) → - sum-count-Commutative-Monoid M A (n , equiv1) f = - sum-count-Commutative-Monoid M A (n , equiv2) f - eq-sum-count-equiv-Commutative-Monoid n equiv1 equiv2 f = - equational-reasoning - sum-fin-sequence-type-Commutative-Monoid M n (f ∘ map-equiv equiv1) - = - sum-fin-sequence-type-Commutative-Monoid - ( M) - ( n) - ( (f ∘ map-equiv equiv1) ∘ (map-inv-equiv equiv1 ∘ map-equiv equiv2)) - by - preserves-sum-permutation-fin-sequence-type-Commutative-Monoid - ( M) - ( n) - ( inv-equiv equiv1 ∘e equiv2) - ( f ∘ map-equiv equiv1) - = sum-fin-sequence-type-Commutative-Monoid M n (f ∘ map-equiv equiv2) - by - ap - ( λ g → - sum-fin-sequence-type-Commutative-Monoid - ( M) - ( n) - ( f ∘ (g ∘ map-equiv equiv2))) - ( eq-htpy (is-section-map-inv-equiv equiv1)) - eq-sum-count-Commutative-Monoid : (f : A → type-Commutative-Monoid M) (c1 c2 : count A) → sum-count-Commutative-Monoid M A c1 f = sum-count-Commutative-Monoid M A c2 f - eq-sum-count-Commutative-Monoid f c1@(n , e1) c2@(_ , e2) + eq-sum-count-Commutative-Monoid f c1@(zero-ℕ , _) c2@(_ , e2) with double-counting c1 c2 - ... | refl = eq-sum-count-equiv-Commutative-Monoid n e1 e2 f + ... | refl = refl + eq-sum-count-Commutative-Monoid f c1@(succ-ℕ n , e1) c2@(_ , e2) + with double-counting c1 c2 + ... | refl = + eq-sum-commutative-semigroup-sum-fin-sequence-type-Commutative-Monoid + ( M) + ( n) + ( f ∘ map-equiv e1) ∙ + eq-sum-count-Commutative-Semigroup + ( commutative-semigroup-Commutative-Monoid M) + ( A) + ( unit-trunc-Prop (map-equiv e1 (inr star))) + ( f) + ( c1) + ( c2) ∙ + inv + ( eq-sum-commutative-semigroup-sum-fin-sequence-type-Commutative-Monoid + ( M) + ( n) + ( f ∘ map-equiv e2)) ``` #### Sums of counted families indexed by equivalent types are equal diff --git a/src/group-theory/sums-of-finite-families-of-elements-commutative-semigroups.lagda.md b/src/group-theory/sums-of-finite-families-of-elements-commutative-semigroups.lagda.md new file mode 100644 index 0000000000..ef718231de --- /dev/null +++ b/src/group-theory/sums-of-finite-families-of-elements-commutative-semigroups.lagda.md @@ -0,0 +1,446 @@ +# Sums of finite families of elements in commutative semigroups + +```agda +{-# OPTIONS --lossy-unification #-} + +module group-theory.sums-of-finite-families-of-elements-commutative-semigroups where +``` + +
Imports + +```agda +open import elementary-number-theory.addition-natural-numbers +open import elementary-number-theory.natural-numbers + +open import foundation.action-on-identifications-functions +open import foundation.coproduct-types +open import foundation.dependent-pair-types +open import foundation.empty-types +open import foundation.equivalences +open import foundation.function-extensionality +open import foundation.function-types +open import foundation.functoriality-coproduct-types +open import foundation.functoriality-dependent-pair-types +open import foundation.homotopies +open import foundation.identity-types +open import foundation.inhabited-types +open import foundation.propositional-truncations +open import foundation.sets +open import foundation.type-arithmetic-coproduct-types +open import foundation.type-arithmetic-empty-type +open import foundation.type-arithmetic-unit-type +open import foundation.unit-type +open import foundation.universal-property-propositional-truncation-into-sets +open import foundation.universe-levels + +open import group-theory.commutative-semigroups +open import group-theory.sums-of-finite-sequences-of-elements-commutative-semigroups + +open import univalent-combinatorics.coproduct-types +open import univalent-combinatorics.coproducts-inhabited-finite-types +open import univalent-combinatorics.counting +open import univalent-combinatorics.counting-dependent-pair-types +open import univalent-combinatorics.dependent-pair-types +open import univalent-combinatorics.double-counting +open import univalent-combinatorics.finite-types +open import univalent-combinatorics.inhabited-finite-types +open import univalent-combinatorics.standard-finite-types +``` + +
+ +## Idea + +The +{{#concept "sum operation" Disambiguation="of a finite family of elements of a commutative semigroup" WD="sum" WDID=Q218005 Agda=sum-finite-Commutative-Semigroup}} +extends the binary operation on a +[commutative semigroup](group-theory.commutative-semigroups.md) `G` to any +family of elements of `G` indexed by an +[inhabited finite type](univalent-combinatorics.inhabited-finite-types.md). + +We use additive terminology consistently with the linear algebra definition of +[finite sequences in commutative semigroups](linear-algebra.finite-sequences-in-commutative-semigroups.md) +despite the use of multiplicative terminology for commutative semigroups in +general. + +## Sums over counted types + +### Definition + +```agda +sum-count-Commutative-Semigroup : + {l1 l2 : Level} (G : Commutative-Semigroup l1) (A : UU l2) → + is-inhabited A → count A → (A → type-Commutative-Semigroup G) → + type-Commutative-Semigroup G +sum-count-Commutative-Semigroup G A |A| cA@(zero-ℕ , _) _ = + ex-falso + ( is-nonempty-is-inhabited + ( |A|) + ( is-empty-is-zero-number-of-elements-count cA refl)) +sum-count-Commutative-Semigroup G A _ (succ-ℕ n , Fin-sn≃A) f = + sum-fin-sequence-type-Commutative-Semigroup G n (f ∘ map-equiv Fin-sn≃A) +``` + +### Properties + +#### Sums for a counted type are homotopy invariant + +```agda +module _ + {l1 l2 : Level} (G : Commutative-Semigroup l1) (A : UU l2) + (|A| : is-inhabited A) + where + + htpy-sum-count-Commutative-Semigroup : + (c : count A) → + {f g : A → type-Commutative-Semigroup G} → (f ~ g) → + sum-count-Commutative-Semigroup G A |A| c f = + sum-count-Commutative-Semigroup G A |A| c g + htpy-sum-count-Commutative-Semigroup cA@(zero-ℕ , _) _ = + ex-falso + ( is-nonempty-is-inhabited + ( |A|) + ( is-empty-is-zero-number-of-elements-count cA refl)) + htpy-sum-count-Commutative-Semigroup (succ-ℕ nA , _) H = + htpy-sum-fin-sequence-type-Commutative-Semigroup G nA (λ i → H _) +``` + +#### Two counts for the same type produce equal sums + +```agda +module _ + {l1 l2 : Level} (G : Commutative-Semigroup l1) (A : UU l2) + (|A| : is-inhabited A) + where + + abstract + eq-sum-count-equiv-Commutative-Semigroup : + (n : ℕ) → (equiv1 equiv2 : Fin (succ-ℕ n) ≃ A) → + (f : A → type-Commutative-Semigroup G) → + sum-count-Commutative-Semigroup G A |A| (succ-ℕ n , equiv1) f = + sum-count-Commutative-Semigroup G A |A| (succ-ℕ n , equiv2) f + eq-sum-count-equiv-Commutative-Semigroup n equiv1 equiv2 f = + equational-reasoning + sum-fin-sequence-type-Commutative-Semigroup G n (f ∘ map-equiv equiv1) + = + sum-fin-sequence-type-Commutative-Semigroup + ( G) + ( n) + ( (f ∘ map-equiv equiv1) ∘ (map-inv-equiv equiv1 ∘ map-equiv equiv2)) + by + preserves-sum-permutation-fin-sequence-type-Commutative-Semigroup + ( G) + ( n) + ( inv-equiv equiv1 ∘e equiv2) + ( f ∘ map-equiv equiv1) + = sum-fin-sequence-type-Commutative-Semigroup G n (f ∘ map-equiv equiv2) + by + ap + ( λ g → + sum-fin-sequence-type-Commutative-Semigroup + ( G) + ( n) + ( f ∘ (g ∘ map-equiv equiv2))) + ( eq-htpy (is-section-map-inv-equiv equiv1)) + + eq-sum-count-Commutative-Semigroup : + (f : A → type-Commutative-Semigroup G) (c1 c2 : count A) → + sum-count-Commutative-Semigroup G A |A| c1 f = + sum-count-Commutative-Semigroup G A |A| c2 f + eq-sum-count-Commutative-Semigroup f c1@(zero-ℕ , _) _ = + ex-falso + ( is-nonempty-is-inhabited + ( |A|) + ( is-empty-is-zero-number-of-elements-count c1 refl)) + eq-sum-count-Commutative-Semigroup f c1@(succ-ℕ n , e1) c2@(_ , e2) + with double-counting c1 c2 + ... | refl = eq-sum-count-equiv-Commutative-Semigroup n e1 e2 f +``` + +#### Sums of counted families indexed by equivalent types are equal + +```agda +module _ + {l1 l2 l3 : Level} (G : Commutative-Semigroup l1) + (A : UU l2) (|A| : is-inhabited A) (B : UU l3) (|B| : is-inhabited B) + (H : A ≃ B) + where + + abstract + sum-equiv-count-Commutative-Semigroup : + (cA : count A) (cB : count B) (f : A → type-Commutative-Semigroup G) → + sum-count-Commutative-Semigroup G A |A| cA f = + sum-count-Commutative-Semigroup G B |B| cB (f ∘ map-inv-equiv H) + sum-equiv-count-Commutative-Semigroup + cA@(zero-ℕ , _) _ _ = + ex-falso + ( is-nonempty-is-inhabited + ( |A|) + ( is-empty-is-zero-number-of-elements-count cA refl)) + sum-equiv-count-Commutative-Semigroup + cA@(succ-ℕ nA , Fin-nA≃A) cB@(_ , Fin-nB≃B) f + with double-counting-equiv cA cB H + ... | refl = + preserves-sum-permutation-fin-sequence-type-Commutative-Semigroup + ( G) + ( nA) + ( inv-equiv Fin-nA≃A ∘e inv-equiv H ∘e Fin-nB≃B) + ( _) ∙ + htpy-sum-fin-sequence-type-Commutative-Semigroup + ( G) + ( nA) + ( λ i → ap f (is-section-map-inv-equiv Fin-nA≃A _)) +``` + +#### Sums of coproducts of counted types + +```agda +module _ + {l1 l2 l3 : Level} (G : Commutative-Semigroup l1) + (A : UU l2) (|A| : is-inhabited A) (B : UU l3) (|B| : is-inhabited B) + (|A+B| : is-inhabited (A + B)) + where + + abstract + distributive-sum-coproduct-count-Commutative-Semigroup : + (cA : count A) (cB : count B) → + (f : (A + B) → type-Commutative-Semigroup G) → + sum-count-Commutative-Semigroup + ( G) + ( A + B) + ( |A+B|) + ( count-coproduct cA cB) + ( f) = + mul-Commutative-Semigroup G + ( sum-count-Commutative-Semigroup G A |A| cA (f ∘ inl)) + ( sum-count-Commutative-Semigroup G B |B| cB (f ∘ inr)) + distributive-sum-coproduct-count-Commutative-Semigroup + cA@(succ-ℕ nA , Fin-snA≃A) cB@(succ-ℕ nB , Fin-snB≃B) f = + split-sum-fin-sequence-type-Commutative-Semigroup G nA nB _ ∙ + ap-mul-Commutative-Semigroup G + ( htpy-sum-fin-sequence-type-Commutative-Semigroup G nA + ( λ i → ap f (map-equiv-count-coproduct-inl-coproduct-Fin cA cB i))) + ( htpy-sum-fin-sequence-type-Commutative-Semigroup G nB + ( λ i → ap f (map-equiv-count-coproduct-inr-coproduct-Fin cA cB i))) + distributive-sum-coproduct-count-Commutative-Semigroup + cA@(zero-ℕ , _) cB@(succ-ℕ _ , _) _ = + ex-falso + ( is-nonempty-is-inhabited + ( |A|) + ( is-empty-is-zero-number-of-elements-count cA refl)) + distributive-sum-coproduct-count-Commutative-Semigroup + cA@(zero-ℕ , _) cB@(zero-ℕ , _) _ = + ex-falso + ( is-nonempty-is-inhabited + ( |A|) + ( is-empty-is-zero-number-of-elements-count cA refl)) + distributive-sum-coproduct-count-Commutative-Semigroup + cA@(succ-ℕ _ , _) cB@(zero-ℕ , _) _ = + ex-falso + ( is-nonempty-is-inhabited + ( |B|) + ( is-empty-is-zero-number-of-elements-count cB refl)) +``` + +## Sums over finite types + +### Definition + +```agda +module _ + {l1 l2 : Level} (G : Commutative-Semigroup l1) (A : Inhabited-Finite-Type l2) + where + + sum-finite-Commutative-Semigroup : + (f : type-Inhabited-Finite-Type A → type-Commutative-Semigroup G) → + type-Commutative-Semigroup G + sum-finite-Commutative-Semigroup f = + map-universal-property-set-quotient-trunc-Prop + ( set-Commutative-Semigroup G) + ( λ c → + sum-count-Commutative-Semigroup G + ( type-Inhabited-Finite-Type A) + ( is-inhabited-type-Inhabited-Finite-Type A) + ( c) + ( f)) + ( eq-sum-count-Commutative-Semigroup G + ( type-Inhabited-Finite-Type A) + ( is-inhabited-type-Inhabited-Finite-Type A) + ( f)) + ( is-finite-Inhabited-Finite-Type A) +``` + +### Properties + +#### The sum over a finite type is its sum over any count for the type + +```agda +module _ + {l1 l2 : Level} (G : Commutative-Semigroup l1) + (A : Inhabited-Finite-Type l2) (cA : count (type-Inhabited-Finite-Type A)) + where + + abstract + eq-sum-finite-sum-count-Commutative-Semigroup : + (f : type-Inhabited-Finite-Type A → type-Commutative-Semigroup G) → + sum-finite-Commutative-Semigroup G A f = + sum-count-Commutative-Semigroup G + ( type-Inhabited-Finite-Type A) + ( is-inhabited-type-Inhabited-Finite-Type A) cA f + eq-sum-finite-sum-count-Commutative-Semigroup f = + ap + ( λ c → sum-finite-Commutative-Semigroup G ((_ , c) , _) f) + ( all-elements-equal-type-trunc-Prop _ _) ∙ + htpy-universal-property-set-quotient-trunc-Prop + ( set-Commutative-Semigroup G) + ( λ c → + sum-count-Commutative-Semigroup G + ( type-Inhabited-Finite-Type A) + ( is-inhabited-type-Inhabited-Finite-Type A) + ( c) + ( f)) + ( eq-sum-count-Commutative-Semigroup G + ( type-Inhabited-Finite-Type A) + ( is-inhabited-type-Inhabited-Finite-Type A) + ( f)) + ( cA) +``` + +#### Sums over a finite type are homotopy invariant + +```agda +module _ + {l1 l2 : Level} (G : Commutative-Semigroup l1) (A : Inhabited-Finite-Type l2) + where + + abstract + htpy-sum-finite-Commutative-Semigroup : + {f g : type-Inhabited-Finite-Type A → type-Commutative-Semigroup G} → + f ~ g → + sum-finite-Commutative-Semigroup G A f = + sum-finite-Commutative-Semigroup G A g + htpy-sum-finite-Commutative-Semigroup {f} {g} H = + let + open + do-syntax-trunc-Prop + ( Id-Prop + ( set-Commutative-Semigroup G) + ( sum-finite-Commutative-Semigroup G A f) + ( sum-finite-Commutative-Semigroup G A g)) + in do + cA ← is-finite-Inhabited-Finite-Type A + equational-reasoning + sum-finite-Commutative-Semigroup G A f + = + sum-count-Commutative-Semigroup G + ( type-Inhabited-Finite-Type A) + ( is-inhabited-type-Inhabited-Finite-Type A) + ( cA) + ( f) + by eq-sum-finite-sum-count-Commutative-Semigroup G A cA f + = + sum-count-Commutative-Semigroup G + ( type-Inhabited-Finite-Type A) + ( is-inhabited-type-Inhabited-Finite-Type A) + ( cA) + ( g) + by + htpy-sum-count-Commutative-Semigroup + ( G) + ( type-Inhabited-Finite-Type A) + ( is-inhabited-type-Inhabited-Finite-Type A) + ( cA) + ( H) + = sum-finite-Commutative-Semigroup G A g + by inv (eq-sum-finite-sum-count-Commutative-Semigroup G A cA g) +``` + +#### Sums over finite types are preserved by equivalences + +```agda +module _ + {l1 l2 l3 : Level} (G : Commutative-Semigroup l1) + (A : Inhabited-Finite-Type l2) + (B : Inhabited-Finite-Type l3) + (H : equiv-Inhabited-Finite-Type A B) + where + + abstract + sum-equiv-finite-Commutative-Semigroup : + (f : type-Inhabited-Finite-Type A → type-Commutative-Semigroup G) → + sum-finite-Commutative-Semigroup G A f = + sum-finite-Commutative-Semigroup G B (f ∘ map-inv-equiv H) + sum-equiv-finite-Commutative-Semigroup f = + let + open + do-syntax-trunc-Prop + ( Id-Prop + ( set-Commutative-Semigroup G) + ( sum-finite-Commutative-Semigroup G A f) + ( sum-finite-Commutative-Semigroup G B (f ∘ map-inv-equiv H))) + in do + cA ← is-finite-Inhabited-Finite-Type A + cB ← is-finite-Inhabited-Finite-Type B + ( eq-sum-finite-sum-count-Commutative-Semigroup G _ cA f ∙ + sum-equiv-count-Commutative-Semigroup G _ _ _ _ H cA cB f ∙ + inv (eq-sum-finite-sum-count-Commutative-Semigroup G _ cB _)) +``` + +### Sums over finite types distribute over coproducts + +```agda +module _ + {l1 l2 l3 : Level} (G : Commutative-Semigroup l1) + (A : Inhabited-Finite-Type l2) + (B : Inhabited-Finite-Type l3) + where + + abstract + distributive-distributive-sum-coproduct-finite-Commutative-Semigroup : + (f : + type-Inhabited-Finite-Type A + type-Inhabited-Finite-Type B → + type-Commutative-Semigroup G) → + sum-finite-Commutative-Semigroup + ( G) + ( coproduct-Inhabited-Finite-Type A B) + ( f) = + mul-Commutative-Semigroup + ( G) + ( sum-finite-Commutative-Semigroup G A (f ∘ inl)) + ( sum-finite-Commutative-Semigroup G B (f ∘ inr)) + distributive-distributive-sum-coproduct-finite-Commutative-Semigroup f = + let + open + do-syntax-trunc-Prop + ( Id-Prop + ( set-Commutative-Semigroup G) + ( sum-finite-Commutative-Semigroup + ( G) + ( coproduct-Inhabited-Finite-Type A B) + ( f)) + ( mul-Commutative-Semigroup + ( G) + ( sum-finite-Commutative-Semigroup G A (f ∘ inl)) + ( sum-finite-Commutative-Semigroup G B (f ∘ inr)))) + in do + cA ← is-finite-Inhabited-Finite-Type A + cB ← is-finite-Inhabited-Finite-Type B + ( eq-sum-finite-sum-count-Commutative-Semigroup + ( G) + ( coproduct-Inhabited-Finite-Type A B) + ( count-coproduct cA cB) + ( f) ∙ + distributive-sum-coproduct-count-Commutative-Semigroup G _ _ _ _ _ + ( cA) + ( cB) + ( f) ∙ + ap-mul-Commutative-Semigroup G + ( inv + ( eq-sum-finite-sum-count-Commutative-Semigroup G A cA (f ∘ inl))) + ( inv + ( eq-sum-finite-sum-count-Commutative-Semigroup + ( G) + ( B) + ( cB) + ( f ∘ inr)))) +``` diff --git a/src/group-theory/sums-of-finite-sequences-of-elements-commutative-monoids.lagda.md b/src/group-theory/sums-of-finite-sequences-of-elements-commutative-monoids.lagda.md index 4816c6bbe1..1553714a73 100644 --- a/src/group-theory/sums-of-finite-sequences-of-elements-commutative-monoids.lagda.md +++ b/src/group-theory/sums-of-finite-sequences-of-elements-commutative-monoids.lagda.md @@ -13,31 +13,23 @@ open import elementary-number-theory.addition-natural-numbers open import elementary-number-theory.natural-numbers open import finite-group-theory.permutations-standard-finite-types -open import finite-group-theory.transpositions-standard-finite-types open import foundation.action-on-identifications-functions -open import foundation.cartesian-product-types open import foundation.coproduct-types open import foundation.dependent-pair-types -open import foundation.empty-types open import foundation.equivalences -open import foundation.function-extensionality open import foundation.function-types open import foundation.homotopies open import foundation.identity-types -open import foundation.negated-equality -open import foundation.unit-type open import foundation.universe-levels open import group-theory.commutative-monoids +open import group-theory.sums-of-finite-sequences-of-elements-commutative-semigroups open import group-theory.sums-of-finite-sequences-of-elements-monoids open import linear-algebra.finite-sequences-in-commutative-monoids -open import lists.lists - open import univalent-combinatorics.coproduct-types -open import univalent-combinatorics.finite-types open import univalent-combinatorics.standard-finite-types ``` @@ -51,6 +43,11 @@ extends the binary operation on a [commutative monoid](group-theory.commutative-monoids.md) `M` to any [finite sequence](lists.finite-sequences.md) of elements of `M`. +We use additive terminology consistently with the linear algebra definition of +[finite sequences in commutative monoids](linear-algebra.finite-sequences-in-commutative-monoids.md) +despite the use of multiplicative terminology for commutative monoids in +general. + ## Definition ```agda @@ -63,6 +60,31 @@ sum-fin-sequence-type-Commutative-Monoid M = ## Properties +#### Nontrivial sums in a commutative monoid equal sums in the underlying commutative semigroup + +```agda +module _ + {l : Level} (M : Commutative-Monoid l) + where + + eq-sum-commutative-semigroup-sum-fin-sequence-type-Commutative-Monoid : + (n : ℕ) (f : fin-sequence-type-Commutative-Monoid M (succ-ℕ n)) → + sum-fin-sequence-type-Commutative-Monoid M (succ-ℕ n) f = + sum-fin-sequence-type-Commutative-Semigroup + ( commutative-semigroup-Commutative-Monoid M) + ( n) + ( f) + eq-sum-commutative-semigroup-sum-fin-sequence-type-Commutative-Monoid + zero-ℕ f = left-unit-law-mul-Commutative-Monoid M _ + eq-sum-commutative-semigroup-sum-fin-sequence-type-Commutative-Monoid + (succ-ℕ n) f = + ap + ( mul-Commutative-Monoid' M _) + ( eq-sum-commutative-semigroup-sum-fin-sequence-type-Commutative-Monoid + ( n) + ( f ∘ inl)) +``` + ### Sums of one and two elements ```agda @@ -208,96 +230,29 @@ module _ where abstract - preserves-sum-adjacent-transposition-sum-fin-sequence-type-Commutative-Monoid : - (n : ℕ) → (k : Fin n) → - (f : fin-sequence-type-Commutative-Monoid M (succ-ℕ n)) → - sum-fin-sequence-type-Commutative-Monoid M (succ-ℕ n) f = - sum-fin-sequence-type-Commutative-Monoid - M (succ-ℕ n) (f ∘ map-adjacent-transposition-Fin n k) - preserves-sum-adjacent-transposition-sum-fin-sequence-type-Commutative-Monoid - (succ-ℕ n) (inl x) f = - ap-mul-Commutative-Monoid - ( M) - ( preserves-sum-adjacent-transposition-sum-fin-sequence-type-Commutative-Monoid - ( n) - ( x) - ( f ∘ inl-Fin (succ-ℕ n))) - ( refl) - preserves-sum-adjacent-transposition-sum-fin-sequence-type-Commutative-Monoid - (succ-ℕ n) (inr star) f = right-swap-mul-Commutative-Monoid M _ _ _ - - preserves-sum-permutation-list-adjacent-transpositions-Commutative-Monoid : - (n : ℕ) → (L : list (Fin n)) → - (f : fin-sequence-type-Commutative-Monoid M (succ-ℕ n)) → - sum-fin-sequence-type-Commutative-Monoid M (succ-ℕ n) f = - sum-fin-sequence-type-Commutative-Monoid - M (succ-ℕ n) (f ∘ map-permutation-list-adjacent-transpositions n L) - preserves-sum-permutation-list-adjacent-transpositions-Commutative-Monoid - n nil f = refl - preserves-sum-permutation-list-adjacent-transpositions-Commutative-Monoid - n (cons x L) f = - preserves-sum-adjacent-transposition-sum-fin-sequence-type-Commutative-Monoid - ( n) - ( x) - ( f) ∙ - preserves-sum-permutation-list-adjacent-transpositions-Commutative-Monoid - ( n) - ( L) - ( f ∘ map-adjacent-transposition-Fin n x) - - preserves-sum-transposition-Commutative-Monoid : - (n : ℕ) (i j : Fin (succ-ℕ n)) (neq : i ≠ j) → - (f : fin-sequence-type-Commutative-Monoid M (succ-ℕ n)) → - sum-fin-sequence-type-Commutative-Monoid M (succ-ℕ n) f = - sum-fin-sequence-type-Commutative-Monoid - M (succ-ℕ n) (f ∘ map-transposition-Fin (succ-ℕ n) i j neq) - preserves-sum-transposition-Commutative-Monoid n i j i≠j f = - preserves-sum-permutation-list-adjacent-transpositions-Commutative-Monoid - ( n) - ( list-adjacent-transpositions-transposition-Fin n i j) - ( f) ∙ - ap - ( λ g → - sum-fin-sequence-type-Commutative-Monoid M - ( succ-ℕ n) - ( f ∘ map-equiv g)) - ( eq-permutation-list-adjacent-transpositions-transposition-Fin - ( n) - ( i) - ( j) - ( i≠j)) - - preserves-sum-permutation-list-standard-transpositions-Commutative-Monoid : - (n : ℕ) → (L : list (Σ (Fin n × Fin n) ( λ (i , j) → i ≠ j))) → - (f : fin-sequence-type-Commutative-Monoid M n) → - sum-fin-sequence-type-Commutative-Monoid M n f = - sum-fin-sequence-type-Commutative-Monoid - M n (f ∘ map-equiv (permutation-list-standard-transpositions-Fin n L)) - preserves-sum-permutation-list-standard-transpositions-Commutative-Monoid - zero-ℕ _ _ = refl - preserves-sum-permutation-list-standard-transpositions-Commutative-Monoid - (succ-ℕ n) nil f = refl - preserves-sum-permutation-list-standard-transpositions-Commutative-Monoid - (succ-ℕ n) (cons ((i , j) , i≠j) L) f = - preserves-sum-transposition-Commutative-Monoid n i j i≠j f ∙ - preserves-sum-permutation-list-standard-transpositions-Commutative-Monoid - ( succ-ℕ n) - ( L) - ( f ∘ map-transposition-Fin (succ-ℕ n) i j i≠j) - preserves-sum-permutation-fin-sequence-type-Commutative-Monoid : (n : ℕ) → (σ : Permutation n) → (f : fin-sequence-type-Commutative-Monoid M n) → sum-fin-sequence-type-Commutative-Monoid M n f = sum-fin-sequence-type-Commutative-Monoid M n (f ∘ map-equiv σ) - preserves-sum-permutation-fin-sequence-type-Commutative-Monoid n σ f = - preserves-sum-permutation-list-standard-transpositions-Commutative-Monoid - ( n) - ( list-standard-transpositions-permutation-Fin n σ) - ( f) ∙ - ap - ( λ τ → sum-fin-sequence-type-Commutative-Monoid M n (f ∘ map-equiv τ)) - ( eq-permutation-list-standard-transpositions-Fin n σ) + preserves-sum-permutation-fin-sequence-type-Commutative-Monoid zero-ℕ _ f = + refl + preserves-sum-permutation-fin-sequence-type-Commutative-Monoid + (succ-ℕ n) σ f = + eq-sum-commutative-semigroup-sum-fin-sequence-type-Commutative-Monoid + ( M) + ( n) + ( f) ∙ + preserves-sum-permutation-fin-sequence-type-Commutative-Semigroup + ( commutative-semigroup-Commutative-Monoid M) + ( n) + ( σ) + ( f) ∙ + inv + ( eq-sum-commutative-semigroup-sum-fin-sequence-type-Commutative-Monoid + ( M) + ( n) + ( f ∘ map-equiv σ)) ``` ## See also diff --git a/src/group-theory/sums-of-finite-sequences-of-elements-commutative-semigroups.lagda.md b/src/group-theory/sums-of-finite-sequences-of-elements-commutative-semigroups.lagda.md new file mode 100644 index 0000000000..bf710aead4 --- /dev/null +++ b/src/group-theory/sums-of-finite-sequences-of-elements-commutative-semigroups.lagda.md @@ -0,0 +1,214 @@ +# Sums of finite sequences of elements in commutative semigroups + +```agda +{-# OPTIONS --lossy-unification #-} + +module group-theory.sums-of-finite-sequences-of-elements-commutative-semigroups where +``` + +
Imports + +```agda +open import elementary-number-theory.addition-natural-numbers +open import elementary-number-theory.natural-numbers + +open import finite-group-theory.permutations-standard-finite-types +open import finite-group-theory.transpositions-standard-finite-types + +open import foundation.action-on-identifications-functions +open import foundation.cartesian-product-types +open import foundation.coproduct-types +open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.function-types +open import foundation.homotopies +open import foundation.identity-types +open import foundation.negated-equality +open import foundation.propositions +open import foundation.unit-type +open import foundation.universe-levels + +open import group-theory.commutative-semigroups +open import group-theory.sums-of-finite-sequences-of-elements-semigroups + +open import linear-algebra.finite-sequences-in-commutative-semigroups + +open import lists.lists + +open import univalent-combinatorics.coproduct-types +open import univalent-combinatorics.finite-types +open import univalent-combinatorics.standard-finite-types +``` + +
+ +## Idea + +The +{{#concept "sum operation" Disambiguation="of a finite sequence in a commutative semigroup" WD="sum" WDID=Q218005 Agda=sum-fin-sequence-type-Commutative-Semigroup}} +extends the binary operation on a +[commutative semigroup](group-theory.commutative-semigroups.md) `G` to any +[finite sequence](lists.finite-sequences.md) of elements of `G`. + +We use additive terminology consistently with the linear algebra definition of +[finite sequences in commutative semigroups](linear-algebra.finite-sequences-in-commutative-semigroups.md) +despite the use of multiplicative terminology for commutative semigroups in +general. + +## Definition + +```agda +sum-fin-sequence-type-Commutative-Semigroup : + {l : Level} (G : Commutative-Semigroup l) (n : ℕ) → + fin-sequence-type-Commutative-Semigroup G (succ-ℕ n) → + type-Commutative-Semigroup G +sum-fin-sequence-type-Commutative-Semigroup G = + sum-fin-sequence-type-Semigroup (semigroup-Commutative-Semigroup G) +``` + +## Properties + +### Sums are homotopy invariant + +```agda +module _ + {l : Level} (G : Commutative-Semigroup l) + where + + htpy-sum-fin-sequence-type-Commutative-Semigroup : + (n : ℕ) {f g : fin-sequence-type-Commutative-Semigroup G (succ-ℕ n)} → + (f ~ g) → + sum-fin-sequence-type-Commutative-Semigroup G n f = + sum-fin-sequence-type-Commutative-Semigroup G n g + htpy-sum-fin-sequence-type-Commutative-Semigroup = + htpy-sum-fin-sequence-type-Semigroup (semigroup-Commutative-Semigroup G) +``` + +### Splitting sums of `succ-ℕ n + succ-ℕ m` elements into a sum of `succ-ℕ n` elements and a sum of `succ-ℕ m` elements + +```agda +split-sum-fin-sequence-type-Commutative-Semigroup : + {l : Level} (G : Commutative-Semigroup l) + (n m : ℕ) → + (f : fin-sequence-type-Commutative-Semigroup G (succ-ℕ n +ℕ succ-ℕ m)) → + sum-fin-sequence-type-Commutative-Semigroup G (succ-ℕ n +ℕ m) f = + mul-Commutative-Semigroup G + ( sum-fin-sequence-type-Commutative-Semigroup G n + ( f ∘ inl-coproduct-Fin (succ-ℕ n) (succ-ℕ m))) + ( sum-fin-sequence-type-Commutative-Semigroup G m + ( f ∘ inr-coproduct-Fin (succ-ℕ n) (succ-ℕ m))) +split-sum-fin-sequence-type-Commutative-Semigroup G = + split-sum-fin-sequence-type-Semigroup (semigroup-Commutative-Semigroup G) +``` + +### Permutations preserve sums + +```agda +module _ + {l : Level} (G : Commutative-Semigroup l) + where + + abstract + preserves-sum-adjacent-transposition-sum-fin-sequence-type-Commutative-Semigroup : + (n : ℕ) → (k : Fin n) → + (f : fin-sequence-type-Commutative-Semigroup G (succ-ℕ n)) → + sum-fin-sequence-type-Commutative-Semigroup G n f = + sum-fin-sequence-type-Commutative-Semigroup + G n (f ∘ map-adjacent-transposition-Fin n k) + preserves-sum-adjacent-transposition-sum-fin-sequence-type-Commutative-Semigroup + (succ-ℕ n) (inl x) f = + ap-mul-Commutative-Semigroup + ( G) + ( preserves-sum-adjacent-transposition-sum-fin-sequence-type-Commutative-Semigroup + ( n) + ( x) + ( f ∘ inl-Fin (succ-ℕ n))) + ( refl) + preserves-sum-adjacent-transposition-sum-fin-sequence-type-Commutative-Semigroup + (succ-ℕ (succ-ℕ n)) (inr star) f = + right-swap-mul-Commutative-Semigroup G _ _ _ + preserves-sum-adjacent-transposition-sum-fin-sequence-type-Commutative-Semigroup + (succ-ℕ zero-ℕ) (inr star) f = + commutative-mul-Commutative-Semigroup G _ _ + + preserves-sum-permutation-list-adjacent-transpositions-Commutative-Semigroup : + (n : ℕ) → (L : list (Fin n)) → + (f : fin-sequence-type-Commutative-Semigroup G (succ-ℕ n)) → + sum-fin-sequence-type-Commutative-Semigroup G n f = + sum-fin-sequence-type-Commutative-Semigroup + G n (f ∘ map-permutation-list-adjacent-transpositions n L) + preserves-sum-permutation-list-adjacent-transpositions-Commutative-Semigroup + n nil f = refl + preserves-sum-permutation-list-adjacent-transpositions-Commutative-Semigroup + n (cons x L) f = + preserves-sum-adjacent-transposition-sum-fin-sequence-type-Commutative-Semigroup + ( n) + ( x) + ( f) ∙ + preserves-sum-permutation-list-adjacent-transpositions-Commutative-Semigroup + ( n) + ( L) + ( f ∘ map-adjacent-transposition-Fin n x) + + preserves-sum-transposition-Commutative-Semigroup : + (n : ℕ) (i j : Fin (succ-ℕ n)) (neq : i ≠ j) → + (f : fin-sequence-type-Commutative-Semigroup G (succ-ℕ n)) → + sum-fin-sequence-type-Commutative-Semigroup G n f = + sum-fin-sequence-type-Commutative-Semigroup + G n (f ∘ map-transposition-Fin (succ-ℕ n) i j neq) + preserves-sum-transposition-Commutative-Semigroup n i j i≠j f = + preserves-sum-permutation-list-adjacent-transpositions-Commutative-Semigroup + ( n) + ( list-adjacent-transpositions-transposition-Fin n i j) + ( f) ∙ + ap + ( λ g → + sum-fin-sequence-type-Commutative-Semigroup G + ( n) + ( f ∘ map-equiv g)) + ( eq-permutation-list-adjacent-transpositions-transposition-Fin + ( n) + ( i) + ( j) + ( i≠j)) + + preserves-sum-permutation-list-standard-transpositions-Commutative-Semigroup : + (n : ℕ) → + (L : list (Σ (Fin (succ-ℕ n) × Fin (succ-ℕ n)) ( λ (i , j) → i ≠ j))) → + (f : fin-sequence-type-Commutative-Semigroup G (succ-ℕ n)) → + sum-fin-sequence-type-Commutative-Semigroup G n f = + sum-fin-sequence-type-Commutative-Semigroup + G n + ( f ∘ + map-equiv (permutation-list-standard-transpositions-Fin (succ-ℕ n) L)) + preserves-sum-permutation-list-standard-transpositions-Commutative-Semigroup + zero-ℕ _ f = ap f (eq-is-prop is-prop-Fin-1) + preserves-sum-permutation-list-standard-transpositions-Commutative-Semigroup + (succ-ℕ n) nil f = refl + preserves-sum-permutation-list-standard-transpositions-Commutative-Semigroup + (succ-ℕ n) (cons ((i , j) , i≠j) L) f = + preserves-sum-transposition-Commutative-Semigroup (succ-ℕ n) i j i≠j f ∙ + preserves-sum-permutation-list-standard-transpositions-Commutative-Semigroup + ( succ-ℕ n) + ( L) + ( f ∘ map-transposition-Fin (succ-ℕ (succ-ℕ n)) i j i≠j) + + preserves-sum-permutation-fin-sequence-type-Commutative-Semigroup : + (n : ℕ) → (σ : Permutation (succ-ℕ n)) → + (f : fin-sequence-type-Commutative-Semigroup G (succ-ℕ n)) → + sum-fin-sequence-type-Commutative-Semigroup G n f = + sum-fin-sequence-type-Commutative-Semigroup G n (f ∘ map-equiv σ) + preserves-sum-permutation-fin-sequence-type-Commutative-Semigroup n σ f = + preserves-sum-permutation-list-standard-transpositions-Commutative-Semigroup + ( n) + ( list-standard-transpositions-permutation-Fin (succ-ℕ n) σ) + ( f) ∙ + ap + ( λ τ → + sum-fin-sequence-type-Commutative-Semigroup G n (f ∘ map-equiv τ)) + ( eq-permutation-list-standard-transpositions-Fin (succ-ℕ n) σ) +``` + +## See also + +- [Sums of finite families of elements in commutative monoids](group-theory.sums-of-finite-families-of-elements-commutative-monoids.md) diff --git a/src/group-theory/sums-of-finite-sequences-of-elements-monoids.lagda.md b/src/group-theory/sums-of-finite-sequences-of-elements-monoids.lagda.md index 6d277f800e..afd1e75347 100644 --- a/src/group-theory/sums-of-finite-sequences-of-elements-monoids.lagda.md +++ b/src/group-theory/sums-of-finite-sequences-of-elements-monoids.lagda.md @@ -36,6 +36,10 @@ The operation extends the binary operation on a [monoid](group-theory.monoids.md) `M` to any [finite sequence](lists.finite-sequences.md) of elements of `M`. +We use additive terminology consistently with the linear algebra definition of +[finite sequences in monoids](linear-algebra.finite-sequences-in-monoids.md) +despite the use of multiplicative terminology for monoids in general. + ## Definition ```agda diff --git a/src/group-theory/sums-of-finite-sequences-of-elements-semigroups.lagda.md b/src/group-theory/sums-of-finite-sequences-of-elements-semigroups.lagda.md new file mode 100644 index 0000000000..eff2ed8f5e --- /dev/null +++ b/src/group-theory/sums-of-finite-sequences-of-elements-semigroups.lagda.md @@ -0,0 +1,94 @@ +# Sums of finite sequences of elements in semigroups + +```agda +module group-theory.sums-of-finite-sequences-of-elements-semigroups where +``` + +
Imports + +```agda +open import elementary-number-theory.addition-natural-numbers +open import elementary-number-theory.natural-numbers + +open import foundation.action-on-identifications-functions +open import foundation.coproduct-types +open import foundation.function-extensionality +open import foundation.function-types +open import foundation.homotopies +open import foundation.identity-types +open import foundation.unit-type +open import foundation.universe-levels +open import foundation.whiskering-homotopies-composition + +open import group-theory.semigroups + +open import linear-algebra.finite-sequences-in-semigroups + +open import univalent-combinatorics.coproduct-types +open import univalent-combinatorics.standard-finite-types +``` + +
+ +## Idea + +The +{{#concept "sum operation" Disambiguation="of a finite sequence in a semigroup" WD="sum" WDID=Q218005 Agda=sum-fin-sequence-type-Semigroup}} +extends the binary operation on a [semigroup](group-theory.semigroups.md) `G` to +any nonempty [finite sequence](lists.finite-sequences.md) of elements of `G`. + +We use additive terminology consistently with the linear algebra definition of +[finite sequences in semigroups](linear-algebra.finite-sequences-in-semigroups.md) +despite the use of multiplicative terminology for semigroups in general. + +## Definition + +```agda +sum-fin-sequence-type-Semigroup : + {l : Level} (G : Semigroup l) (n : ℕ) → + fin-sequence-type-Semigroup G (succ-ℕ n) → type-Semigroup G +sum-fin-sequence-type-Semigroup G zero-ℕ f = f (inr star) +sum-fin-sequence-type-Semigroup G (succ-ℕ n) f = + mul-Semigroup G + ( sum-fin-sequence-type-Semigroup G n (f ∘ inl-Fin (succ-ℕ n))) + ( f (inr star)) +``` + +## Properties + +### Sums are homotopy invariant + +```agda +module _ + {l : Level} (G : Semigroup l) + where + + htpy-sum-fin-sequence-type-Semigroup : + (n : ℕ) → {f g : fin-sequence-type-Semigroup G (succ-ℕ n)} → + f ~ g → + sum-fin-sequence-type-Semigroup G n f = + sum-fin-sequence-type-Semigroup G n g + htpy-sum-fin-sequence-type-Semigroup n f~g = + ap (sum-fin-sequence-type-Semigroup G n) (eq-htpy f~g) +``` + +### Splitting sums of `succ-ℕ n + succ-ℕ m` elements into a sum of `succ-ℕ n` elements and a sum of `succ-ℕ m` elements + +```agda +abstract + split-sum-fin-sequence-type-Semigroup : + {l : Level} (G : Semigroup l) + (n m : ℕ) (f : fin-sequence-type-Semigroup G (succ-ℕ n +ℕ succ-ℕ m)) → + sum-fin-sequence-type-Semigroup G (succ-ℕ n +ℕ m) f = + mul-Semigroup G + ( sum-fin-sequence-type-Semigroup G n + ( f ∘ inl-coproduct-Fin (succ-ℕ n) (succ-ℕ m))) + ( sum-fin-sequence-type-Semigroup G m + ( f ∘ inr-coproduct-Fin (succ-ℕ n) (succ-ℕ m))) + split-sum-fin-sequence-type-Semigroup G n zero-ℕ f = refl + split-sum-fin-sequence-type-Semigroup G n (succ-ℕ m) f = + ap-mul-Semigroup G + ( split-sum-fin-sequence-type-Semigroup G n m (f ∘ inl)) + ( refl) ∙ + associative-mul-Semigroup G _ _ _ +``` diff --git a/src/linear-algebra.lagda.md b/src/linear-algebra.lagda.md index f9a8aca473..ba77a60ccd 100644 --- a/src/linear-algebra.lagda.md +++ b/src/linear-algebra.lagda.md @@ -11,10 +11,12 @@ open import linear-algebra.dependent-products-left-modules-rings public open import linear-algebra.diagonal-matrices-on-rings public open import linear-algebra.finite-sequences-in-commutative-monoids public open import linear-algebra.finite-sequences-in-commutative-rings public +open import linear-algebra.finite-sequences-in-commutative-semigroups public open import linear-algebra.finite-sequences-in-commutative-semirings public open import linear-algebra.finite-sequences-in-euclidean-domains public open import linear-algebra.finite-sequences-in-monoids public open import linear-algebra.finite-sequences-in-rings public +open import linear-algebra.finite-sequences-in-semigroups public open import linear-algebra.finite-sequences-in-semirings public open import linear-algebra.functoriality-matrices public open import linear-algebra.left-modules-rings public diff --git a/src/linear-algebra/finite-sequences-in-commutative-semigroups.lagda.md b/src/linear-algebra/finite-sequences-in-commutative-semigroups.lagda.md new file mode 100644 index 0000000000..4339b8bf73 --- /dev/null +++ b/src/linear-algebra/finite-sequences-in-commutative-semigroups.lagda.md @@ -0,0 +1,113 @@ +# Finite sequences in commutative semigroups + +```agda +module linear-algebra.finite-sequences-in-commutative-semigroups where +``` + +
Imports + +```agda +open import elementary-number-theory.natural-numbers + +open import foundation.action-on-identifications-binary-functions +open import foundation.dependent-pair-types +open import foundation.function-extensionality +open import foundation.identity-types +open import foundation.universe-levels + +open import group-theory.commutative-semigroups +open import group-theory.semigroups + +open import linear-algebra.finite-sequences-in-semigroups +``` + +
+ +## Idea + +Given a [commutative semigroup](group-theory.commutative-semigroups.md) `G`, the +type `fin-sequence n G` of [finite sequences](lists.finite-sequences.md) of +length `n` of elements of `G` is a commutative semigroup given by componentwise +addition. + +We use additive terminology for vectors, as is standard in linear algebra +contexts, despite using multiplicative terminology for semigroups. + +## Definitions + +```agda +module _ + {l : Level} (M : Commutative-Semigroup l) + where + + fin-sequence-type-Commutative-Semigroup : ℕ → UU l + fin-sequence-type-Commutative-Semigroup = + fin-sequence-type-Semigroup (semigroup-Commutative-Semigroup M) + + head-fin-sequence-type-Commutative-Semigroup : + (n : ℕ) → fin-sequence-type-Commutative-Semigroup (succ-ℕ n) → + type-Commutative-Semigroup M + head-fin-sequence-type-Commutative-Semigroup = + head-fin-sequence-type-Semigroup (semigroup-Commutative-Semigroup M) + + tail-fin-sequence-type-Commutative-Semigroup : + (n : ℕ) → fin-sequence-type-Commutative-Semigroup (succ-ℕ n) → + fin-sequence-type-Commutative-Semigroup n + tail-fin-sequence-type-Commutative-Semigroup = + tail-fin-sequence-type-Semigroup (semigroup-Commutative-Semigroup M) + + cons-fin-sequence-type-Commutative-Semigroup : + (n : ℕ) → type-Commutative-Semigroup M → + fin-sequence-type-Commutative-Semigroup n → + fin-sequence-type-Commutative-Semigroup (succ-ℕ n) + cons-fin-sequence-type-Commutative-Semigroup = + cons-fin-sequence-type-Semigroup (semigroup-Commutative-Semigroup M) + + snoc-fin-sequence-type-Commutative-Semigroup : + (n : ℕ) → fin-sequence-type-Commutative-Semigroup n → + type-Commutative-Semigroup M → + fin-sequence-type-Commutative-Semigroup (succ-ℕ n) + snoc-fin-sequence-type-Commutative-Semigroup = + snoc-fin-sequence-type-Semigroup (semigroup-Commutative-Semigroup M) +``` + +### Pointwise addition of finite sequences in a commutative semigroup + +```agda +module _ + {l : Level} (M : Commutative-Semigroup l) + where + + add-fin-sequence-type-Commutative-Semigroup : + (n : ℕ) (v w : fin-sequence-type-Commutative-Semigroup M n) → + fin-sequence-type-Commutative-Semigroup M n + add-fin-sequence-type-Commutative-Semigroup = + add-fin-sequence-type-Semigroup (semigroup-Commutative-Semigroup M) + + associative-add-fin-sequence-type-Commutative-Semigroup : + (n : ℕ) (v1 v2 v3 : fin-sequence-type-Commutative-Semigroup M n) → + ( add-fin-sequence-type-Commutative-Semigroup n + ( add-fin-sequence-type-Commutative-Semigroup n v1 v2) v3) = + ( add-fin-sequence-type-Commutative-Semigroup n v1 + ( add-fin-sequence-type-Commutative-Semigroup n v2 v3)) + associative-add-fin-sequence-type-Commutative-Semigroup = + associative-add-fin-sequence-type-Semigroup + ( semigroup-Commutative-Semigroup M) + + semigroup-fin-sequence-type-Commutative-Semigroup : ℕ → Semigroup l + semigroup-fin-sequence-type-Commutative-Semigroup = + semigroup-fin-sequence-type-Semigroup (semigroup-Commutative-Semigroup M) + + commutative-add-fin-sequence-type-Commutative-Semigroup : + (n : ℕ) (v w : fin-sequence-type-Commutative-Semigroup M n) → + add-fin-sequence-type-Commutative-Semigroup n v w = + add-fin-sequence-type-Commutative-Semigroup n w v + commutative-add-fin-sequence-type-Commutative-Semigroup _ _ _ = + eq-htpy (λ k → commutative-mul-Commutative-Semigroup M _ _) + + commutative-semigroup-fin-sequence-type-Commutative-Semigroup : + ℕ → Commutative-Semigroup l + commutative-semigroup-fin-sequence-type-Commutative-Semigroup n = + semigroup-fin-sequence-type-Commutative-Semigroup n , + commutative-add-fin-sequence-type-Commutative-Semigroup n +``` diff --git a/src/linear-algebra/finite-sequences-in-monoids.lagda.md b/src/linear-algebra/finite-sequences-in-monoids.lagda.md index 10a6759efa..401624ba8f 100644 --- a/src/linear-algebra/finite-sequences-in-monoids.lagda.md +++ b/src/linear-algebra/finite-sequences-in-monoids.lagda.md @@ -18,6 +18,8 @@ open import foundation.universe-levels open import group-theory.monoids open import group-theory.semigroups +open import linear-algebra.finite-sequences-in-semigroups + open import lists.finite-sequences open import lists.functoriality-finite-sequences ``` @@ -90,16 +92,12 @@ module _ ( add-fin-sequence-type-Monoid n v1 v2) ( v3)) = ( add-fin-sequence-type-Monoid n v1 (add-fin-sequence-type-Monoid n v2 v3)) - associative-add-fin-sequence-type-Monoid n v1 v2 v3 = - eq-htpy (λ i → associative-mul-Monoid M (v1 i) (v2 i) (v3 i)) + associative-add-fin-sequence-type-Monoid = + associative-add-fin-sequence-type-Semigroup (semigroup-Monoid M) semigroup-fin-sequence-type-Monoid : ℕ → Semigroup l - pr1 (semigroup-fin-sequence-type-Monoid n) = - fin-sequence-Set (set-Monoid M) n - pr1 (pr2 (semigroup-fin-sequence-type-Monoid n)) = - add-fin-sequence-type-Monoid n - pr2 (pr2 (semigroup-fin-sequence-type-Monoid n)) = - associative-add-fin-sequence-type-Monoid n + semigroup-fin-sequence-type-Monoid = + semigroup-fin-sequence-type-Semigroup (semigroup-Monoid M) left-unit-law-add-fin-sequence-type-Monoid : (n : ℕ) (v : fin-sequence-type-Monoid M n) → diff --git a/src/linear-algebra/finite-sequences-in-semigroups.lagda.md b/src/linear-algebra/finite-sequences-in-semigroups.lagda.md new file mode 100644 index 0000000000..024679b333 --- /dev/null +++ b/src/linear-algebra/finite-sequences-in-semigroups.lagda.md @@ -0,0 +1,97 @@ +# Finite sequences in semigroups + +```agda +module linear-algebra.finite-sequences-in-semigroups where +``` + +
Imports + +```agda +open import elementary-number-theory.natural-numbers + +open import foundation.action-on-identifications-binary-functions +open import foundation.dependent-pair-types +open import foundation.function-extensionality +open import foundation.identity-types +open import foundation.universe-levels + +open import group-theory.semigroups + +open import lists.finite-sequences +open import lists.functoriality-finite-sequences +``` + +
+ +## Idea + +Given a [semigroup](group-theory.monoids.md) `G`, the type `fin-sequence n G` of +[finite sequences](lists.finite-sequences.md) of length `n` of elements of `G` +is a semigroup given by componentwise multiplication. + +We use additive terminology for finite sequences, as is standard in linear +algebra contexts, despite using multiplicative terminology for semigroups. + +## Definitions + +```agda +module _ + {l : Level} (G : Semigroup l) + where + + fin-sequence-type-Semigroup : ℕ → UU l + fin-sequence-type-Semigroup = fin-sequence (type-Semigroup G) + + head-fin-sequence-type-Semigroup : + (n : ℕ) → fin-sequence-type-Semigroup (succ-ℕ n) → type-Semigroup G + head-fin-sequence-type-Semigroup n v = head-fin-sequence n v + + tail-fin-sequence-type-Semigroup : + (n : ℕ) → fin-sequence-type-Semigroup (succ-ℕ n) → + fin-sequence-type-Semigroup n + tail-fin-sequence-type-Semigroup = tail-fin-sequence + + cons-fin-sequence-type-Semigroup : + (n : ℕ) → type-Semigroup G → + fin-sequence-type-Semigroup n → + fin-sequence-type-Semigroup (succ-ℕ n) + cons-fin-sequence-type-Semigroup = cons-fin-sequence + + snoc-fin-sequence-type-Semigroup : + (n : ℕ) → fin-sequence-type-Semigroup n → type-Semigroup G → + fin-sequence-type-Semigroup (succ-ℕ n) + snoc-fin-sequence-type-Semigroup = snoc-fin-sequence +``` + +### Pointwise addition of finite sequences in a semigroup + +```agda +module _ + {l : Level} (G : Semigroup l) + where + + add-fin-sequence-type-Semigroup : + (n : ℕ) (v w : fin-sequence-type-Semigroup G n) → + fin-sequence-type-Semigroup G n + add-fin-sequence-type-Semigroup n = + binary-map-fin-sequence n (mul-Semigroup G) + + associative-add-fin-sequence-type-Semigroup : + (n : ℕ) (v1 v2 v3 : fin-sequence-type-Semigroup G n) → + ( add-fin-sequence-type-Semigroup n + ( add-fin-sequence-type-Semigroup n v1 v2) + ( v3)) = + ( add-fin-sequence-type-Semigroup n + ( v1) + ( add-fin-sequence-type-Semigroup n v2 v3)) + associative-add-fin-sequence-type-Semigroup n v1 v2 v3 = + eq-htpy (λ i → associative-mul-Semigroup G (v1 i) (v2 i) (v3 i)) + + semigroup-fin-sequence-type-Semigroup : ℕ → Semigroup l + pr1 (semigroup-fin-sequence-type-Semigroup n) = + fin-sequence-Set (set-Semigroup G) n + pr1 (pr2 (semigroup-fin-sequence-type-Semigroup n)) = + add-fin-sequence-type-Semigroup n + pr2 (pr2 (semigroup-fin-sequence-type-Semigroup n)) = + associative-add-fin-sequence-type-Semigroup n +``` diff --git a/src/univalent-combinatorics.lagda.md b/src/univalent-combinatorics.lagda.md index 0975e705a7..76959e89e4 100644 --- a/src/univalent-combinatorics.lagda.md +++ b/src/univalent-combinatorics.lagda.md @@ -34,6 +34,7 @@ open import univalent-combinatorics.cartesian-product-types public open import univalent-combinatorics.classical-finite-types public open import univalent-combinatorics.complements-isolated-elements public open import univalent-combinatorics.coproduct-types public +open import univalent-combinatorics.coproducts-inhabited-finite-types public open import univalent-combinatorics.counting public open import univalent-combinatorics.counting-decidable-subtypes public open import univalent-combinatorics.counting-dependent-pair-types public diff --git a/src/univalent-combinatorics/coproducts-inhabited-finite-types.lagda.md b/src/univalent-combinatorics/coproducts-inhabited-finite-types.lagda.md new file mode 100644 index 0000000000..5a7cf3075f --- /dev/null +++ b/src/univalent-combinatorics/coproducts-inhabited-finite-types.lagda.md @@ -0,0 +1,40 @@ +# Coproducts of inhabited finite types + +```agda +module univalent-combinatorics.coproducts-inhabited-finite-types where +``` + +
Imports + +```agda +open import foundation.coproduct-types +open import foundation.dependent-pair-types +open import foundation.inhabited-types +open import foundation.universe-levels + +open import univalent-combinatorics.coproduct-types +open import univalent-combinatorics.finite-types +open import univalent-combinatorics.inhabited-finite-types +``` + +
+ +## Idea + +The [coproduct](univalent-combinatorics.coproduct-types.md) of two +[inhabited finite types](univalent-combinatorics.inhabited-finite-types.md) is +itself an inhabited finite type. + +## Definition + +```agda +coproduct-Inhabited-Finite-Type : + {l1 l2 : Level} → Inhabited-Finite-Type l1 → Inhabited-Finite-Type l2 → + Inhabited-Finite-Type (l1 ⊔ l2) +pr1 (coproduct-Inhabited-Finite-Type X Y) = + coproduct-Finite-Type + ( finite-type-Inhabited-Finite-Type X) + ( finite-type-Inhabited-Finite-Type Y) +pr2 (coproduct-Inhabited-Finite-Type X Y) = + map-is-inhabited inl (is-inhabited-type-Inhabited-Finite-Type X) +``` diff --git a/src/univalent-combinatorics/inhabited-finite-types.lagda.md b/src/univalent-combinatorics/inhabited-finite-types.lagda.md index f6ad56cab3..8fb4593a19 100644 --- a/src/univalent-combinatorics/inhabited-finite-types.lagda.md +++ b/src/univalent-combinatorics/inhabited-finite-types.lagda.md @@ -151,9 +151,15 @@ compute-Fam-Inhabited-Finite-Type X = ### Equality in inhabited finite types ```agda +equiv-Inhabited-Finite-Type : + {l1 l2 : Level} → Inhabited-Finite-Type l1 → Inhabited-Finite-Type l2 → + UU (l1 ⊔ l2) +equiv-Inhabited-Finite-Type X Y = + type-Inhabited-Finite-Type X ≃ type-Inhabited-Finite-Type Y + eq-equiv-Inhabited-Finite-Type : {l : Level} → (X Y : Inhabited-Finite-Type l) → - type-Inhabited-Finite-Type X ≃ type-Inhabited-Finite-Type Y → X = Y + equiv-Inhabited-Finite-Type X Y → X = Y eq-equiv-Inhabited-Finite-Type X Y e = eq-type-subtype ( λ X → is-inhabited-Prop (type-Finite-Type X)) From a46fed72ac9470cf09c9042d160630ae5ae80194 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Sun, 31 Aug 2025 13:32:01 -0700 Subject: [PATCH 35/97] Joins and meets of finite families of elements (#1506) Depends on #1494. --- src/order-theory.lagda.md | 2 + src/order-theory/join-semilattices.lagda.md | 91 +++--- ...finite-families-join-semilattices.lagda.md | 275 ++++++++++++++++++ .../least-upper-bounds-posets.lagda.md | 42 +++ src/order-theory/meet-semilattices.lagda.md | 90 +++--- ...finite-families-meet-semilattices.lagda.md | 261 +++++++++++++++++ 6 files changed, 673 insertions(+), 88 deletions(-) create mode 100644 src/order-theory/joins-finite-families-join-semilattices.lagda.md create mode 100644 src/order-theory/meets-finite-families-meet-semilattices.lagda.md diff --git a/src/order-theory.lagda.md b/src/order-theory.lagda.md index e6a524d528..2f52667af4 100644 --- a/src/order-theory.lagda.md +++ b/src/order-theory.lagda.md @@ -62,6 +62,7 @@ open import order-theory.inhabited-finite-total-orders public open import order-theory.interval-subposets public open import order-theory.join-preserving-maps-posets public open import order-theory.join-semilattices public +open import order-theory.joins-finite-families-join-semilattices public open import order-theory.knaster-tarski-fixed-point-theorem public open import order-theory.large-frames public open import order-theory.large-inflattices public @@ -92,6 +93,7 @@ open import order-theory.maximal-chains-posets public open import order-theory.maximal-chains-preorders public open import order-theory.meet-semilattices public open import order-theory.meet-suplattices public +open import order-theory.meets-finite-families-meet-semilattices public open import order-theory.nuclei-large-locales public open import order-theory.opposite-large-posets public open import order-theory.opposite-large-preorders public diff --git a/src/order-theory/join-semilattices.lagda.md b/src/order-theory/join-semilattices.lagda.md index 99c21de189..20a7bafde1 100644 --- a/src/order-theory/join-semilattices.lagda.md +++ b/src/order-theory/join-semilattices.lagda.md @@ -17,6 +17,7 @@ open import foundation.sets open import foundation.subtypes open import foundation.universe-levels +open import group-theory.commutative-semigroups open import group-theory.semigroups open import order-theory.least-upper-bounds-posets @@ -29,10 +30,12 @@ open import order-theory.upper-bounds-posets ## Idea -A **join-semilattice** is a poset in which every pair of elements has a least -binary upper bound. Alternatively, join-semilattices can be defined -algebraically as a set `X` equipped with a binary operation `∧ : X → X → X` -satisfying +A +{{#concept "join-semilattice" WDID=Q29018101 WD="upper semilattice" Agda=Join-Semilattice}} +is a [poset](order-theory.posets.md) in which every pair of elements has a +[least binary upper bound](order-theory.least-upper-bounds-posets.md). +Alternatively, join-semilattices can be defined algebraically as a set `X` +equipped with a binary operation `∧ : X → X → X` satisfying 1. Asociativity: `(x ∧ y) ∧ z = x ∧ (y ∧ z)`, 2. Commutativity: `x ∧ y = y ∧ x`, @@ -46,56 +49,49 @@ requires only one universe level. This is necessary in order to consider the ## Definitions -### The predicate on semigroups of being a join-semilattice +### The predicate on commutative semigroups of being a join-semilattice ```agda module _ - {l : Level} (X : Semigroup l) + {l : Level} (X : Commutative-Semigroup l) where - is-join-semilattice-prop-Semigroup : Prop l - is-join-semilattice-prop-Semigroup = - product-Prop - ( Π-Prop - ( type-Semigroup X) - ( λ x → - Π-Prop - ( type-Semigroup X) - ( λ y → - Id-Prop - ( set-Semigroup X) - ( mul-Semigroup X x y) - ( mul-Semigroup X y x)))) - ( Π-Prop - ( type-Semigroup X) - ( λ x → - Id-Prop - ( set-Semigroup X) - ( mul-Semigroup X x x) - ( x))) - - is-join-semilattice-Semigroup : UU l - is-join-semilattice-Semigroup = - type-Prop is-join-semilattice-prop-Semigroup - - is-prop-is-join-semilattice-Semigroup : - is-prop is-join-semilattice-Semigroup - is-prop-is-join-semilattice-Semigroup = - is-prop-type-Prop is-join-semilattice-prop-Semigroup + is-join-semilattice-prop-Commutative-Semigroup : Prop l + is-join-semilattice-prop-Commutative-Semigroup = + Π-Prop + ( type-Commutative-Semigroup X) + ( λ x → + Id-Prop + ( set-Commutative-Semigroup X) + ( mul-Commutative-Semigroup X x x) + ( x)) + + is-join-semilattice-Commutative-Semigroup : UU l + is-join-semilattice-Commutative-Semigroup = + type-Prop is-join-semilattice-prop-Commutative-Semigroup + + is-prop-is-join-semilattice-Commutative-Semigroup : + is-prop is-join-semilattice-Commutative-Semigroup + is-prop-is-join-semilattice-Commutative-Semigroup = + is-prop-type-Prop is-join-semilattice-prop-Commutative-Semigroup ``` ### The algebraic definition of join-semilattices ```agda Join-Semilattice : (l : Level) → UU (lsuc l) -Join-Semilattice l = type-subtype is-join-semilattice-prop-Semigroup +Join-Semilattice l = type-subtype is-join-semilattice-prop-Commutative-Semigroup module _ {l : Level} (X : Join-Semilattice l) where + commutative-semigroup-Join-Semilattice : Commutative-Semigroup l + commutative-semigroup-Join-Semilattice = pr1 X + semigroup-Join-Semilattice : Semigroup l - semigroup-Join-Semilattice = pr1 X + semigroup-Join-Semilattice = + semigroup-Commutative-Semigroup commutative-semigroup-Join-Semilattice set-Join-Semilattice : Set l set-Join-Semilattice = set-Semigroup semigroup-Join-Semilattice @@ -122,18 +118,20 @@ module _ associative-mul-Semigroup semigroup-Join-Semilattice is-join-semilattice-Join-Semilattice : - is-join-semilattice-Semigroup semigroup-Join-Semilattice + is-join-semilattice-Commutative-Semigroup + ( commutative-semigroup-Join-Semilattice) is-join-semilattice-Join-Semilattice = pr2 X commutative-join-Join-Semilattice : (x y : type-Join-Semilattice) → (x ∨ y) = (y ∨ x) commutative-join-Join-Semilattice = - pr1 is-join-semilattice-Join-Semilattice + commutative-mul-Commutative-Semigroup + ( commutative-semigroup-Join-Semilattice) idempotent-join-Join-Semilattice : (x : type-Join-Semilattice) → (x ∨ x) = x idempotent-join-Join-Semilattice = - pr2 is-join-semilattice-Join-Semilattice + pr2 X leq-Join-Semilattice-Prop : (x y : type-Join-Semilattice) → Prop l @@ -655,12 +653,17 @@ module _ pr2 (pr2 semigroup-Order-Theoretic-Join-Semilattice) = associative-join-Order-Theoretic-Join-Semilattice A + commutative-semigroup-Order-Theoretic-Join-Semilattice : + Commutative-Semigroup l1 + pr1 commutative-semigroup-Order-Theoretic-Join-Semilattice = + semigroup-Order-Theoretic-Join-Semilattice + pr2 commutative-semigroup-Order-Theoretic-Join-Semilattice = + commutative-join-Order-Theoretic-Join-Semilattice A + join-semilattice-Order-Theoretic-Join-Semilattice : Join-Semilattice l1 pr1 join-semilattice-Order-Theoretic-Join-Semilattice = - semigroup-Order-Theoretic-Join-Semilattice - pr1 (pr2 join-semilattice-Order-Theoretic-Join-Semilattice) = - commutative-join-Order-Theoretic-Join-Semilattice A - pr2 (pr2 join-semilattice-Order-Theoretic-Join-Semilattice) = + commutative-semigroup-Order-Theoretic-Join-Semilattice + pr2 join-semilattice-Order-Theoretic-Join-Semilattice = idempotent-join-Order-Theoretic-Join-Semilattice A ``` diff --git a/src/order-theory/joins-finite-families-join-semilattices.lagda.md b/src/order-theory/joins-finite-families-join-semilattices.lagda.md new file mode 100644 index 0000000000..76b5cd7be4 --- /dev/null +++ b/src/order-theory/joins-finite-families-join-semilattices.lagda.md @@ -0,0 +1,275 @@ +# Joins of finite families of elements in join-semilattices + +```agda +module order-theory.joins-finite-families-join-semilattices where +``` + +
Imports + +```agda +open import elementary-number-theory.natural-numbers + +open import foundation.action-on-identifications-functions +open import foundation.coproduct-types +open import foundation.dependent-pair-types +open import foundation.empty-types +open import foundation.equivalences +open import foundation.function-types +open import foundation.functoriality-dependent-function-types +open import foundation.identity-types +open import foundation.inhabited-types +open import foundation.logical-equivalences +open import foundation.propositional-truncations +open import foundation.transport-along-identifications +open import foundation.unit-type +open import foundation.univalence +open import foundation.universe-levels + +open import group-theory.commutative-semigroups +open import group-theory.sums-of-finite-families-of-elements-commutative-semigroups +open import group-theory.sums-of-finite-sequences-of-elements-commutative-semigroups + +open import lists.finite-sequences + +open import order-theory.join-semilattices +open import order-theory.least-upper-bounds-posets + +open import univalent-combinatorics.counting +open import univalent-combinatorics.finite-types +open import univalent-combinatorics.inhabited-finite-types +open import univalent-combinatorics.standard-finite-types +``` + +
+ +## Idea + +In a [join-semilattice](order-theory.join-semilattices.md), the join of any +family of elements indexed by an +[inhabited finite type](univalent-combinatorics.inhabited-finite-types.md) is +their [least upper bound](order-theory.least-upper-bounds-posets.md). + +## Definition + +### The join of a finite sequence of elements + +```agda +module _ + {l1 l2 : Level} (X : Order-Theoretic-Join-Semilattice l1 l2) + where + + join-fin-sequence-type-Order-Theoretic-Join-Semilattice : + (n : ℕ) → + fin-sequence (type-Order-Theoretic-Join-Semilattice X) (succ-ℕ n) → + type-Order-Theoretic-Join-Semilattice X + join-fin-sequence-type-Order-Theoretic-Join-Semilattice = + sum-fin-sequence-type-Commutative-Semigroup + ( commutative-semigroup-Order-Theoretic-Join-Semilattice X) +``` + +### The join of a family of elements indexed by an inhabited counted type + +```agda +module _ + {l1 l2 : Level} (X : Order-Theoretic-Join-Semilattice l1 l2) + {l3 : Level} {I : UU l3} (|I| : is-inhabited I) (cI : count I) + where + + join-counted-family-type-Order-Theoretic-Join-Semilattice : + (f : I → type-Order-Theoretic-Join-Semilattice X) → + type-Order-Theoretic-Join-Semilattice X + join-counted-family-type-Order-Theoretic-Join-Semilattice = + sum-count-Commutative-Semigroup + ( commutative-semigroup-Order-Theoretic-Join-Semilattice X) + ( I) + ( |I|) + ( cI) +``` + +### The join of a family of elements indexed by an inhabited finite type + +```agda +module _ + {l1 l2 : Level} (X : Order-Theoretic-Join-Semilattice l1 l2) + {l3 : Level} (I : Inhabited-Finite-Type l3) + where + + join-inhabited-finite-family-Order-Theoretic-Join-Semilattice : + (f : + type-Inhabited-Finite-Type I → type-Order-Theoretic-Join-Semilattice X) → + type-Order-Theoretic-Join-Semilattice X + join-inhabited-finite-family-Order-Theoretic-Join-Semilattice = + sum-finite-Commutative-Semigroup + ( commutative-semigroup-Order-Theoretic-Join-Semilattice X) + ( I) +``` + +## Properties + +### The join of a nonempty finite sequence is its least upper bound + +```agda +module _ + {l1 l2 : Level} (X : Order-Theoretic-Join-Semilattice l1 l2) + where + + abstract + is-least-upper-bound-join-fin-sequence-type-Order-Theoretic-Join-Semilattice : + (n : ℕ) → + (x : fin-sequence (type-Order-Theoretic-Join-Semilattice X) (succ-ℕ n)) → + is-least-upper-bound-family-of-elements-Poset + ( poset-Order-Theoretic-Join-Semilattice X) + ( x) + ( join-fin-sequence-type-Order-Theoretic-Join-Semilattice X n x) + pr1 + ( is-least-upper-bound-join-fin-sequence-type-Order-Theoretic-Join-Semilattice + zero-ℕ x y) y≤xᵢ = + y≤xᵢ (neg-one-Fin 0) + pr2 + ( is-least-upper-bound-join-fin-sequence-type-Order-Theoretic-Join-Semilattice + zero-ℕ x y) y≤x₀ (inr star) = y≤x₀ + pr1 + ( is-least-upper-bound-join-fin-sequence-type-Order-Theoretic-Join-Semilattice + (succ-ℕ n) x y) y≤xᵢ = + leq-join-Order-Theoretic-Join-Semilattice X + ( forward-implication + ( is-least-upper-bound-join-fin-sequence-type-Order-Theoretic-Join-Semilattice + ( n) + ( x ∘ inl) + ( y)) + ( y≤xᵢ ∘ inl)) + ( y≤xᵢ (neg-one-Fin (succ-ℕ n))) + pr2 + ( is-least-upper-bound-join-fin-sequence-type-Order-Theoretic-Join-Semilattice + (succ-ℕ n) x y) max-x≤y (inr star) = + transitive-leq-Order-Theoretic-Join-Semilattice X (x (inr star)) _ y + ( max-x≤y) + ( leq-right-join-Order-Theoretic-Join-Semilattice X _ _) + pr2 + ( is-least-upper-bound-join-fin-sequence-type-Order-Theoretic-Join-Semilattice + (succ-ℕ n) x y) max-x≤y (inl i) = + backward-implication + ( is-least-upper-bound-join-fin-sequence-type-Order-Theoretic-Join-Semilattice + ( n) + ( x ∘ inl) + ( y)) + ( transitive-leq-Order-Theoretic-Join-Semilattice X _ _ y + ( max-x≤y) + ( leq-left-join-Order-Theoretic-Join-Semilattice X _ _)) + ( i) + + has-least-upper-bound-join-fin-sequence-type-Order-Theoretic-Join-Semilattice : + (n : ℕ) → + (x : fin-sequence (type-Order-Theoretic-Join-Semilattice X) (succ-ℕ n)) → + has-least-upper-bound-family-of-elements-Poset + ( poset-Order-Theoretic-Join-Semilattice X) + ( x) + has-least-upper-bound-join-fin-sequence-type-Order-Theoretic-Join-Semilattice + n x = + ( join-fin-sequence-type-Order-Theoretic-Join-Semilattice X n x , + is-least-upper-bound-join-fin-sequence-type-Order-Theoretic-Join-Semilattice + ( n) + ( x)) +``` + +### The join of a counted family of elements is its least upper bound + +```agda +abstract + is-least-upper-bound-join-counted-family-type-Order-Theoretic-Join-Semilattice : + {l1 l2 : Level} (X : Order-Theoretic-Join-Semilattice l1 l2) → + {l3 : Level} {I : UU l3} (|I| : is-inhabited I) (cI : count I) → + (f : I → type-Order-Theoretic-Join-Semilattice X) → + is-least-upper-bound-family-of-elements-Poset + ( poset-Order-Theoretic-Join-Semilattice X) + ( f) + ( join-counted-family-type-Order-Theoretic-Join-Semilattice X |I| cI f) + is-least-upper-bound-join-counted-family-type-Order-Theoretic-Join-Semilattice + X |I| cI@(zero-ℕ , _) _ = + ex-falso + ( is-nonempty-is-inhabited + ( |I|) + ( is-empty-is-zero-number-of-elements-count cI refl)) + is-least-upper-bound-join-counted-family-type-Order-Theoretic-Join-Semilattice + X |I| cI@(succ-ℕ n , Fin-sn≃I) f y = + is-least-upper-bound-join-fin-sequence-type-Order-Theoretic-Join-Semilattice + ( X) + ( n) + ( f ∘ map-equiv Fin-sn≃I) + ( y) ∘iff + iff-equiv + ( equiv-Π _ + ( inv-equiv Fin-sn≃I) + ( λ i → + equiv-eq + ( ap + ( λ j → leq-Order-Theoretic-Join-Semilattice X (f j) y) + ( inv (is-section-map-inv-equiv Fin-sn≃I i))))) +``` + +### The join of an inhabited finite family of elements is its join over any count for that family + +```agda +module _ + {l1 l2 l3 : Level} (X : Order-Theoretic-Join-Semilattice l1 l2) + (I : Inhabited-Finite-Type l3) (cI : count (type-Inhabited-Finite-Type I)) + (f : type-Inhabited-Finite-Type I → type-Order-Theoretic-Join-Semilattice X) + where + + abstract + eq-join-inhabited-finite-family-join-counted-family-Order-Theoretic-Join-Semilattice : + join-inhabited-finite-family-Order-Theoretic-Join-Semilattice X I f = + join-counted-family-type-Order-Theoretic-Join-Semilattice + ( X) + ( is-inhabited-type-Inhabited-Finite-Type I) + ( cI) + ( f) + eq-join-inhabited-finite-family-join-counted-family-Order-Theoretic-Join-Semilattice = + eq-sum-finite-sum-count-Commutative-Semigroup + ( commutative-semigroup-Order-Theoretic-Join-Semilattice X) + ( I) + ( cI) + ( f) +``` + +### The join of an inhabited finite family of elements is its least upper bound + +```agda +module _ + {l1 l2 l3 : Level} (X : Order-Theoretic-Join-Semilattice l1 l2) + (I : Inhabited-Finite-Type l3) + where + + abstract + is-least-upper-bound-join-inhabited-finite-family-Order-Theoretic-Join-Semilattice : + (f : + type-Inhabited-Finite-Type I → + type-Order-Theoretic-Join-Semilattice X) → + is-least-upper-bound-family-of-elements-Poset + ( poset-Order-Theoretic-Join-Semilattice X) + ( f) + ( join-inhabited-finite-family-Order-Theoretic-Join-Semilattice X I f) + is-least-upper-bound-join-inhabited-finite-family-Order-Theoretic-Join-Semilattice + f = + rec-trunc-Prop + ( is-least-upper-bound-family-of-elements-prop-Poset + ( poset-Order-Theoretic-Join-Semilattice X) + ( f) + ( _)) + ( λ cI → + inv-tr + ( is-least-upper-bound-family-of-elements-Poset + ( poset-Order-Theoretic-Join-Semilattice X) + ( f)) + ( eq-join-inhabited-finite-family-join-counted-family-Order-Theoretic-Join-Semilattice + ( X) + ( I) + ( cI) + ( f)) + ( is-least-upper-bound-join-counted-family-type-Order-Theoretic-Join-Semilattice + ( X) + ( is-inhabited-type-Inhabited-Finite-Type I) + ( cI) + ( f))) + ( is-finite-Inhabited-Finite-Type I) +``` diff --git a/src/order-theory/least-upper-bounds-posets.lagda.md b/src/order-theory/least-upper-bounds-posets.lagda.md index 2b428ad028..d4541381f2 100644 --- a/src/order-theory/least-upper-bounds-posets.lagda.md +++ b/src/order-theory/least-upper-bounds-posets.lagda.md @@ -328,6 +328,48 @@ module _ ( y , K)) ``` +### Least upper bounds of subsets of elements + +```agda +module _ + {l1 l2 l3 : Level} (P : Poset l1 l2) (S : subtype l3 (type-Poset P)) + where + + is-least-upper-bound-subset-prop-Poset : type-Poset P → Prop (l1 ⊔ l2 ⊔ l3) + is-least-upper-bound-subset-prop-Poset = + is-least-upper-bound-family-of-elements-prop-Poset P (inclusion-subtype S) + + is-least-upper-bound-subset-Poset : type-Poset P → UU (l1 ⊔ l2 ⊔ l3) + is-least-upper-bound-subset-Poset x = + type-Prop (is-least-upper-bound-subset-prop-Poset x) + + is-prop-is-least-upper-bound-subset-Poset : + (x : type-Poset P) → is-prop (is-least-upper-bound-subset-Poset x) + is-prop-is-least-upper-bound-subset-Poset x = + is-prop-type-Prop (is-least-upper-bound-subset-prop-Poset x) +``` + +### The proposition that a subset of elements have a least upper bound + +```agda +module _ + {l1 l2 l3 : Level} (P : Poset l1 l2) (S : subtype l3 (type-Poset P)) + where + + has-least-upper-bound-subset-prop-Poset : Prop (l1 ⊔ l2 ⊔ l3) + has-least-upper-bound-subset-prop-Poset = + has-least-upper-bound-family-of-elements-prop-Poset P (inclusion-subtype S) + + has-least-upper-bound-subset-Poset : UU (l1 ⊔ l2 ⊔ l3) + has-least-upper-bound-subset-Poset = + type-Prop has-least-upper-bound-subset-prop-Poset + + is-prop-has-least-upper-bound-subset-Poset : + is-prop has-least-upper-bound-subset-Poset + is-prop-has-least-upper-bound-subset-Poset = + is-prop-type-Prop has-least-upper-bound-subset-prop-Poset +``` + ## Properties ### Binary least upper bounds as least upper bounds of families diff --git a/src/order-theory/meet-semilattices.lagda.md b/src/order-theory/meet-semilattices.lagda.md index 69b25e8ad0..cac6495b25 100644 --- a/src/order-theory/meet-semilattices.lagda.md +++ b/src/order-theory/meet-semilattices.lagda.md @@ -17,6 +17,7 @@ open import foundation.sets open import foundation.subtypes open import foundation.universe-levels +open import group-theory.commutative-semigroups open import group-theory.isomorphisms-semigroups open import group-theory.semigroups @@ -30,10 +31,12 @@ open import order-theory.preorders ## Idea -A **meet-semilattice** is a poset in which every pair of elements has a greatest -binary-lower bound. Alternatively, meet-semilattices can be defined -algebraically as a set `X` equipped with a binary operation `∧ : X → X → X` -satisfying +A +{{#concept "meet-semilattice" WDID=Q29018102 WD="lower semilattice" Agda=Meet-Semilattice}} +is a [poset](order-theory.posets.md) in which every pair of elements has a +[greatest binary lower bound](order-theory.greatest-lower-bounds.md). +Alternatively, meet-semilattices can be defined algebraically as a set `X` +equipped with a binary operation `∧ : X → X → X` satisfying 1. Associativity: `(x ∧ y) ∧ z = x ∧ (y ∧ z)`, 2. Commutativity: `x ∧ y = y ∧ x`, @@ -46,56 +49,49 @@ of meet-semilattices. ## Definitions -### The predicate on semigroups of being a meet-semilattice +### The predicate on commutative semigroups of being a meet-semilattice ```agda module _ - {l : Level} (X : Semigroup l) + {l : Level} (X : Commutative-Semigroup l) where - is-meet-semilattice-prop-Semigroup : Prop l - is-meet-semilattice-prop-Semigroup = - product-Prop - ( Π-Prop - ( type-Semigroup X) - ( λ x → - Π-Prop - ( type-Semigroup X) - ( λ y → - Id-Prop - ( set-Semigroup X) - ( mul-Semigroup X x y) - ( mul-Semigroup X y x)))) - ( Π-Prop - ( type-Semigroup X) - ( λ x → - Id-Prop - ( set-Semigroup X) - ( mul-Semigroup X x x) - ( x))) - - is-meet-semilattice-Semigroup : UU l - is-meet-semilattice-Semigroup = - type-Prop is-meet-semilattice-prop-Semigroup - - is-prop-is-meet-semilattice-Semigroup : - is-prop is-meet-semilattice-Semigroup - is-prop-is-meet-semilattice-Semigroup = - is-prop-type-Prop is-meet-semilattice-prop-Semigroup + is-meet-semilattice-prop-Commutative-Semigroup : Prop l + is-meet-semilattice-prop-Commutative-Semigroup = + Π-Prop + ( type-Commutative-Semigroup X) + ( λ x → + Id-Prop + ( set-Commutative-Semigroup X) + ( mul-Commutative-Semigroup X x x) + ( x)) + + is-meet-semilattice-Commutative-Semigroup : UU l + is-meet-semilattice-Commutative-Semigroup = + type-Prop is-meet-semilattice-prop-Commutative-Semigroup + + is-prop-is-meet-semilattice-Commutative-Semigroup : + is-prop is-meet-semilattice-Commutative-Semigroup + is-prop-is-meet-semilattice-Commutative-Semigroup = + is-prop-type-Prop is-meet-semilattice-prop-Commutative-Semigroup ``` ### The algebraic definition of meet-semilattices ```agda Meet-Semilattice : (l : Level) → UU (lsuc l) -Meet-Semilattice l = type-subtype is-meet-semilattice-prop-Semigroup +Meet-Semilattice l = type-subtype is-meet-semilattice-prop-Commutative-Semigroup module _ {l : Level} (X : Meet-Semilattice l) where + commutative-semigroup-Meet-Semilattice : Commutative-Semigroup l + commutative-semigroup-Meet-Semilattice = pr1 X + semigroup-Meet-Semilattice : Semigroup l - semigroup-Meet-Semilattice = pr1 X + semigroup-Meet-Semilattice = + semigroup-Commutative-Semigroup commutative-semigroup-Meet-Semilattice set-Meet-Semilattice : Set l set-Meet-Semilattice = set-Semigroup semigroup-Meet-Semilattice @@ -122,18 +118,19 @@ module _ associative-mul-Semigroup semigroup-Meet-Semilattice is-meet-semilattice-Meet-Semilattice : - is-meet-semilattice-Semigroup semigroup-Meet-Semilattice + is-meet-semilattice-Commutative-Semigroup + ( commutative-semigroup-Meet-Semilattice) is-meet-semilattice-Meet-Semilattice = pr2 X commutative-meet-Meet-Semilattice : (x y : type-Meet-Semilattice) → (x ∧ y) = (y ∧ x) commutative-meet-Meet-Semilattice = - pr1 is-meet-semilattice-Meet-Semilattice + commutative-mul-Commutative-Semigroup commutative-semigroup-Meet-Semilattice idempotent-meet-Meet-Semilattice : (x : type-Meet-Semilattice) → (x ∧ x) = x idempotent-meet-Meet-Semilattice = - pr2 is-meet-semilattice-Meet-Semilattice + is-meet-semilattice-Meet-Semilattice leq-Meet-Semilattice-Prop : (x y : type-Meet-Semilattice) → Prop l @@ -666,13 +663,18 @@ module _ pr2 (pr2 semigroup-Order-Theoretic-Meet-Semilattice) = associative-meet-Order-Theoretic-Meet-Semilattice A + commutative-semigroup-Order-Theoretic-Meet-Semilattice : + Commutative-Semigroup l1 + pr1 commutative-semigroup-Order-Theoretic-Meet-Semilattice = + semigroup-Order-Theoretic-Meet-Semilattice + pr2 commutative-semigroup-Order-Theoretic-Meet-Semilattice = + commutative-meet-Order-Theoretic-Meet-Semilattice A + meet-semilattice-Order-Theoretic-Meet-Semilattice : Meet-Semilattice l1 pr1 meet-semilattice-Order-Theoretic-Meet-Semilattice = - semigroup-Order-Theoretic-Meet-Semilattice - pr1 (pr2 meet-semilattice-Order-Theoretic-Meet-Semilattice) = - commutative-meet-Order-Theoretic-Meet-Semilattice A - pr2 (pr2 meet-semilattice-Order-Theoretic-Meet-Semilattice) = + commutative-semigroup-Order-Theoretic-Meet-Semilattice + pr2 meet-semilattice-Order-Theoretic-Meet-Semilattice = idempotent-meet-Order-Theoretic-Meet-Semilattice A ``` diff --git a/src/order-theory/meets-finite-families-meet-semilattices.lagda.md b/src/order-theory/meets-finite-families-meet-semilattices.lagda.md new file mode 100644 index 0000000000..8e8a451403 --- /dev/null +++ b/src/order-theory/meets-finite-families-meet-semilattices.lagda.md @@ -0,0 +1,261 @@ +# Meets of finite families of elements in meet-semilattices + +```agda +module order-theory.meets-finite-families-meet-semilattices where +``` + +
Imports + +```agda +open import elementary-number-theory.natural-numbers + +open import foundation.action-on-identifications-functions +open import foundation.coproduct-types +open import foundation.dependent-pair-types +open import foundation.empty-types +open import foundation.equivalences +open import foundation.function-types +open import foundation.functoriality-dependent-function-types +open import foundation.identity-types +open import foundation.inhabited-types +open import foundation.logical-equivalences +open import foundation.propositional-truncations +open import foundation.transport-along-identifications +open import foundation.unit-type +open import foundation.univalence +open import foundation.universe-levels + +open import group-theory.commutative-semigroups +open import group-theory.sums-of-finite-families-of-elements-commutative-semigroups +open import group-theory.sums-of-finite-sequences-of-elements-commutative-semigroups + +open import lists.finite-sequences + +open import order-theory.greatest-lower-bounds-posets +open import order-theory.meet-semilattices + +open import univalent-combinatorics.counting +open import univalent-combinatorics.finite-types +open import univalent-combinatorics.inhabited-finite-types +open import univalent-combinatorics.standard-finite-types +``` + +
+ +## Idea + +In a [meet-semilattice](order-theory.meet-semilattices.md), the meet of any +family of elements indexed by an +[inhabited finite type](univalent-combinatorics.inhabited-finite-types.md) is +their [greatest lower bound](order-theory.greatest-lower-bounds-posets.md). + +## Definition + +### The meet of a finite sequence of elements + +```agda +module _ + {l1 l2 : Level} (X : Order-Theoretic-Meet-Semilattice l1 l2) + where + + meet-fin-sequence-type-Order-Theoretic-Meet-Semilattice : + (n : ℕ) → + fin-sequence (type-Order-Theoretic-Meet-Semilattice X) (succ-ℕ n) → + type-Order-Theoretic-Meet-Semilattice X + meet-fin-sequence-type-Order-Theoretic-Meet-Semilattice = + sum-fin-sequence-type-Commutative-Semigroup + ( commutative-semigroup-Order-Theoretic-Meet-Semilattice X) +``` + +### The meet of a family of elements indexed by an inhabited counted type + +```agda +module _ + {l1 l2 : Level} (X : Order-Theoretic-Meet-Semilattice l1 l2) + {l3 : Level} {I : UU l3} (|I| : is-inhabited I) (cI : count I) + where + + meet-counted-family-type-Order-Theoretic-Meet-Semilattice : + (f : I → type-Order-Theoretic-Meet-Semilattice X) → + type-Order-Theoretic-Meet-Semilattice X + meet-counted-family-type-Order-Theoretic-Meet-Semilattice = + sum-count-Commutative-Semigroup + ( commutative-semigroup-Order-Theoretic-Meet-Semilattice X) + ( I) + ( |I|) + ( cI) +``` + +### The meet of a family of elements indexed by an inhabited finite type + +```agda +module _ + {l1 l2 : Level} (X : Order-Theoretic-Meet-Semilattice l1 l2) + {l3 : Level} (I : Inhabited-Finite-Type l3) + where + + meet-inhabited-finite-family-Order-Theoretic-Meet-Semilattice : + (f : + type-Inhabited-Finite-Type I → type-Order-Theoretic-Meet-Semilattice X) → + type-Order-Theoretic-Meet-Semilattice X + meet-inhabited-finite-family-Order-Theoretic-Meet-Semilattice = + sum-finite-Commutative-Semigroup + ( commutative-semigroup-Order-Theoretic-Meet-Semilattice X) + ( I) +``` + +## Properties + +### The meet of a nonempty finite sequence is its least upper bound + +```agda +module _ + {l1 l2 : Level} (X : Order-Theoretic-Meet-Semilattice l1 l2) + where + + abstract + is-greatest-lower-bound-meet-fin-sequence-type-Order-Theoretic-Meet-Semilattice : + (n : ℕ) → + (x : fin-sequence (type-Order-Theoretic-Meet-Semilattice X) (succ-ℕ n)) → + is-greatest-lower-bound-family-of-elements-Poset + ( poset-Order-Theoretic-Meet-Semilattice X) + ( x) + ( meet-fin-sequence-type-Order-Theoretic-Meet-Semilattice X n x) + pr1 + ( is-greatest-lower-bound-meet-fin-sequence-type-Order-Theoretic-Meet-Semilattice + zero-ℕ x y) y≤xᵢ = y≤xᵢ (neg-one-Fin zero-ℕ) + pr2 + ( is-greatest-lower-bound-meet-fin-sequence-type-Order-Theoretic-Meet-Semilattice + zero-ℕ x y) y≤min (inr star) = y≤min + pr1 + ( is-greatest-lower-bound-meet-fin-sequence-type-Order-Theoretic-Meet-Semilattice + (succ-ℕ n) x y) y≤xᵢ = + leq-meet-Order-Theoretic-Meet-Semilattice X + ( forward-implication + ( is-greatest-lower-bound-meet-fin-sequence-type-Order-Theoretic-Meet-Semilattice + ( n) + ( x ∘ inl) + ( y)) + ( y≤xᵢ ∘ inl)) + ( y≤xᵢ (inr star)) + pr2 + ( is-greatest-lower-bound-meet-fin-sequence-type-Order-Theoretic-Meet-Semilattice + (succ-ℕ n) x y) y≤meet (inr star) = + transitive-leq-Order-Theoretic-Meet-Semilattice X y _ (x (inr star)) + ( leq-right-meet-Order-Theoretic-Meet-Semilattice X _ _) + ( y≤meet) + pr2 + ( is-greatest-lower-bound-meet-fin-sequence-type-Order-Theoretic-Meet-Semilattice + (succ-ℕ n) x y) y≤meet (inl i) = + backward-implication + ( is-greatest-lower-bound-meet-fin-sequence-type-Order-Theoretic-Meet-Semilattice + ( n) + ( x ∘ inl) + ( y)) + ( transitive-leq-Order-Theoretic-Meet-Semilattice X y _ _ + ( leq-left-meet-Order-Theoretic-Meet-Semilattice X _ _) + ( y≤meet)) + ( i) +``` + +### The meet of a counted family of elements is its least upper bound + +```agda +abstract + is-greatest-lower-bound-meet-counted-family-type-Order-Theoretic-Meet-Semilattice : + {l1 l2 : Level} (X : Order-Theoretic-Meet-Semilattice l1 l2) → + {l3 : Level} {I : UU l3} (|I| : is-inhabited I) (cI : count I) → + (f : I → type-Order-Theoretic-Meet-Semilattice X) → + is-greatest-lower-bound-family-of-elements-Poset + ( poset-Order-Theoretic-Meet-Semilattice X) + ( f) + ( meet-counted-family-type-Order-Theoretic-Meet-Semilattice X |I| cI f) + is-greatest-lower-bound-meet-counted-family-type-Order-Theoretic-Meet-Semilattice + X |I| cI@(zero-ℕ , _) _ = + ex-falso + ( is-nonempty-is-inhabited + ( |I|) + ( is-empty-is-zero-number-of-elements-count cI refl)) + is-greatest-lower-bound-meet-counted-family-type-Order-Theoretic-Meet-Semilattice + X |I| cI@(succ-ℕ n , Fin-sn≃I) f y = + is-greatest-lower-bound-meet-fin-sequence-type-Order-Theoretic-Meet-Semilattice + ( X) + ( n) + ( f ∘ map-equiv Fin-sn≃I) + ( y) ∘iff + iff-equiv + ( equiv-Π _ + ( inv-equiv Fin-sn≃I) + ( λ i → + equiv-eq + ( ap + ( λ j → leq-Order-Theoretic-Meet-Semilattice X y (f j)) + ( inv (is-section-map-inv-equiv Fin-sn≃I i))))) +``` + +### The meet of an inhabited finite family of elements is its meet over any count for that family + +```agda +module _ + {l1 l2 l3 : Level} (X : Order-Theoretic-Meet-Semilattice l1 l2) + (I : Inhabited-Finite-Type l3) (cI : count (type-Inhabited-Finite-Type I)) + (f : type-Inhabited-Finite-Type I → type-Order-Theoretic-Meet-Semilattice X) + where + + abstract + eq-meet-inhabited-finite-family-meet-counted-family-Order-Theoretic-Meet-Semilattice : + meet-inhabited-finite-family-Order-Theoretic-Meet-Semilattice X I f = + meet-counted-family-type-Order-Theoretic-Meet-Semilattice + ( X) + ( is-inhabited-type-Inhabited-Finite-Type I) + ( cI) + ( f) + eq-meet-inhabited-finite-family-meet-counted-family-Order-Theoretic-Meet-Semilattice = + eq-sum-finite-sum-count-Commutative-Semigroup + ( commutative-semigroup-Order-Theoretic-Meet-Semilattice X) + ( I) + ( cI) + ( f) +``` + +### The meet of an inhabited finite family of elements is its least upper bound + +```agda +module _ + {l1 l2 l3 : Level} (X : Order-Theoretic-Meet-Semilattice l1 l2) + (I : Inhabited-Finite-Type l3) + where + + abstract + is-greatest-lower-bound-meet-inhabited-finite-family-Order-Theoretic-Meet-Semilattice : + (f : + type-Inhabited-Finite-Type I → + type-Order-Theoretic-Meet-Semilattice X) → + is-greatest-lower-bound-family-of-elements-Poset + ( poset-Order-Theoretic-Meet-Semilattice X) + ( f) + ( meet-inhabited-finite-family-Order-Theoretic-Meet-Semilattice X I f) + is-greatest-lower-bound-meet-inhabited-finite-family-Order-Theoretic-Meet-Semilattice + f = + rec-trunc-Prop + ( is-greatest-lower-bound-family-of-elements-prop-Poset + ( poset-Order-Theoretic-Meet-Semilattice X) + ( f) + ( _)) + ( λ cI → + inv-tr + ( is-greatest-lower-bound-family-of-elements-Poset + ( poset-Order-Theoretic-Meet-Semilattice X) + ( f)) + ( eq-meet-inhabited-finite-family-meet-counted-family-Order-Theoretic-Meet-Semilattice + ( X) + ( I) + ( cI) + ( f)) + ( is-greatest-lower-bound-meet-counted-family-type-Order-Theoretic-Meet-Semilattice + ( X) + ( is-inhabited-type-Inhabited-Finite-Type I) + ( cI) + ( f))) + ( is-finite-Inhabited-Finite-Type I) +``` From 08af711376f20bd1011c41ecc23846f781a28fff Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Sun, 31 Aug 2025 15:54:34 -0700 Subject: [PATCH 36/97] The image of a totally bounded metric space under a uniformly continuous function is totally bounded (#1513) --- src/foundation/images-subtypes.lagda.md | 3 + src/foundation/images.lagda.md | 33 +++- src/foundation/surjective-maps.lagda.md | 11 ++ src/metric-spaces.lagda.md | 4 + .../approximations-metric-spaces.lagda.md | 166 +++++++++++++++++- .../compact-metric-spaces.lagda.md | 14 +- .../equality-of-metric-spaces.lagda.md | 37 ++++ .../images-isometries-metric-spaces.lagda.md | 86 +++++++++ .../images-metric-spaces.lagda.md | 37 ++++ ...ges-short-functions-metric-spaces.lagda.md | 69 ++++++++ ...ontinuous-functions-metric-spaces.lagda.md | 96 ++++++++++ .../isometries-metric-spaces.lagda.md | 44 +++-- src/metric-spaces/nets-metric-spaces.lagda.md | 129 ++++++++++++++ .../totally-bounded-metric-spaces.lagda.md | 141 ++++++++++++++- ...ontinuous-functions-metric-spaces.lagda.md | 34 ++++ src/order-theory/meet-semilattices.lagda.md | 2 +- .../finitely-enumerable-subtypes.lagda.md | 67 +++++++ .../finitely-enumerable-types.lagda.md | 39 ++++ 18 files changed, 979 insertions(+), 33 deletions(-) create mode 100644 src/metric-spaces/images-isometries-metric-spaces.lagda.md create mode 100644 src/metric-spaces/images-metric-spaces.lagda.md create mode 100644 src/metric-spaces/images-short-functions-metric-spaces.lagda.md create mode 100644 src/metric-spaces/images-uniformly-continuous-functions-metric-spaces.lagda.md diff --git a/src/foundation/images-subtypes.lagda.md b/src/foundation/images-subtypes.lagda.md index 3310d88c6d..47f77402b1 100644 --- a/src/foundation/images-subtypes.lagda.md +++ b/src/foundation/images-subtypes.lagda.md @@ -78,6 +78,9 @@ module _ im-subtype : subtype (l1 ⊔ l2 ⊔ l3) B im-subtype y = subtype-im (f ∘ inclusion-subtype S) y + type-im-subtype : UU (l1 ⊔ l2 ⊔ l3) + type-im-subtype = type-subtype im-subtype + is-in-im-subtype : B → UU (l1 ⊔ l2 ⊔ l3) is-in-im-subtype = is-in-subtype im-subtype ``` diff --git a/src/foundation/images.lagda.md b/src/foundation/images.lagda.md index 7fdbb46a83..e602a41d8e 100644 --- a/src/foundation/images.lagda.md +++ b/src/foundation/images.lagda.md @@ -7,22 +7,28 @@ module foundation.images where
Imports ```agda +open import foundation.action-on-identifications-functions +open import foundation.contractible-types open import foundation.dependent-pair-types +open import foundation.embeddings open import foundation.fundamental-theorem-of-identity-types open import foundation.propositional-truncations +open import foundation.retractions +open import foundation.sections open import foundation.slice open import foundation.subtype-identity-principle open import foundation.surjective-maps +open import foundation.transport-along-identifications open import foundation.universe-levels open import foundation-core.1-types open import foundation-core.commuting-triangles-of-maps -open import foundation-core.embeddings open import foundation-core.equivalences open import foundation-core.fibers-of-maps open import foundation-core.function-types open import foundation-core.identity-types open import foundation-core.injective-maps +open import foundation-core.propositional-maps open import foundation-core.propositions open import foundation-core.sets open import foundation-core.subtypes @@ -218,6 +224,31 @@ im-1-Type : im-1-Type X f = im-Truncated-Type zero-𝕋 X f ``` +### The unit map of the image of an embedding is an equivalence + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A ↪ B) + where + + map-unit-im-emb : A → im (map-emb f) + map-unit-im-emb = map-unit-im (map-emb f) + + abstract + is-equiv-unit-im-emb : is-equiv map-unit-im-emb + is-equiv-unit-im-emb = + is-equiv-is-emb-is-surjective + ( is-surjective-map-unit-im (map-emb f)) + ( is-emb-right-factor + ( inclusion-im (map-emb f)) + ( map-unit-im (map-emb f)) + ( is-emb-inclusion-im (map-emb f)) + ( is-emb-map-emb f)) + + equiv-im-emb : A ≃ im (map-emb f) + equiv-im-emb = (map-unit-im-emb , is-equiv-unit-im-emb) +``` + ## External links - [Image (mathematics)]() at diff --git a/src/foundation/surjective-maps.lagda.md b/src/foundation/surjective-maps.lagda.md index 969c1e7ade..2c2aff28b8 100644 --- a/src/foundation/surjective-maps.lagda.md +++ b/src/foundation/surjective-maps.lagda.md @@ -13,6 +13,7 @@ open import foundation.contractible-types open import foundation.dependent-pair-types open import foundation.diagonal-maps-of-types open import foundation.embeddings +open import foundation.empty-types open import foundation.equality-cartesian-product-types open import foundation.functoriality-cartesian-product-types open import foundation.functoriality-propositional-truncation @@ -237,6 +238,16 @@ surjection-retract R = ( map-retraction-retract R , is-surjective-has-section (section-retract R)) ``` +### If an empty type has a surjection into another type, that type is empty + +```agda +abstract + is-empty-surjection : + {l1 l2 : Level} {A : UU l1} {B : UU l2} → A ↠ B → is-empty A → is-empty B + is-empty-surjection A↠B ¬A b = + rec-trunc-Prop empty-Prop (¬A ∘ pr1) (is-surjective-map-surjection A↠B b) +``` + ### Any split surjective map is surjective ```agda diff --git a/src/metric-spaces.lagda.md b/src/metric-spaces.lagda.md index e60c82f1cd..3134d961b1 100644 --- a/src/metric-spaces.lagda.md +++ b/src/metric-spaces.lagda.md @@ -74,6 +74,10 @@ open import metric-spaces.functions-metric-spaces public open import metric-spaces.functions-pseudometric-spaces public open import metric-spaces.functor-category-set-functions-isometry-metric-spaces public open import metric-spaces.functor-category-short-isometry-metric-spaces public +open import metric-spaces.images-isometries-metric-spaces public +open import metric-spaces.images-metric-spaces public +open import metric-spaces.images-short-functions-metric-spaces public +open import metric-spaces.images-uniformly-continuous-functions-metric-spaces public open import metric-spaces.indexed-sums-metric-spaces public open import metric-spaces.interior-subsets-metric-spaces public open import metric-spaces.isometries-metric-spaces public diff --git a/src/metric-spaces/approximations-metric-spaces.lagda.md b/src/metric-spaces/approximations-metric-spaces.lagda.md index 894203a484..a3e19c2da4 100644 --- a/src/metric-spaces/approximations-metric-spaces.lagda.md +++ b/src/metric-spaces/approximations-metric-spaces.lagda.md @@ -10,15 +10,30 @@ module metric-spaces.approximations-metric-spaces where open import elementary-number-theory.positive-rational-numbers open import foundation.dependent-pair-types +open import foundation.existential-quantification open import foundation.full-subtypes +open import foundation.function-types +open import foundation.images +open import foundation.images-subtypes +open import foundation.logical-equivalences +open import foundation.propositional-truncations open import foundation.propositions open import foundation.subtypes +open import foundation.transport-along-identifications open import foundation.unions-subtypes open import foundation.universe-levels -open import metric-spaces.located-metric-spaces +open import metric-spaces.equality-of-metric-spaces +open import metric-spaces.functions-metric-spaces +open import metric-spaces.images-isometries-metric-spaces +open import metric-spaces.images-metric-spaces +open import metric-spaces.images-short-functions-metric-spaces +open import metric-spaces.images-uniformly-continuous-functions-metric-spaces +open import metric-spaces.isometries-metric-spaces open import metric-spaces.metric-spaces +open import metric-spaces.short-functions-metric-spaces open import metric-spaces.subspaces-metric-spaces +open import metric-spaces.uniformly-continuous-functions-metric-spaces ```
@@ -72,6 +87,155 @@ module _ type-approximation-Metric-Space : UU (l1 ⊔ l3) type-approximation-Metric-Space = type-subtype subset-approximation-Metric-Space + + is-approximation-approximation-Metric-Space : + is-approximation-Metric-Space X ε subset-approximation-Metric-Space + is-approximation-approximation-Metric-Space = pr2 S +``` + +## Properties + +### If `μ` is a modulus of uniform continuity for `f : X → Y` and `A` is a `(μ ε)`-approximation of `X`, then `im f A` is an `ε`-approximation of `im f X` + +```agda +module _ + {l1 l2 l3 l4 l5 : Level} (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) + (f : type-function-Metric-Space X Y) {μ : ℚ⁺ → ℚ⁺} + (is-modulus-ucont-f-μ : + is-modulus-of-uniform-continuity-function-Metric-Space X Y f μ) + (ε : ℚ⁺) (A : approximation-Metric-Space l5 X (μ ε)) + where + + abstract + is-approximation-im-uniformly-continuous-function-approximation-Metric-Space : + is-approximation-Metric-Space + ( im-Metric-Space X Y f) + ( ε) + ( im-subtype + ( map-unit-im f) + ( subset-approximation-Metric-Space X (μ ε) A)) + is-approximation-im-uniformly-continuous-function-approximation-Metric-Space + (y , ∃x:fx=y) = + let + open + do-syntax-trunc-Prop + ( ∃ _ (λ z → neighborhood-prop-Metric-Space Y ε (pr1 (pr1 z)) y)) + in do + (x , fx=y) ← ∃x:fx=y + ((a , a∈A) , Nμεax) ← + is-approximation-approximation-Metric-Space X (μ ε) A x + intro-exists + ( map-unit-im + ( map-unit-im f ∘ + inclusion-subtype + ( subset-approximation-Metric-Space X (μ ε) A)) + ( a , a∈A)) + ( tr + ( neighborhood-Metric-Space Y ε (f a)) + ( fx=y) + ( is-modulus-ucont-f-μ a ε x Nμεax)) + + approximation-im-uniformly-continuous-function-approximation-Metric-Space : + approximation-Metric-Space (l1 ⊔ l3 ⊔ l5) (im-Metric-Space X Y f) ε + approximation-im-uniformly-continuous-function-approximation-Metric-Space = + ( im-subtype (map-unit-im f) (subset-approximation-Metric-Space X (μ ε) A) , + is-approximation-im-uniformly-continuous-function-approximation-Metric-Space) +``` + +### If `f : X → Y` is a short function and `A` is an `ε`-approximation of `X`, then `im f A` is an `ε`-approximation of `im f X` + +```agda +module _ + {l1 l2 l3 l4 l5 : Level} (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) + (f : short-function-Metric-Space X Y) + (ε : ℚ⁺) (A : approximation-Metric-Space l5 X ε) + where + + approximation-im-short-function-approximation-Metric-Space : + approximation-Metric-Space + ( l1 ⊔ l3 ⊔ l5) + ( im-short-function-Metric-Space X Y f) + ( ε) + approximation-im-short-function-approximation-Metric-Space = + approximation-im-uniformly-continuous-function-approximation-Metric-Space + ( X) + ( Y) + ( map-short-function-Metric-Space X Y f) + ( id-is-modulus-of-uniform-continuity-is-short-function-Metric-Space + ( X) + ( Y) + ( map-short-function-Metric-Space X Y f) + ( is-short-map-short-function-Metric-Space X Y f)) + ( ε) + ( A) +``` + +### If `f : X → Y` is an isometry and `A` is an `ε`-approximation of `X`, then `im f A` is an `ε`-approximation of `im f X` + +```agda +module _ + {l1 l2 l3 l4 l5 : Level} (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) + (f : isometry-Metric-Space X Y) + (ε : ℚ⁺) (A : approximation-Metric-Space l5 X ε) + where + + approximation-im-isometry-approximation-Metric-Space : + approximation-Metric-Space + ( l1 ⊔ l3 ⊔ l5) + ( im-isometry-Metric-Space X Y f) + ( ε) + approximation-im-isometry-approximation-Metric-Space = + approximation-im-short-function-approximation-Metric-Space X Y + ( short-isometry-Metric-Space X Y f) + ( ε) + ( A) +``` + +### If `f : X ≃ Y` is an isometric equivalence and `A` is an `ε`-approximation of `X`, then `im f A` is an `ε`-approximation of `Y` + +```agda +module _ + {l1 l2 l3 l4 l5 : Level} (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) + (f : isometric-equiv-Metric-Space X Y) + (ε : ℚ⁺) (A : approximation-Metric-Space l5 X ε) + where + + abstract + is-approximation-im-isometric-equiv-approximation-Metric-Space : + is-approximation-Metric-Space + ( Y) + ( ε) + ( im-subtype + ( map-isometric-equiv-Metric-Space X Y f) + ( subset-approximation-Metric-Space X ε A)) + is-approximation-im-isometric-equiv-approximation-Metric-Space y = + let + open + do-syntax-trunc-Prop + ( ∃ _ (λ z → neighborhood-prop-Metric-Space Y ε (pr1 z) y)) + in do + let x = map-inv-isometric-equiv-Metric-Space X Y f y + ((a , a∈A) , Nεax) ← is-approximation-approximation-Metric-Space X ε A x + intro-exists + ( map-unit-im + ( map-isometric-equiv-Metric-Space X Y f ∘ + inclusion-subtype (subset-approximation-Metric-Space X ε A)) + ( a , a∈A)) + ( tr + ( neighborhood-Metric-Space Y ε + ( map-isometric-equiv-Metric-Space X Y f a)) + ( is-section-map-inv-isometric-equiv-Metric-Space X Y f y) + ( forward-implication + ( is-isometry-map-isometric-equiv-Metric-Space X Y f ε _ _) + ( Nεax))) + + approximation-im-isometric-equiv-approximation-Metric-Space : + approximation-Metric-Space (l1 ⊔ l3 ⊔ l5) Y ε + approximation-im-isometric-equiv-approximation-Metric-Space = + ( im-subtype + ( map-isometric-equiv-Metric-Space X Y f) + ( subset-approximation-Metric-Space X ε A) , + is-approximation-im-isometric-equiv-approximation-Metric-Space) ``` ## References diff --git a/src/metric-spaces/compact-metric-spaces.lagda.md b/src/metric-spaces/compact-metric-spaces.lagda.md index d262bbdebb..4767238d2e 100644 --- a/src/metric-spaces/compact-metric-spaces.lagda.md +++ b/src/metric-spaces/compact-metric-spaces.lagda.md @@ -30,17 +30,17 @@ if it is [totally bounded](metric-spaces.totally-bounded-metric-spaces.md) and ```agda module _ - {l1 l2 : Level} (X : Metric-Space l1 l2) + {l1 l2 : Level} (l3 : Level) (X : Metric-Space l1 l2) where - is-compact-prop-Metric-Space : Prop (lsuc l1 ⊔ lsuc l2) + is-compact-prop-Metric-Space : Prop (l1 ⊔ l2 ⊔ lsuc l3) is-compact-prop-Metric-Space = - is-totally-bounded-prop-Metric-Space X ∧ is-complete-prop-Metric-Space X + is-totally-bounded-prop-Metric-Space l3 X ∧ is-complete-prop-Metric-Space X - is-compact-Metric-Space : UU (lsuc l1 ⊔ lsuc l2) + is-compact-Metric-Space : UU (l1 ⊔ l2 ⊔ lsuc l3) is-compact-Metric-Space = type-Prop is-compact-prop-Metric-Space -Compact-Metric-Space : (l1 l2 : Level) → UU (lsuc l1 ⊔ lsuc l2) -Compact-Metric-Space l1 l2 = - type-subtype (is-compact-prop-Metric-Space {l1} {l2}) +Compact-Metric-Space : (l1 l2 l3 : Level) → UU (lsuc l1 ⊔ lsuc l2 ⊔ lsuc l3) +Compact-Metric-Space l1 l2 l3 = + type-subtype (is-compact-prop-Metric-Space {l1} {l2} l3) ``` diff --git a/src/metric-spaces/equality-of-metric-spaces.lagda.md b/src/metric-spaces/equality-of-metric-spaces.lagda.md index d66c56acff..3900b7271b 100644 --- a/src/metric-spaces/equality-of-metric-spaces.lagda.md +++ b/src/metric-spaces/equality-of-metric-spaces.lagda.md @@ -18,6 +18,8 @@ open import foundation.function-types open import foundation.functoriality-dependent-pair-types open import foundation.identity-types open import foundation.propositions +open import foundation.retractions +open import foundation.sections open import foundation.subtypes open import foundation.torsorial-type-families open import foundation.transport-along-identifications @@ -82,6 +84,41 @@ module _ isometric-equiv-Pseudometric-Space ( pseudometric-Metric-Space A) ( pseudometric-Metric-Space B) + + equiv-isometric-equiv-Metric-Space : + isometric-equiv-Metric-Space → type-Metric-Space A ≃ type-Metric-Space B + equiv-isometric-equiv-Metric-Space = pr1 + + map-isometric-equiv-Metric-Space : + isometric-equiv-Metric-Space → type-Metric-Space A → type-Metric-Space B + map-isometric-equiv-Metric-Space e = + map-equiv (equiv-isometric-equiv-Metric-Space e) + + map-inv-isometric-equiv-Metric-Space : + isometric-equiv-Metric-Space → type-Metric-Space B → type-Metric-Space A + map-inv-isometric-equiv-Metric-Space e = + map-inv-equiv (equiv-isometric-equiv-Metric-Space e) + + is-section-map-inv-isometric-equiv-Metric-Space : + (e : isometric-equiv-Metric-Space) → + is-section + ( map-isometric-equiv-Metric-Space e) + ( map-inv-isometric-equiv-Metric-Space e) + is-section-map-inv-isometric-equiv-Metric-Space e = + is-section-map-inv-equiv (equiv-isometric-equiv-Metric-Space e) + + is-retraction-map-inv-isometric-equiv-Metric-Space : + (e : isometric-equiv-Metric-Space) → + is-retraction + ( map-isometric-equiv-Metric-Space e) + ( map-inv-isometric-equiv-Metric-Space e) + is-retraction-map-inv-isometric-equiv-Metric-Space e = + is-retraction-map-inv-equiv (equiv-isometric-equiv-Metric-Space e) + + is-isometry-map-isometric-equiv-Metric-Space : + (e : isometric-equiv-Metric-Space) → + is-isometry-Metric-Space A B (map-isometric-equiv-Metric-Space e) + is-isometry-map-isometric-equiv-Metric-Space = pr2 ``` ### Isometric equivalences between metric spaces diff --git a/src/metric-spaces/images-isometries-metric-spaces.lagda.md b/src/metric-spaces/images-isometries-metric-spaces.lagda.md new file mode 100644 index 0000000000..4149b3f934 --- /dev/null +++ b/src/metric-spaces/images-isometries-metric-spaces.lagda.md @@ -0,0 +1,86 @@ +# Images of metric spaces under isometries + +```agda +module metric-spaces.images-isometries-metric-spaces where +``` + +
Imports + +```agda +open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.images +open import foundation.universe-levels + +open import metric-spaces.equality-of-metric-spaces +open import metric-spaces.functions-metric-spaces +open import metric-spaces.images-metric-spaces +open import metric-spaces.isometries-metric-spaces +open import metric-spaces.metric-spaces +``` + +
+ +## Idea + +Given an [isometry](metric-spaces.isometries-metric-spaces.md) between +[metric spaces](metric-spaces.metric-spaces.md) `f : X → Y`, the unit map of the +[image](metric-spaces.images-metric-spaces.md) of `f` is an +[isometric equivalence](metric-spaces.equality-of-metric-spaces.md). + +## Definition + +```agda +module _ + {l1 l2 l3 l4 : Level} (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) + (f : isometry-Metric-Space X Y) + where + + im-isometry-Metric-Space : Metric-Space (l1 ⊔ l3) l4 + im-isometry-Metric-Space = + im-Metric-Space X Y (map-isometry-Metric-Space X Y f) + + type-im-isometry-Metric-Space : UU (l1 ⊔ l3) + type-im-isometry-Metric-Space = im (map-isometry-Metric-Space X Y f) + + equiv-unit-im-isometry-Metric-Space : + type-Metric-Space X ≃ type-im-isometry-Metric-Space + equiv-unit-im-isometry-Metric-Space = + equiv-im-emb (emb-map-isometry-Metric-Space X Y f) + + map-unit-im-isometry-Metric-Space : + type-Metric-Space X → type-im-isometry-Metric-Space + map-unit-im-isometry-Metric-Space = + map-unit-im (map-isometry-Metric-Space X Y f) +``` + +## Properties + +### The unit map of the image is an isometry + +```agda +module _ + {l1 l2 l3 l4 : Level} (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) + (f : isometry-Metric-Space X Y) + where + + is-isometry-map-unit-im-isometry-Metric-Space : + is-isometry-Metric-Space + ( X) + ( im-isometry-Metric-Space X Y f) + ( map-unit-im-isometry-Metric-Space X Y f) + is-isometry-map-unit-im-isometry-Metric-Space = + is-isometry-map-isometry-Metric-Space X Y f + + isometry-map-unit-im-isometry-Metric-Space : + isometry-Metric-Space X (im-isometry-Metric-Space X Y f) + isometry-map-unit-im-isometry-Metric-Space = + ( map-unit-im-isometry-Metric-Space X Y f , + is-isometry-map-unit-im-isometry-Metric-Space) + + isometric-equiv-im-isometry-Metric-Space : + isometric-equiv-Metric-Space X (im-isometry-Metric-Space X Y f) + isometric-equiv-im-isometry-Metric-Space = + ( equiv-unit-im-isometry-Metric-Space X Y f , + is-isometry-map-unit-im-isometry-Metric-Space) +``` diff --git a/src/metric-spaces/images-metric-spaces.lagda.md b/src/metric-spaces/images-metric-spaces.lagda.md new file mode 100644 index 0000000000..d213a14fc1 --- /dev/null +++ b/src/metric-spaces/images-metric-spaces.lagda.md @@ -0,0 +1,37 @@ +# Images of metric spaces + +```agda +module metric-spaces.images-metric-spaces where +``` + +
Imports + +```agda +open import foundation.images +open import foundation.universe-levels + +open import metric-spaces.functions-metric-spaces +open import metric-spaces.metric-spaces +open import metric-spaces.subspaces-metric-spaces +``` + +
+ +## Idea + +Given a [function](metric-spaces.functions-metric-spaces.md) between +[metric spaces](metric-spaces.metric-spaces.md) `f : X → Y`, the +[image](foundation.images.md) of `X` under `f` is a +[subspace](metric-spaces.subspaces-metric-spaces.md) of `Y`. + +## Definition + +```agda +module _ + {l1 l2 l3 l4 : Level} (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) + (f : type-function-Metric-Space X Y) + where + + im-Metric-Space : Metric-Space (l1 ⊔ l3) l4 + im-Metric-Space = subspace-Metric-Space Y (subtype-im f) +``` diff --git a/src/metric-spaces/images-short-functions-metric-spaces.lagda.md b/src/metric-spaces/images-short-functions-metric-spaces.lagda.md new file mode 100644 index 0000000000..929cc71b5d --- /dev/null +++ b/src/metric-spaces/images-short-functions-metric-spaces.lagda.md @@ -0,0 +1,69 @@ +# Images of metric spaces under short functions + +```agda +module metric-spaces.images-short-functions-metric-spaces where +``` + +
Imports + +```agda +open import foundation.dependent-pair-types +open import foundation.images +open import foundation.universe-levels + +open import metric-spaces.functions-metric-spaces +open import metric-spaces.images-metric-spaces +open import metric-spaces.metric-spaces +open import metric-spaces.short-functions-metric-spaces +``` + +
+ +## Idea + +Given a [short function](metric-spaces.short-functions-metric-spaces.md) between +[metric spaces](metric-spaces.metric-spaces.md) `f : X → Y`, the unit map of the +[image](metric-spaces.images-metric-spaces.md) of `f` is short. + +## Definition + +```agda +module _ + {l1 l2 l3 l4 : Level} (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) + (f : short-function-Metric-Space X Y) + where + + im-short-function-Metric-Space : Metric-Space (l1 ⊔ l3) l4 + im-short-function-Metric-Space = + im-Metric-Space X Y (map-short-function-Metric-Space X Y f) + + map-unit-im-short-function-Metric-Space : + type-function-Metric-Space X im-short-function-Metric-Space + map-unit-im-short-function-Metric-Space = + map-unit-im (map-short-function-Metric-Space X Y f) +``` + +## Properties + +### The unit map of the image of a short function is short + +```agda +module _ + {l1 l2 l3 l4 : Level} (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) + (f : short-function-Metric-Space X Y) + where + + is-short-map-unit-im-short-function-Metric-Space : + is-short-function-Metric-Space + ( X) + ( im-short-function-Metric-Space X Y f) + ( map-unit-im-short-function-Metric-Space X Y f) + is-short-map-unit-im-short-function-Metric-Space = + is-short-map-short-function-Metric-Space X Y f + + short-map-unit-im-short-function-Metric-Space : + short-function-Metric-Space X (im-short-function-Metric-Space X Y f) + short-map-unit-im-short-function-Metric-Space = + ( map-unit-im-short-function-Metric-Space X Y f , + is-short-map-unit-im-short-function-Metric-Space) +``` diff --git a/src/metric-spaces/images-uniformly-continuous-functions-metric-spaces.lagda.md b/src/metric-spaces/images-uniformly-continuous-functions-metric-spaces.lagda.md new file mode 100644 index 0000000000..b7b433017d --- /dev/null +++ b/src/metric-spaces/images-uniformly-continuous-functions-metric-spaces.lagda.md @@ -0,0 +1,96 @@ +# Images of metric spaces under uniformly continuous functions + +```agda +module metric-spaces.images-uniformly-continuous-functions-metric-spaces where +``` + +
Imports + +```agda +open import elementary-number-theory.positive-rational-numbers + +open import foundation.dependent-pair-types +open import foundation.images +open import foundation.universe-levels + +open import metric-spaces.functions-metric-spaces +open import metric-spaces.images-metric-spaces +open import metric-spaces.metric-spaces +open import metric-spaces.uniformly-continuous-functions-metric-spaces +``` + +
+ +## Idea + +Given a +[uniformly continuous function](metric-spaces.short-functions-metric-spaces.md) +between [metric spaces](metric-spaces.metric-spaces.md) `f : X → Y`, the unit +map of the [image](metric-spaces.images-metric-spaces.md) of `f` is uniformly +continuous. Any modulus of uniform continuity for `f` is a modulus of uniform +continuity for the unit map of the image. + +## Definition + +```agda +module _ + {l1 l2 l3 l4 : Level} (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) + (f : uniformly-continuous-function-Metric-Space X Y) + where + + im-uniformly-continuous-function-Metric-Space : Metric-Space (l1 ⊔ l3) l4 + im-uniformly-continuous-function-Metric-Space = + im-Metric-Space X Y (map-uniformly-continuous-function-Metric-Space X Y f) + + map-unit-im-uniformly-continuous-function-Metric-Space : + type-function-Metric-Space X im-uniformly-continuous-function-Metric-Space + map-unit-im-uniformly-continuous-function-Metric-Space = + map-unit-im (map-uniformly-continuous-function-Metric-Space X Y f) +``` + +## Properties + +### Any modulus of uniform continuity for a function is a modulus of uniform continuity for the unit map of its image + +```agda +module _ + {l1 l2 l3 l4 : Level} (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) + (f : type-function-Metric-Space X Y) + where + + is-modulus-of-uniform-continuity-map-unit-im-modulus-of-uniform-continuity-function-Metric-Space : + {μ : ℚ⁺ → ℚ⁺} → + is-modulus-of-uniform-continuity-function-Metric-Space X Y f μ → + is-modulus-of-uniform-continuity-function-Metric-Space + ( X) + ( im-Metric-Space X Y f) + ( map-unit-im f) + ( μ) + is-modulus-of-uniform-continuity-map-unit-im-modulus-of-uniform-continuity-function-Metric-Space + is-modulus-μ = is-modulus-μ +``` + +### The unit map of a uniformly continuous function is uniformly continuous + +```agda +module _ + {l1 l2 l3 l4 : Level} (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) + (f : uniformly-continuous-function-Metric-Space X Y) + where + + is-uniformly-continuous-map-unit-im-uniformly-continuous-function-Metric-Space : + is-uniformly-continuous-function-Metric-Space + ( X) + ( im-uniformly-continuous-function-Metric-Space X Y f) + ( map-unit-im-uniformly-continuous-function-Metric-Space X Y f) + is-uniformly-continuous-map-unit-im-uniformly-continuous-function-Metric-Space = + is-uniformly-continuous-map-uniformly-continuous-function-Metric-Space X Y f + + uniformly-continuous-map-unit-im-uniformly-continuous-function-Metric-Space : + uniformly-continuous-function-Metric-Space + ( X) + ( im-uniformly-continuous-function-Metric-Space X Y f) + uniformly-continuous-map-unit-im-uniformly-continuous-function-Metric-Space = + ( map-unit-im-uniformly-continuous-function-Metric-Space X Y f , + is-uniformly-continuous-map-unit-im-uniformly-continuous-function-Metric-Space) +``` diff --git a/src/metric-spaces/isometries-metric-spaces.lagda.md b/src/metric-spaces/isometries-metric-spaces.lagda.md index a209bfed08..3fee4dcad8 100644 --- a/src/metric-spaces/isometries-metric-spaces.lagda.md +++ b/src/metric-spaces/isometries-metric-spaces.lagda.md @@ -9,9 +9,11 @@ module metric-spaces.isometries-metric-spaces where ```agda open import elementary-number-theory.positive-rational-numbers +open import foundation.binary-transport open import foundation.dependent-pair-types open import foundation.embeddings open import foundation.equivalences +open import foundation.fibers-of-maps open import foundation.function-types open import foundation.homotopies open import foundation.identity-types @@ -366,22 +368,28 @@ module _ (f : isometry-Metric-Space A B) where - is-injective-map-isometry-Metric-Space : - is-injective (map-isometry-Metric-Space A B f) - is-injective-map-isometry-Metric-Space H = - eq-sim-Metric-Space - ( A) - ( _) - ( _) - ( λ d → - backward-implication - ( is-isometry-map-isometry-Metric-Space A B f d _ _) - ( sim-eq-Metric-Space B _ _ H d)) - - is-emb-map-isometry-Metric-Space : - is-emb (map-isometry-Metric-Space A B f) - is-emb-map-isometry-Metric-Space = - is-emb-is-injective - ( is-set-type-Metric-Space B) - ( is-injective-map-isometry-Metric-Space) + abstract + is-injective-map-isometry-Metric-Space : + is-injective (map-isometry-Metric-Space A B f) + is-injective-map-isometry-Metric-Space H = + eq-sim-Metric-Space + ( A) + ( _) + ( _) + ( λ d → + backward-implication + ( is-isometry-map-isometry-Metric-Space A B f d _ _) + ( sim-eq-Metric-Space B _ _ H d)) + + is-emb-map-isometry-Metric-Space : + is-emb (map-isometry-Metric-Space A B f) + is-emb-map-isometry-Metric-Space = + is-emb-is-injective + ( is-set-type-Metric-Space B) + ( is-injective-map-isometry-Metric-Space) + + emb-map-isometry-Metric-Space : type-Metric-Space A ↪ type-Metric-Space B + emb-map-isometry-Metric-Space = + ( map-isometry-Metric-Space A B f , + is-emb-map-isometry-Metric-Space) ``` diff --git a/src/metric-spaces/nets-metric-spaces.lagda.md b/src/metric-spaces/nets-metric-spaces.lagda.md index 6af769a5ea..b880cc12ff 100644 --- a/src/metric-spaces/nets-metric-spaces.lagda.md +++ b/src/metric-spaces/nets-metric-spaces.lagda.md @@ -9,12 +9,23 @@ module metric-spaces.nets-metric-spaces where ```agda open import elementary-number-theory.positive-rational-numbers +open import foundation.dependent-pair-types +open import foundation.images open import foundation.propositions open import foundation.subtypes open import foundation.universe-levels open import metric-spaces.approximations-metric-spaces +open import metric-spaces.equality-of-metric-spaces +open import metric-spaces.functions-metric-spaces +open import metric-spaces.images-isometries-metric-spaces +open import metric-spaces.images-metric-spaces +open import metric-spaces.images-short-functions-metric-spaces +open import metric-spaces.isometries-metric-spaces open import metric-spaces.metric-spaces +open import metric-spaces.short-functions-metric-spaces +open import metric-spaces.subspaces-metric-spaces +open import metric-spaces.uniformly-continuous-functions-metric-spaces open import univalent-combinatorics.finitely-enumerable-subtypes open import univalent-combinatorics.finitely-enumerable-types @@ -50,4 +61,122 @@ net-Metric-Space : UU (l1 ⊔ l2 ⊔ lsuc l3) net-Metric-Space l3 X ε = type-subtype (is-net-prop-Metric-Space {l3 = l3} X ε) + +module _ + {l1 l2 l3 : Level} (X : Metric-Space l1 l2) (ε : ℚ⁺) + (N : net-Metric-Space l3 X ε) + where + + finitely-enumerable-subset-net-Metric-Space : + finitely-enumerable-subtype l3 (type-Metric-Space X) + finitely-enumerable-subset-net-Metric-Space = pr1 N + + subset-net-Metric-Space : subset-Metric-Space l3 X + subset-net-Metric-Space = + subtype-finitely-enumerable-subtype + ( finitely-enumerable-subset-net-Metric-Space) + + is-approximation-subset-net-Metric-Space : + is-approximation-Metric-Space X ε subset-net-Metric-Space + is-approximation-subset-net-Metric-Space = pr2 N + + approximation-net-Metric-Space : approximation-Metric-Space l3 X ε + approximation-net-Metric-Space = + ( subset-net-Metric-Space , + is-approximation-subset-net-Metric-Space) +``` + +## Properties + +### If `μ` is a modulus of uniform continuity for `f : X → Y` and `N` is a `(μ ε)`-net of `X`, then `im f N` is an `ε`-net of `im f X` + +```agda +module _ + {l1 l2 l3 l4 l5 : Level} (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) + (f : type-function-Metric-Space X Y) {μ : ℚ⁺ → ℚ⁺} + (is-modulus-ucont-f-μ : + is-modulus-of-uniform-continuity-function-Metric-Space X Y f μ) + (ε : ℚ⁺) (N : net-Metric-Space l5 X (μ ε)) + where + + net-im-uniformly-continuous-function-net-Metric-Space : + net-Metric-Space (l1 ⊔ l3 ⊔ l5) (im-Metric-Space X Y f) ε + net-im-uniformly-continuous-function-net-Metric-Space = + ( finitely-enumerable-subtype-im-finitely-enumerable-subtype + ( map-unit-im f) + ( finitely-enumerable-subset-net-Metric-Space X (μ ε) N) , + is-approximation-im-uniformly-continuous-function-approximation-Metric-Space + ( X) + ( Y) + ( f) + ( is-modulus-ucont-f-μ) + ( ε) + ( approximation-net-Metric-Space X (μ ε) N)) +``` + +### If `f : X → Y` is a short function and `N` is an `ε`-net of `X`, then `im f N` is an `ε`-net of `im f X` + +```agda +module _ + {l1 l2 l3 l4 l5 : Level} (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) + (f : short-function-Metric-Space X Y) + (ε : ℚ⁺) (N : net-Metric-Space l5 X ε) + where + + net-im-short-function-net-Metric-Space : + net-Metric-Space + ( l1 ⊔ l3 ⊔ l5) + ( im-short-function-Metric-Space X Y f) + ( ε) + net-im-short-function-net-Metric-Space = + net-im-uniformly-continuous-function-net-Metric-Space + ( X) + ( Y) + ( map-short-function-Metric-Space X Y f) + ( id-is-modulus-of-uniform-continuity-is-short-function-Metric-Space + ( X) + ( Y) + ( map-short-function-Metric-Space X Y f) + ( is-short-map-short-function-Metric-Space X Y f)) + ( ε) + ( N) +``` + +### If `f : X → Y` is an isometry and `N` is an `ε`-net of `X`, then `im f N` is an `ε`-net of `im f X` + +```agda +module _ + {l1 l2 l3 l4 l5 : Level} (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) + (f : isometry-Metric-Space X Y) + (ε : ℚ⁺) (N : net-Metric-Space l5 X ε) + where + + net-im-isometry-net-Metric-Space : + net-Metric-Space + ( l1 ⊔ l3 ⊔ l5) + ( im-isometry-Metric-Space X Y f) + ( ε) + net-im-isometry-net-Metric-Space = + net-im-short-function-net-Metric-Space X Y + ( short-isometry-Metric-Space X Y f) + ( ε) + ( N) +``` + +### If `f : X ≃ Y` is an isometric equivalence and `N` is an `ε`-net of `X`, then `im f A` is an `ε`-net of `Y` + +```agda +module _ + {l1 l2 l3 l4 l5 : Level} (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) + (f : isometric-equiv-Metric-Space X Y) + (ε : ℚ⁺) (N : net-Metric-Space l5 X ε) + where + + net-im-isometric-equiv-net-Metric-Space : net-Metric-Space (l1 ⊔ l3 ⊔ l5) Y ε + net-im-isometric-equiv-net-Metric-Space = + ( finitely-enumerable-subtype-im-finitely-enumerable-subtype + ( map-isometric-equiv-Metric-Space X Y f) + ( finitely-enumerable-subset-net-Metric-Space X ε N) , + is-approximation-im-isometric-equiv-approximation-Metric-Space X Y f ε + ( approximation-net-Metric-Space X ε N)) ``` diff --git a/src/metric-spaces/totally-bounded-metric-spaces.lagda.md b/src/metric-spaces/totally-bounded-metric-spaces.lagda.md index 36ab725854..36833e56f7 100644 --- a/src/metric-spaces/totally-bounded-metric-spaces.lagda.md +++ b/src/metric-spaces/totally-bounded-metric-spaces.lagda.md @@ -9,12 +9,23 @@ module metric-spaces.totally-bounded-metric-spaces where ```agda open import elementary-number-theory.positive-rational-numbers +open import foundation.dependent-pair-types +open import foundation.inhabited-types open import foundation.propositional-truncations open import foundation.propositions open import foundation.universe-levels +open import metric-spaces.equality-of-metric-spaces +open import metric-spaces.functions-metric-spaces +open import metric-spaces.images-isometries-metric-spaces +open import metric-spaces.images-metric-spaces +open import metric-spaces.images-short-functions-metric-spaces +open import metric-spaces.images-uniformly-continuous-functions-metric-spaces +open import metric-spaces.isometries-metric-spaces open import metric-spaces.metric-spaces open import metric-spaces.nets-metric-spaces +open import metric-spaces.short-functions-metric-spaces +open import metric-spaces.uniformly-continuous-functions-metric-spaces ```
@@ -29,18 +40,138 @@ if for every `ε : ℚ⁺`, it has an `ε`-[net](metric-spaces.nets-metric-space ```agda module _ - {l1 l2 : Level} (X : Metric-Space l1 l2) + {l1 l2 : Level} (l3 : Level) (X : Metric-Space l1 l2) where - modulus-of-total-boundedness-Metric-Space : UU (lsuc l1 ⊔ lsuc l2) + modulus-of-total-boundedness-Metric-Space : UU (l1 ⊔ l2 ⊔ lsuc l3) modulus-of-total-boundedness-Metric-Space = - (ε : ℚ⁺) → net-Metric-Space (l1 ⊔ l2) X ε + (ε : ℚ⁺) → net-Metric-Space l3 X ε - is-totally-bounded-prop-Metric-Space : Prop (lsuc l1 ⊔ lsuc l2) + is-totally-bounded-prop-Metric-Space : Prop (l1 ⊔ l2 ⊔ lsuc l3) is-totally-bounded-prop-Metric-Space = trunc-Prop modulus-of-total-boundedness-Metric-Space - is-totally-bounded-Metric-Space : UU (lsuc l1 ⊔ lsuc l2) + is-totally-bounded-Metric-Space : UU (l1 ⊔ l2 ⊔ lsuc l3) is-totally-bounded-Metric-Space = type-Prop is-totally-bounded-prop-Metric-Space ``` + +## Properties + +### The image of a totally bounded metric space under a uniformly continuous function is totally bounded + +```agda +module _ + {l1 l2 l3 l4 l5 : Level} (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) + (μX : modulus-of-total-boundedness-Metric-Space l5 X) + (f : type-function-Metric-Space X Y) + {μf : ℚ⁺ → ℚ⁺} + (is-muc-μf : is-modulus-of-uniform-continuity-function-Metric-Space X Y f μf) + where + + modulus-of-total-boundedness-im-modulated-uniformly-continuous-function-Metric-Space : + modulus-of-total-boundedness-Metric-Space + ( l1 ⊔ l3 ⊔ l5) + ( im-Metric-Space X Y f) + modulus-of-total-boundedness-im-modulated-uniformly-continuous-function-Metric-Space + ε = + net-im-uniformly-continuous-function-net-Metric-Space X Y f + ( is-muc-μf) + ( ε) + ( μX (μf ε)) + +module _ + {l1 l2 l3 l4 l5 : Level} (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) + (tbX : is-totally-bounded-Metric-Space l5 X) + (f : uniformly-continuous-function-Metric-Space X Y) + where + + abstract + is-totally-bounded-im-uniformly-continuous-function-is-totally-bounded-Metric-Space : + is-totally-bounded-Metric-Space + ( l1 ⊔ l3 ⊔ l5) + ( im-uniformly-continuous-function-Metric-Space X Y f) + is-totally-bounded-im-uniformly-continuous-function-is-totally-bounded-Metric-Space = + let + open + do-syntax-trunc-Prop + ( is-totally-bounded-prop-Metric-Space + ( l1 ⊔ l3 ⊔ l5) + ( im-uniformly-continuous-function-Metric-Space X Y f)) + in do + (_ , μf) ← + is-uniformly-continuous-map-uniformly-continuous-function-Metric-Space + ( X) + ( Y) + ( f) + μX ← tbX + unit-trunc-Prop + ( modulus-of-total-boundedness-im-modulated-uniformly-continuous-function-Metric-Space + ( X) + ( Y) + ( μX) + ( map-uniformly-continuous-function-Metric-Space X Y f) + ( μf)) +``` + +### The image of a totally bounded metric space under a short function is totally bounded + +```agda +module _ + {l1 l2 l3 l4 l5 : Level} (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) + (tbX : is-totally-bounded-Metric-Space l5 X) + (f : short-function-Metric-Space X Y) + where + + abstract + is-totally-bounded-im-short-function-is-totally-bounded-Metric-Space : + is-totally-bounded-Metric-Space + ( l1 ⊔ l3 ⊔ l5) + ( im-short-function-Metric-Space X Y f) + is-totally-bounded-im-short-function-is-totally-bounded-Metric-Space = + is-totally-bounded-im-uniformly-continuous-function-is-totally-bounded-Metric-Space + ( X) + ( Y) + ( tbX) + ( uniformly-continuous-short-function-Metric-Space X Y f) +``` + +### The image of a totally bounded metric space under an isometry is totally bounded + +```agda +module _ + {l1 l2 l3 l4 l5 : Level} (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) + (tbX : is-totally-bounded-Metric-Space l5 X) + (f : isometry-Metric-Space X Y) + where + + abstract + is-totally-bounded-im-isometry-is-totally-bounded-Metric-Space : + is-totally-bounded-Metric-Space + ( l1 ⊔ l3 ⊔ l5) + ( im-isometry-Metric-Space X Y f) + is-totally-bounded-im-isometry-is-totally-bounded-Metric-Space = + is-totally-bounded-im-short-function-is-totally-bounded-Metric-Space + ( X) + ( Y) + ( tbX) + ( short-isometry-Metric-Space X Y f) +``` + +### Total boundedness is preserved by isometric equivalences + +```agda +module _ + {l1 l2 l3 l4 l5 : Level} (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) + (tbX : is-totally-bounded-Metric-Space l5 X) + (f : isometric-equiv-Metric-Space X Y) + where + + abstract + preserves-is-totally-bounded-isometric-equiv-Metric-Space : + is-totally-bounded-Metric-Space (l1 ⊔ l3 ⊔ l5) Y + preserves-is-totally-bounded-isometric-equiv-Metric-Space = + map-is-inhabited + ( λ μX ε → net-im-isometric-equiv-net-Metric-Space X Y f ε (μX ε)) + ( tbX) +``` diff --git a/src/metric-spaces/uniformly-continuous-functions-metric-spaces.lagda.md b/src/metric-spaces/uniformly-continuous-functions-metric-spaces.lagda.md index 2be122008b..873a0d25f4 100644 --- a/src/metric-spaces/uniformly-continuous-functions-metric-spaces.lagda.md +++ b/src/metric-spaces/uniformly-continuous-functions-metric-spaces.lagda.md @@ -14,6 +14,7 @@ open import foundation.existential-quantification open import foundation.function-types open import foundation.functoriality-dependent-pair-types open import foundation.inhabited-subtypes +open import foundation.logical-equivalences open import foundation.propositional-truncations open import foundation.propositions open import foundation.subtypes @@ -64,6 +65,11 @@ module _ x m) + is-modulus-of-uniform-continuity-function-Metric-Space : + (ℚ⁺ → ℚ⁺) → UU (l1 ⊔ l2 ⊔ l4) + is-modulus-of-uniform-continuity-function-Metric-Space m = + type-Prop (is-modulus-of-uniform-continuity-prop-function-Metric-Space m) + modulus-of-uniform-continuity-function-Metric-Space : UU (l1 ⊔ l2 ⊔ l4) modulus-of-uniform-continuity-function-Metric-Space = type-subtype is-modulus-of-uniform-continuity-prop-function-Metric-Space @@ -191,6 +197,34 @@ module _ ( f))) ``` +### A function is short if and only if the identity is a modulus of uniform continuity for it + +```agda +module _ + {l1 l2 l3 l4 : Level} (A : Metric-Space l1 l2) (B : Metric-Space l3 l4) + (f : type-function-Metric-Space A B) + where + + is-short-id-is-modulus-of-uniform-continuity-function-Metric-Space : + is-modulus-of-uniform-continuity-function-Metric-Space A B f id → + is-short-function-Metric-Space A B f + is-short-id-is-modulus-of-uniform-continuity-function-Metric-Space H ε x = + H x ε + + id-is-modulus-of-uniform-continuity-is-short-function-Metric-Space : + is-short-function-Metric-Space A B f → + is-modulus-of-uniform-continuity-function-Metric-Space A B f id + id-is-modulus-of-uniform-continuity-is-short-function-Metric-Space H x ε = + H ε x + + is-short-iff-id-is-modulus-of-uniform-continuity-function-Metric-Space : + is-short-function-Metric-Space A B f ↔ + is-modulus-of-uniform-continuity-function-Metric-Space A B f id + is-short-iff-id-is-modulus-of-uniform-continuity-function-Metric-Space = + ( id-is-modulus-of-uniform-continuity-is-short-function-Metric-Space , + is-short-id-is-modulus-of-uniform-continuity-function-Metric-Space) +``` + ### Short maps are uniformly continuous ```agda diff --git a/src/order-theory/meet-semilattices.lagda.md b/src/order-theory/meet-semilattices.lagda.md index cac6495b25..42b54390a0 100644 --- a/src/order-theory/meet-semilattices.lagda.md +++ b/src/order-theory/meet-semilattices.lagda.md @@ -34,7 +34,7 @@ open import order-theory.preorders A {{#concept "meet-semilattice" WDID=Q29018102 WD="lower semilattice" Agda=Meet-Semilattice}} is a [poset](order-theory.posets.md) in which every pair of elements has a -[greatest binary lower bound](order-theory.greatest-lower-bounds.md). +[greatest binary lower bound](order-theory.greatest-lower-bounds-posets.md). Alternatively, meet-semilattices can be defined algebraically as a set `X` equipped with a binary operation `∧ : X → X → X` satisfying diff --git a/src/univalent-combinatorics/finitely-enumerable-subtypes.lagda.md b/src/univalent-combinatorics/finitely-enumerable-subtypes.lagda.md index 9826264e26..c3f60b3bf9 100644 --- a/src/univalent-combinatorics/finitely-enumerable-subtypes.lagda.md +++ b/src/univalent-combinatorics/finitely-enumerable-subtypes.lagda.md @@ -7,9 +7,19 @@ module univalent-combinatorics.finitely-enumerable-subtypes where
Imports ```agda +open import foundation.action-on-identifications-functions open import foundation.dependent-pair-types +open import foundation.existential-quantification +open import foundation.fibers-of-maps +open import foundation.function-types +open import foundation.identity-types +open import foundation.images +open import foundation.images-subtypes +open import foundation.inhabited-subtypes +open import foundation.propositional-truncations open import foundation.propositions open import foundation.subtypes +open import foundation.surjective-maps open import foundation.universe-levels open import univalent-combinatorics.finitely-enumerable-types @@ -32,6 +42,9 @@ module _ {l1 l2 : Level} {X : UU l1} (S : subtype l2 X) where + finite-enumeration-subtype : UU (l1 ⊔ l2) + finite-enumeration-subtype = finite-enumeration (type-subtype S) + is-finitely-enumerable-prop-subtype : Prop (l1 ⊔ l2) is-finitely-enumerable-prop-subtype = is-finitely-enumerable-prop (type-subtype S) @@ -58,4 +71,58 @@ module _ type-finitely-enumerable-subtype : UU (l1 ⊔ l2) type-finitely-enumerable-subtype = type-subtype subtype-finitely-enumerable-subtype + + finitely-enumerable-type-finitely-enumerable-subtype : + Finitely-Enumerable-Type (l1 ⊔ l2) + finitely-enumerable-type-finitely-enumerable-subtype = + ( type-finitely-enumerable-subtype , + is-finitely-enumerable-subtype-finitely-enumerable-subtype) + + inclusion-finitely-enumerable-subtype : type-finitely-enumerable-subtype → X + inclusion-finitely-enumerable-subtype = pr1 +``` + +## Properties + +### The property of being an inhabited finitely enumerable subtype + +```agda +module _ + {l1 l2 : Level} {X : UU l1} (S : finitely-enumerable-subtype l2 X) + where + + is-inhabited-prop-finitely-enumerable-subtype : Prop (l1 ⊔ l2) + is-inhabited-prop-finitely-enumerable-subtype = + is-inhabited-subtype-Prop (subtype-finitely-enumerable-subtype S) + + is-inhabited-finitely-enumerable-subtype : UU (l1 ⊔ l2) + is-inhabited-finitely-enumerable-subtype = + is-inhabited-subtype (subtype-finitely-enumerable-subtype S) +``` + +### The image of a finitely enumerable subtype under a map is finitely enumerable + +```agda +module _ + {l1 l2 l3 : Level} {X : UU l1} {Y : UU l2} (f : X → Y) + (S : finitely-enumerable-subtype l3 X) + where + + im-finitely-enumerable-subtype : subtype (l1 ⊔ l2 ⊔ l3) Y + im-finitely-enumerable-subtype = + im-subtype f (subtype-finitely-enumerable-subtype S) + + abstract + is-finitely-enumerable-im-finitely-enumerable-subtype : + is-finitely-enumerable-subtype im-finitely-enumerable-subtype + is-finitely-enumerable-im-finitely-enumerable-subtype = + is-finitely-enumerable-im-Finitely-Enumerable-Type + ( finitely-enumerable-type-finitely-enumerable-subtype S) + ( f ∘ inclusion-finitely-enumerable-subtype S) + + finitely-enumerable-subtype-im-finitely-enumerable-subtype : + finitely-enumerable-subtype (l1 ⊔ l2 ⊔ l3) Y + finitely-enumerable-subtype-im-finitely-enumerable-subtype = + ( im-finitely-enumerable-subtype , + is-finitely-enumerable-im-finitely-enumerable-subtype) ``` diff --git a/src/univalent-combinatorics/finitely-enumerable-types.lagda.md b/src/univalent-combinatorics/finitely-enumerable-types.lagda.md index 5e4c08a6ec..11cc061fef 100644 --- a/src/univalent-combinatorics/finitely-enumerable-types.lagda.md +++ b/src/univalent-combinatorics/finitely-enumerable-types.lagda.md @@ -18,6 +18,7 @@ open import foundation.coproduct-types open import foundation.decidable-equality open import foundation.dependent-pair-types open import foundation.embeddings +open import foundation.empty-types open import foundation.equality-cartesian-product-types open import foundation.equivalences open import foundation.existential-quantification @@ -27,6 +28,8 @@ open import foundation.functoriality-cartesian-product-types open import foundation.functoriality-coproduct-types open import foundation.functoriality-propositional-truncation open import foundation.identity-types +open import foundation.images +open import foundation.inhabited-types open import foundation.logical-equivalences open import foundation.propositional-truncations open import foundation.propositions @@ -38,6 +41,8 @@ open import foundation.type-arithmetic-coproduct-types open import foundation.unit-type open import foundation.universe-levels +open import logic.functoriality-existential-quantification + open import univalent-combinatorics.cartesian-product-types open import univalent-combinatorics.coproduct-types open import univalent-combinatorics.counting @@ -92,6 +97,17 @@ module _ ## Properties +### Types with zero elements in their finite enumeration are empty + +```agda +abstract + is-empty-is-zero-finite-enumeration : + {l : Level} {X : UU l} → (eX : finite-enumeration X) → (pr1 eX = zero-ℕ) → + is-empty X + is-empty-is-zero-finite-enumeration (_ , Fin-0↠X) refl = + is-empty-surjection Fin-0↠X id +``` + ### Finitely enumerable types are closed under equivalences ```agda @@ -376,6 +392,29 @@ module _ ( dedekind-finite-type-Finitely-Enumerable-Type Y) ``` +### The image of a finitely enumerable type under a map is finitely enumerable + +```agda +module _ + {l1 l2 : Level} (X : Finitely-Enumerable-Type l1) {Y : UU l2} + (f : type-Finitely-Enumerable-Type X → Y) + where + + abstract + is-finitely-enumerable-im-Finitely-Enumerable-Type : + is-finitely-enumerable (im f) + is-finitely-enumerable-im-Finitely-Enumerable-Type = + map-tot-exists + ( λ n Fin-n↠X → + comp-surjection (map-unit-im f , is-surjective-map-unit-im f) Fin-n↠X) + ( is-finitely-enumerable-type-Finitely-Enumerable-Type X) + + im-Finitely-Enumerable-Type : Finitely-Enumerable-Type (l1 ⊔ l2) + im-Finitely-Enumerable-Type = + ( im f , + is-finitely-enumerable-im-Finitely-Enumerable-Type) +``` + ## See also - A [Kuratowski finite set](univalent-combinatorics.kuratowski-finite-sets.md) From a1ddd6a0a15bdbf9fcde31960d58705c0ab19e4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Mon, 1 Sep 2025 21:19:36 +0200 Subject: [PATCH 37/97] Add submodules of left modules over rings (#1511) This PR adds subsets of left modules over rings. If such a subset contains the zero element/vector, is closed under addition and multiplication by a scalar from the ring, we call this subset a submodule. The PR contains a proof that the intersection of a family of submodules forms a submodule and a proof that a submodule has the structure of a module. Thanks to @VojtechStep for some help along the way! --- CONTRIBUTORS.toml | 6 + src/linear-algebra.lagda.md | 2 + .../left-modules-rings.lagda.md | 13 + .../left-submodules-rings.lagda.md | 367 ++++++++++++++++++ .../subsets-left-modules-rings.lagda.md | 129 ++++++ 5 files changed, 517 insertions(+) create mode 100644 src/linear-algebra/left-submodules-rings.lagda.md create mode 100644 src/linear-algebra/subsets-left-modules-rings.lagda.md diff --git a/CONTRIBUTORS.toml b/CONTRIBUTORS.toml index 4df1c78a2a..83f0b1b6b2 100644 --- a/CONTRIBUTORS.toml +++ b/CONTRIBUTORS.toml @@ -275,3 +275,9 @@ github = "arnoudvanderleer" displayName = "Ben Connors" usernames = [ "Ben Connors" ] github = "ben-connors" + +[[contributors]] +displayName = "Šimon Brandner" +usernames = ["Šimon Brandner"] +github = "SimonBrandner" +homepage = "https://simonbrandner.cz/" diff --git a/src/linear-algebra.lagda.md b/src/linear-algebra.lagda.md index ba77a60ccd..772bad9d20 100644 --- a/src/linear-algebra.lagda.md +++ b/src/linear-algebra.lagda.md @@ -20,6 +20,7 @@ open import linear-algebra.finite-sequences-in-semigroups public open import linear-algebra.finite-sequences-in-semirings public open import linear-algebra.functoriality-matrices public open import linear-algebra.left-modules-rings public +open import linear-algebra.left-submodules-rings public open import linear-algebra.linear-maps-left-modules-rings public open import linear-algebra.matrices public open import linear-algebra.matrices-on-rings public @@ -30,6 +31,7 @@ open import linear-algebra.right-modules-rings public open import linear-algebra.scalar-multiplication-matrices public open import linear-algebra.scalar-multiplication-tuples public open import linear-algebra.scalar-multiplication-tuples-on-rings public +open import linear-algebra.subsets-left-modules-rings public open import linear-algebra.transposition-matrices public open import linear-algebra.tuples-on-commutative-monoids public open import linear-algebra.tuples-on-commutative-rings public diff --git a/src/linear-algebra/left-modules-rings.lagda.md b/src/linear-algebra/left-modules-rings.lagda.md index 82d977be40..35ae1ca391 100644 --- a/src/linear-algebra/left-modules-rings.lagda.md +++ b/src/linear-algebra/left-modules-rings.lagda.md @@ -83,6 +83,9 @@ module _ type-left-module-Ring : UU l2 type-left-module-Ring = type-Ab ab-left-module-Ring + is-set-type-left-module-Ring : is-set type-left-module-Ring + is-set-type-left-module-Ring = pr2 set-left-module-Ring + add-left-module-Ring : (x y : type-left-module-Ring) → type-left-module-Ring add-left-module-Ring = add-Ab ab-left-module-Ring @@ -133,6 +136,16 @@ module _ associative-add-Ab ab-left-module-Ring ``` +### Commutativity of addition + +```agda + commutative-add-left-module-Ring : + (x y : type-left-module-Ring) → + add-left-module-Ring x y = add-left-module-Ring y x + commutative-add-left-module-Ring = + commutative-add-Ab ab-left-module-Ring +``` + ### Unit laws for addition ```agda diff --git a/src/linear-algebra/left-submodules-rings.lagda.md b/src/linear-algebra/left-submodules-rings.lagda.md new file mode 100644 index 0000000000..e54f51ecdf --- /dev/null +++ b/src/linear-algebra/left-submodules-rings.lagda.md @@ -0,0 +1,367 @@ +# Left submodules over rings + +```agda +module linear-algebra.left-submodules-rings where +``` + +
Imports + +```agda +open import foundation.action-on-identifications-functions +open import foundation.dependent-pair-types +open import foundation.identity-types +open import foundation.intersections-subtypes +open import foundation.propositions +open import foundation.sets +open import foundation.subtypes +open import foundation.universe-levels + +open import foundation-core.embeddings +open import foundation-core.equivalences +open import foundation-core.injective-maps +open import foundation-core.transport-along-identifications + +open import group-theory.abelian-groups +open import group-theory.endomorphism-rings-abelian-groups +open import group-theory.groups +open import group-theory.homomorphisms-abelian-groups +open import group-theory.homomorphisms-semigroups +open import group-theory.monoids +open import group-theory.semigroups + +open import linear-algebra.left-modules-rings +open import linear-algebra.subsets-left-modules-rings + +open import ring-theory.homomorphisms-rings +open import ring-theory.rings +``` + +
+ +## Idea + +A +{{#concept "left submodule" Disambiguation="of a left module over a ring" Agda=is-left-submodule-prop-Ring Agda=left-submodule-Ring}} +of a [left module](linear-algebra.left-modules-rings.md) `M` over a +[ring](ring-theory.rings.md) `R` is a +[subset](linear-algebra.subsets-left-modules-rings.md) of `M` that is closed +under addition and multiplication by a scalar from `R`. + +## Definitions + +### Submodules over rings + +```agda +module _ + {l1 l2 l3 : Level} + (R : Ring l1) + (M : left-module-Ring l2 R) + (S : subset-left-module-Ring l3 R M) + where + + is-left-submodule-prop-Ring : Prop (l1 ⊔ l2 ⊔ l3) + is-left-submodule-prop-Ring = + product-Prop + ( contains-zero-prop-subset-left-module-Ring R M S) + ( product-Prop + ( is-closed-under-addition-prop-subset-left-module-Ring R M S) + ( is-closed-under-multiplication-by-scalar-prop-subset-left-module-Ring + R + M + S)) + + is-left-submodule-Ring : UU (l1 ⊔ l2 ⊔ l3) + is-left-submodule-Ring = type-Prop is-left-submodule-prop-Ring +``` + +### The type of submodules of a left module + +```agda +left-submodule-Ring : + {l1 l2 : Level} + (l : Level) (R : Ring l1) (M : left-module-Ring l2 R) → UU (lsuc l ⊔ l1 ⊔ l2) +left-submodule-Ring l R M = + type-subtype (is-left-submodule-prop-Ring {l3 = l} R M) + +module _ + {l1 l2 l3 : Level} + (R : Ring l1) + (M : left-module-Ring l2 R) + (N : left-submodule-Ring l3 R M) + where + + subset-left-submodule-Ring : subset-left-module-Ring l3 R M + subset-left-submodule-Ring = + inclusion-subtype (is-left-submodule-prop-Ring R M) N + + type-left-submodule-Ring : UU (l2 ⊔ l3) + type-left-submodule-Ring = type-subtype subset-left-submodule-Ring + + inclusion-left-submodule-Ring : + type-left-submodule-Ring → type-left-module-Ring R M + inclusion-left-submodule-Ring = + inclusion-subtype subset-left-submodule-Ring + + is-emb-inclusion-left-submodule-Ring : + is-emb inclusion-left-submodule-Ring + is-emb-inclusion-left-submodule-Ring = + is-emb-inclusion-subtype subset-left-submodule-Ring + + eq-left-submodule-Ring-eq-left-module-Ring : + is-injective (inclusion-left-submodule-Ring) + eq-left-submodule-Ring-eq-left-module-Ring {x} {y} = + map-inv-is-equiv (is-emb-inclusion-left-submodule-Ring x y) + + is-closed-under-addition-left-submodule-Ring : + is-closed-under-addition-subset-left-module-Ring R M + subset-left-submodule-Ring + is-closed-under-addition-left-submodule-Ring = pr1 (pr2 (pr2 N)) + + is-closed-under-multiplication-by-scalar-left-submodule-Ring : + is-closed-under-multiplication-by-scalar-subset-left-module-Ring R M + subset-left-submodule-Ring + is-closed-under-multiplication-by-scalar-left-submodule-Ring = + pr2 (pr2 (pr2 N)) + + contains-zero-left-submodule-Ring : + contains-zero-subset-left-module-Ring R M subset-left-submodule-Ring + contains-zero-left-submodule-Ring = pr1 (pr2 N) + + unit-left-submodule-Ring : type-left-submodule-Ring + pr1 unit-left-submodule-Ring = zero-left-module-Ring R M + pr2 unit-left-submodule-Ring = contains-zero-left-submodule-Ring +``` + +## Properties + +### The submodule is closed under negation + +```agda +is-closed-under-negation-left-submodule-Ring : + {l1 l2 l3 : Level} + (R : Ring l1) + (M : left-module-Ring l2 R) + (N : left-submodule-Ring l3 R M) → + is-closed-under-negation-subset-left-module-Ring R M + ( subset-left-submodule-Ring R M N) +is-closed-under-negation-left-submodule-Ring R M N x x-in-subset = + tr + ( λ x' → pr1 (subset-left-submodule-Ring R M N x')) + ( mul-neg-one-left-module-Ring R M x) + ( is-closed-under-multiplication-by-scalar-left-submodule-Ring R M N + ( neg-one-Ring R) + ( x) + ( x-in-subset)) +``` + +### The intersection of a family of submodules is a submodule + +```agda +module _ + {l1 l2 l3 : Level} {I : UU l2} + (R : Ring l1) (M : left-module-Ring l2 R) (F : I → left-submodule-Ring l3 R M) + where + + subset-intersection-family-of-submodules : + subset-left-module-Ring (l2 ⊔ l3) R M + subset-intersection-family-of-submodules = + intersection-family-of-subtypes + ( λ i → subset-left-submodule-Ring R M (F i)) + + is-left-submodule-intersection-submodule-Ring : + is-left-submodule-Ring R M subset-intersection-family-of-submodules + pr1 is-left-submodule-intersection-submodule-Ring i = + contains-zero-left-submodule-Ring R M (F i) + pr1 (pr2 is-left-submodule-intersection-submodule-Ring) + x y x-in-subset y-in-subset i = + is-closed-under-addition-left-submodule-Ring R M (F i) x y + ( x-in-subset i) + ( y-in-subset i) + pr2 (pr2 is-left-submodule-intersection-submodule-Ring) r x x-in-subset i = + is-closed-under-multiplication-by-scalar-left-submodule-Ring R M (F i) r x + ( x-in-subset i) +``` + +### A submodule has the structure of a module + +```agda +module _ + {l1 l2 l3 : Level} + (R : Ring l1) + (M : left-module-Ring l2 R) + (N : left-submodule-Ring l3 R M) + where + + neg-left-submodule-Ring : + type-left-submodule-Ring R M N → type-left-submodule-Ring R M N + pr1 (neg-left-submodule-Ring x) = neg-left-module-Ring R M (pr1 x) + pr2 (neg-left-submodule-Ring x) = + is-closed-under-negation-left-submodule-Ring R M N (pr1 x) (pr2 x) + + add-left-submodule-Ring : + (x y : type-left-submodule-Ring R M N) → type-left-submodule-Ring R M N + pr1 (add-left-submodule-Ring x y) = + add-left-module-Ring R M (pr1 x) (pr1 y) + pr2 (add-left-submodule-Ring x y) = + is-closed-under-addition-left-submodule-Ring R M N + ( pr1 x) + ( pr1 y) + ( pr2 x) + ( pr2 y) + + mul-left-submodule-Ring : + (r : type-Ring R) + (x : type-left-submodule-Ring R M N) → + type-left-submodule-Ring R M N + pr1 (mul-left-submodule-Ring r x) = + mul-left-module-Ring R M r (pr1 x) + pr2 (mul-left-submodule-Ring r x) = + is-closed-under-multiplication-by-scalar-left-submodule-Ring R M N r + ( pr1 x) + ( pr2 x) + + associative-add-left-submodule-Ring : + (x y z : type-left-submodule-Ring R M N) → + add-left-submodule-Ring (add-left-submodule-Ring x y) z = + add-left-submodule-Ring x (add-left-submodule-Ring y z) + associative-add-left-submodule-Ring x y z = + eq-left-submodule-Ring-eq-left-module-Ring R M N + ( associative-add-left-module-Ring R M (pr1 x) (pr1 y) (pr1 z)) + + left-unit-law-add-left-submodule-Ring : + (x : type-left-submodule-Ring R M N) → + add-left-submodule-Ring (unit-left-submodule-Ring R M N) x = x + left-unit-law-add-left-submodule-Ring x = + eq-left-submodule-Ring-eq-left-module-Ring R M N + ( left-unit-law-add-left-module-Ring R M (pr1 x)) + + right-unit-law-add-left-submodule-Ring : + (x : type-left-submodule-Ring R M N) → + add-left-submodule-Ring x (unit-left-submodule-Ring R M N) = x + right-unit-law-add-left-submodule-Ring x = + eq-left-submodule-Ring-eq-left-module-Ring R M N + ( right-unit-law-add-left-module-Ring R M (pr1 x)) + + left-inverse-law-add-left-submodule-Ring : + (x : type-left-submodule-Ring R M N) → + add-left-submodule-Ring (neg-left-submodule-Ring x) x = + unit-left-submodule-Ring R M N + left-inverse-law-add-left-submodule-Ring x = + eq-left-submodule-Ring-eq-left-module-Ring R M N + ( left-inverse-law-add-left-module-Ring R M (pr1 x)) + + right-inverse-law-add-left-submodule-Ring : + (x : type-left-submodule-Ring R M N) → + add-left-submodule-Ring x (neg-left-submodule-Ring x) = + unit-left-submodule-Ring R M N + right-inverse-law-add-left-submodule-Ring x = + eq-left-submodule-Ring-eq-left-module-Ring R M N + ( right-inverse-law-add-left-module-Ring R M (pr1 x)) + + commutative-add-left-submodule-Ring : + (x y : type-left-submodule-Ring R M N) → + add-left-submodule-Ring x y = add-left-submodule-Ring y x + commutative-add-left-submodule-Ring x y = + eq-left-submodule-Ring-eq-left-module-Ring R M N + ( commutative-add-left-module-Ring R M (pr1 x) (pr1 y)) + + left-distributive-law-mul-add-left-submodule-Ring : + (r : type-Ring R) + (x y : type-left-submodule-Ring R M N) → + mul-left-submodule-Ring r (add-left-submodule-Ring x y) = + add-left-submodule-Ring + ( mul-left-submodule-Ring r x) + ( mul-left-submodule-Ring r y) + left-distributive-law-mul-add-left-submodule-Ring r x y = + eq-left-submodule-Ring-eq-left-module-Ring R M N + ( left-distributive-mul-add-left-module-Ring R M r (pr1 x) (pr1 y)) + + right-distributive-law-mul-add-left-submodule-Ring : + (r s : type-Ring R) + (x : type-left-submodule-Ring R M N) → + mul-left-submodule-Ring (add-Ring R r s) x = + add-left-submodule-Ring + ( mul-left-submodule-Ring r x) + ( mul-left-submodule-Ring s x) + right-distributive-law-mul-add-left-submodule-Ring r s x = + eq-left-submodule-Ring-eq-left-module-Ring R M N + ( right-distributive-mul-add-left-module-Ring R M r s (pr1 x)) + + associative-mul-left-submodule-Ring : + (r s : type-Ring R) + (x : type-left-submodule-Ring R M N) → + mul-left-submodule-Ring (mul-Ring R r s) x = + mul-left-submodule-Ring r (mul-left-submodule-Ring s x) + associative-mul-left-submodule-Ring r s x = + eq-left-submodule-Ring-eq-left-module-Ring R M N + ( associative-mul-left-module-Ring R M r s (pr1 x)) + + left-unit-law-mul-left-submodule-Ring : + (x : type-left-submodule-Ring R M N) → + mul-left-submodule-Ring (one-Ring R) x = x + left-unit-law-mul-left-submodule-Ring x = + eq-left-submodule-Ring-eq-left-module-Ring R M N + ( left-unit-law-mul-left-module-Ring R M (pr1 x)) + + set-left-submodule-Ring : Set (l2 ⊔ l3) + pr1 set-left-submodule-Ring = type-left-submodule-Ring R M N + pr2 set-left-submodule-Ring = + is-set-type-subtype + ( subset-left-submodule-Ring R M N) + ( is-set-type-left-module-Ring R M) + + semigroup-left-submodule-Ring : Semigroup (l2 ⊔ l3) + pr1 semigroup-left-submodule-Ring = set-left-submodule-Ring + pr1 (pr2 semigroup-left-submodule-Ring) = add-left-submodule-Ring + pr2 (pr2 semigroup-left-submodule-Ring) = associative-add-left-submodule-Ring + + group-left-submodule-Ring : Group (l2 ⊔ l3) + pr1 group-left-submodule-Ring = semigroup-left-submodule-Ring + pr1 (pr1 (pr2 group-left-submodule-Ring)) = unit-left-submodule-Ring R M N + pr1 (pr2 (pr1 (pr2 group-left-submodule-Ring))) = + left-unit-law-add-left-submodule-Ring + pr2 (pr2 (pr1 (pr2 group-left-submodule-Ring))) = + right-unit-law-add-left-submodule-Ring + pr1 (pr2 (pr2 group-left-submodule-Ring)) = neg-left-submodule-Ring + pr1 (pr2 (pr2 (pr2 group-left-submodule-Ring))) = + left-inverse-law-add-left-submodule-Ring + pr2 (pr2 (pr2 (pr2 group-left-submodule-Ring))) = + right-inverse-law-add-left-submodule-Ring + + ab-left-submodule-Ring : Ab (l2 ⊔ l3) + pr1 ab-left-submodule-Ring = group-left-submodule-Ring + pr2 ab-left-submodule-Ring = commutative-add-left-submodule-Ring + + endomorphism-ring-left-submodule-Ring : Ring (l2 ⊔ l3) + endomorphism-ring-left-submodule-Ring = + endomorphism-ring-Ab ab-left-submodule-Ring + + map-hom-left-submodule-Ring : + (r : type-Ring R) → hom-Ab ab-left-submodule-Ring ab-left-submodule-Ring + pr1 (map-hom-left-submodule-Ring r) = mul-left-submodule-Ring r + pr2 (map-hom-left-submodule-Ring r) {x} {y} = + left-distributive-law-mul-add-left-submodule-Ring r x y + + mul-hom-left-submodule-Ring : + hom-Ring R endomorphism-ring-left-submodule-Ring + pr1 (pr1 mul-hom-left-submodule-Ring) = map-hom-left-submodule-Ring + pr2 (pr1 mul-hom-left-submodule-Ring) {r} {s} = + eq-htpy-hom-Ab + ab-left-submodule-Ring + ab-left-submodule-Ring + ( right-distributive-law-mul-add-left-submodule-Ring r s) + pr1 (pr2 mul-hom-left-submodule-Ring) {r} {s} = + eq-htpy-hom-Ab + ab-left-submodule-Ring + ab-left-submodule-Ring + ( associative-mul-left-submodule-Ring r s) + pr2 (pr2 mul-hom-left-submodule-Ring) = + eq-htpy-hom-Ab + ab-left-submodule-Ring + ab-left-submodule-Ring + left-unit-law-mul-left-submodule-Ring + + left-module-left-submodule-Ring : left-module-Ring (l2 ⊔ l3) R + pr1 left-module-left-submodule-Ring = ab-left-submodule-Ring + pr2 left-module-left-submodule-Ring = mul-hom-left-submodule-Ring +``` diff --git a/src/linear-algebra/subsets-left-modules-rings.lagda.md b/src/linear-algebra/subsets-left-modules-rings.lagda.md new file mode 100644 index 0000000000..5867b4a98b --- /dev/null +++ b/src/linear-algebra/subsets-left-modules-rings.lagda.md @@ -0,0 +1,129 @@ +# Subsets of left modules over rings + +```agda +module linear-algebra.subsets-left-modules-rings where +``` + +
Imports + +```agda +open import foundation.conjunction +open import foundation.propositions +open import foundation.subtypes +open import foundation.universe-levels + +open import linear-algebra.left-modules-rings + +open import ring-theory.rings +``` + +
+ +## Idea + +A +{{#concept "subset" Disambiguation="of a left module of a ring" Agda=subset-left-module-Ring}} +of a [left module](linear-algebra.left-modules-rings.md) `M` over a +[ring](ring-theory.rings.md) `R` is a [subset](foundation.subtypes.md) of the +underlying type of `M`. + +## Definitions + +### Subsets of left modules over rings + +```agda +subset-left-module-Ring : + {l1 l2 : Level} + (l : Level) (R : Ring l1) (M : left-module-Ring l2 R) → UU (l2 ⊔ lsuc l) +subset-left-module-Ring l R M = subtype l (type-left-module-Ring R M) +``` + +### The condition that a subset is closed under addition + +```agda +module _ + {l1 l2 l3 : Level} + (R : Ring l1) (M : left-module-Ring l2 R) (S : subset-left-module-Ring l3 R M) + where + + is-closed-under-addition-prop-subset-left-module-Ring : Prop (l2 ⊔ l3) + is-closed-under-addition-prop-subset-left-module-Ring = + Π-Prop + ( type-left-module-Ring R M) + ( λ x → + Π-Prop + ( type-left-module-Ring R M) + ( λ y → + hom-Prop + ( S x) + ( hom-Prop + ( S y) + ( S (add-left-module-Ring R M x y))))) + + is-closed-under-addition-subset-left-module-Ring : UU (l2 ⊔ l3) + is-closed-under-addition-subset-left-module-Ring = + type-Prop is-closed-under-addition-prop-subset-left-module-Ring +``` + +### The condition that a subset is closed under multiplication by a scalar + +```agda +module _ + {l1 l2 l3 : Level} + (R : Ring l1) (M : left-module-Ring l2 R) (S : subset-left-module-Ring l3 R M) + where + + is-closed-under-multiplication-by-scalar-prop-subset-left-module-Ring : + Prop (l1 ⊔ l2 ⊔ l3) + is-closed-under-multiplication-by-scalar-prop-subset-left-module-Ring = + Π-Prop + ( type-Ring R) + ( λ r → + Π-Prop + ( type-left-module-Ring R M) + ( λ x → + hom-Prop + ( S x) + ( S (mul-left-module-Ring R M r x)))) + + is-closed-under-multiplication-by-scalar-subset-left-module-Ring : + UU (l1 ⊔ l2 ⊔ l3) + is-closed-under-multiplication-by-scalar-subset-left-module-Ring = + type-Prop + is-closed-under-multiplication-by-scalar-prop-subset-left-module-Ring +``` + +### The condition that a subset contains zero + +```agda +module _ + {l1 l2 l3 : Level} + (R : Ring l1) (M : left-module-Ring l2 R) (S : subset-left-module-Ring l3 R M) + where + + contains-zero-prop-subset-left-module-Ring : Prop l3 + contains-zero-prop-subset-left-module-Ring = S (zero-left-module-Ring R M) + + contains-zero-subset-left-module-Ring : UU l3 + contains-zero-subset-left-module-Ring = + type-Prop contains-zero-prop-subset-left-module-Ring +``` + +### The condition that a subset is closed under negations + +```agda +module _ + {l1 l2 l3 : Level} + (R : Ring l1) (M : left-module-Ring l2 R) (S : subset-left-module-Ring l3 R M) + where + + is-closed-under-negation-prop-subset-left-module-Ring : Prop (l2 ⊔ l3) + is-closed-under-negation-prop-subset-left-module-Ring = + Π-Prop + ( type-left-module-Ring R M) + ( λ x → hom-Prop (S x) (S (neg-left-module-Ring R M x))) + + is-closed-under-negation-subset-left-module-Ring : UU (l2 ⊔ l3) + is-closed-under-negation-subset-left-module-Ring = + type-Prop is-closed-under-negation-prop-subset-left-module-Ring +``` From 367e596ea6fbe69cea860c06512680a94b7cbd67 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 1 Sep 2025 22:13:37 +0200 Subject: [PATCH 38/97] dict --- config/codespell-dictionary.txt => codespell-dictionary.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename config/codespell-dictionary.txt => codespell-dictionary.txt (100%) diff --git a/config/codespell-dictionary.txt b/codespell-dictionary.txt similarity index 100% rename from config/codespell-dictionary.txt rename to codespell-dictionary.txt From 34a939b442d5307f370e31b36b7410609a6a14ae Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 1 Sep 2025 22:14:11 +0200 Subject: [PATCH 39/97] dict --- codespell-dictionary.txt => config/codespell-dictionary.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename codespell-dictionary.txt => config/codespell-dictionary.txt (100%) diff --git a/codespell-dictionary.txt b/config/codespell-dictionary.txt similarity index 100% rename from codespell-dictionary.txt rename to config/codespell-dictionary.txt From 0b74947eb2cda42c5b50dcd8fa8b62a0a5751b00 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Tue, 2 Sep 2025 05:19:19 -0700 Subject: [PATCH 40/97] Simplify the minimum of real numbers (#1524) It's simpler to reuse the logic for maximum than to reinvent it for the minimum of real numbers. --- .../minimum-real-numbers.lagda.md | 142 ++++++------------ 1 file changed, 49 insertions(+), 93 deletions(-) diff --git a/src/real-numbers/minimum-real-numbers.lagda.md b/src/real-numbers/minimum-real-numbers.lagda.md index ce2875aae7..7e414642ec 100644 --- a/src/real-numbers/minimum-real-numbers.lagda.md +++ b/src/real-numbers/minimum-real-numbers.lagda.md @@ -11,12 +11,13 @@ module real-numbers.minimum-real-numbers where ```agda open import elementary-number-theory.positive-rational-numbers +open import foundation.binary-transport open import foundation.dependent-pair-types open import foundation.disjunction open import foundation.empty-types +open import foundation.identity-types open import foundation.logical-equivalences -open import foundation.propositional-truncations -open import foundation.propositions +open import foundation.transport-along-identifications open import foundation.universe-levels open import order-theory.greatest-lower-bounds-large-posets @@ -24,14 +25,12 @@ open import order-theory.large-meet-semilattices open import real-numbers.addition-real-numbers open import real-numbers.dedekind-real-numbers +open import real-numbers.difference-real-numbers open import real-numbers.inequality-real-numbers -open import real-numbers.lower-dedekind-real-numbers -open import real-numbers.minimum-lower-dedekind-real-numbers -open import real-numbers.minimum-upper-dedekind-real-numbers -open import real-numbers.positive-real-numbers +open import real-numbers.maximum-real-numbers +open import real-numbers.negation-real-numbers open import real-numbers.rational-real-numbers open import real-numbers.strict-inequality-real-numbers -open import real-numbers.upper-dedekind-real-numbers ```
@@ -41,8 +40,8 @@ open import real-numbers.upper-dedekind-real-numbers The {{#concept "minimum" Disambiguation="binary, Dedekind real numbers" Agda=min-ℝ WD="minimum" WDID=Q10585806}} of two [Dedekind real numbers](real-numbers.dedekind-real-numbers.md) `x` and -`y` is a Dedekind real number with lower cut equal to the intersection of `x` -and `y`'s lower cuts, and upper cut equal to the union of their upper cuts. +`y` is their +[greatest lower bound](order-theory.greatest-lower-bounds-large-posets.md). ## Definition @@ -52,49 +51,9 @@ module _ (x : ℝ l1) (y : ℝ l2) where - lower-real-min-ℝ : lower-ℝ (l1 ⊔ l2) - lower-real-min-ℝ = binary-min-lower-ℝ (lower-real-ℝ x) (lower-real-ℝ y) - - upper-real-min-ℝ : upper-ℝ (l1 ⊔ l2) - upper-real-min-ℝ = binary-min-upper-ℝ (upper-real-ℝ x) (upper-real-ℝ y) - - abstract - is-disjoint-lower-upper-min-ℝ : - is-disjoint-lower-upper-ℝ lower-real-min-ℝ upper-real-min-ℝ - is-disjoint-lower-upper-min-ℝ q ((q Date: Tue, 2 Sep 2025 16:21:38 -0700 Subject: [PATCH 41/97] Opacify real numbers (#1521) Marks more things in `real-numbers` opaque, and does a few other cleanups here and there. In general, it's strongly preferable to see things like `neg-R` in goals rather than...the mess you get if it's not opaque...and the same for most things about the real numbers. --- ...uchy-approximations-metric-spaces.lagda.md | 23 + ...pproximations-pseudometric-spaces.lagda.md | 20 + .../located-metric-spaces.lagda.md | 8 +- src/real-numbers.lagda.md | 4 +- .../absolute-value-real-numbers.lagda.md | 36 +- .../addition-real-numbers.lagda.md | 17 +- .../apartness-real-numbers.lagda.md | 2 +- ...d => binary-maximum-real-numbers.lagda.md} | 270 +++++------ ...d => binary-minimum-real-numbers.lagda.md} | 54 ++- ...ompleteness-dedekind-real-numbers.lagda.md | 195 ++++---- .../difference-real-numbers.lagda.md | 7 + .../distance-real-numbers.lagda.md | 21 +- ...ality-lower-dedekind-real-numbers.lagda.md | 3 + .../inequality-real-numbers.lagda.md | 201 ++++---- ...ality-upper-dedekind-real-numbers.lagda.md | 3 + .../infima-families-real-numbers.lagda.md | 10 +- .../isometry-negation-real-numbers.lagda.md | 66 +-- .../metric-space-of-real-numbers.lagda.md | 431 ++++++++++-------- .../negation-real-numbers.lagda.md | 65 +-- .../nonnegative-real-numbers.lagda.md | 2 +- .../positive-real-numbers.lagda.md | 53 ++- .../rational-real-numbers.lagda.md | 15 +- .../strict-inequality-real-numbers.lagda.md | 163 +++++-- .../suprema-families-real-numbers.lagda.md | 10 +- 24 files changed, 989 insertions(+), 690 deletions(-) rename src/real-numbers/{maximum-real-numbers.lagda.md => binary-maximum-real-numbers.lagda.md} (61%) rename src/real-numbers/{minimum-real-numbers.lagda.md => binary-minimum-real-numbers.lagda.md} (74%) diff --git a/src/metric-spaces/limits-of-cauchy-approximations-metric-spaces.lagda.md b/src/metric-spaces/limits-of-cauchy-approximations-metric-spaces.lagda.md index 57833b4662..e1ecfba92e 100644 --- a/src/metric-spaces/limits-of-cauchy-approximations-metric-spaces.lagda.md +++ b/src/metric-spaces/limits-of-cauchy-approximations-metric-spaces.lagda.md @@ -68,6 +68,29 @@ module _ ## Properties +### Saturation of the limit + +```agda +module _ + {l1 l2 : Level} (A : Metric-Space l1 l2) + (f : cauchy-approximation-Metric-Space A) + (x : type-Metric-Space A) + where + + abstract + saturated-is-limit-cauchy-approximation-Metric-Space : + is-limit-cauchy-approximation-Metric-Space A f x → + (ε : ℚ⁺) → + neighborhood-Metric-Space A ε + ( map-cauchy-approximation-Metric-Space A f ε) + ( x) + saturated-is-limit-cauchy-approximation-Metric-Space = + saturated-is-limit-cauchy-approximation-Pseudometric-Space + ( pseudometric-Metric-Space A) + ( f) + ( x) +``` + ### Limits in a metric space are unique ```agda diff --git a/src/metric-spaces/limits-of-cauchy-approximations-pseudometric-spaces.lagda.md b/src/metric-spaces/limits-of-cauchy-approximations-pseudometric-spaces.lagda.md index 39065cd977..1daedd65ed 100644 --- a/src/metric-spaces/limits-of-cauchy-approximations-pseudometric-spaces.lagda.md +++ b/src/metric-spaces/limits-of-cauchy-approximations-pseudometric-spaces.lagda.md @@ -68,6 +68,26 @@ module _ ## Properties +### Saturation of the limit + +```agda +module _ + {l1 l2 : Level} (A : Pseudometric-Space l1 l2) + (f : cauchy-approximation-Pseudometric-Space A) + (x : type-Pseudometric-Space A) + where + + abstract + saturated-is-limit-cauchy-approximation-Pseudometric-Space : + is-limit-cauchy-approximation-Pseudometric-Space A f x → + (ε : ℚ⁺) → + neighborhood-Pseudometric-Space A ε + ( map-cauchy-approximation-Pseudometric-Space A f ε) + ( x) + saturated-is-limit-cauchy-approximation-Pseudometric-Space is-lim ε = + saturated-neighborhood-Pseudometric-Space A ε _ _ (is-lim ε) +``` + ### Limits of a Cauchy approximations in a pseudometric space are similar ```agda diff --git a/src/metric-spaces/located-metric-spaces.lagda.md b/src/metric-spaces/located-metric-spaces.lagda.md index e2dbee1c06..d084694193 100644 --- a/src/metric-spaces/located-metric-spaces.lagda.md +++ b/src/metric-spaces/located-metric-spaces.lagda.md @@ -169,12 +169,14 @@ module _ ( leq-zero-not-in-cut-upper-real-dist-Metric-Space M x y B zero-ℚ ( refl-leq-ℚ zero-ℚ))) - abstract + opaque + unfolding leq-ℝ' real-ℚ + leq-real-dist-Metric-Space : (ε : ℚ⁺) → - leq-ℝ real-dist-located-Metric-Space (real-ℚ (rational-ℚ⁺ ε)) ↔ + leq-ℝ real-dist-located-Metric-Space (real-ℚ⁺ ε) ↔ neighborhood-Metric-Space M ε x y leq-real-dist-Metric-Space ε = leq-upper-real-dist-Metric-Space M x y B ε ∘iff - leq-iff-ℝ' real-dist-located-Metric-Space (real-ℚ (rational-ℚ⁺ ε)) + leq-iff-ℝ' real-dist-located-Metric-Space (real-ℚ⁺ ε) ``` diff --git a/src/real-numbers.lagda.md b/src/real-numbers.lagda.md index 7fc4654d36..3c8fe2e3ec 100644 --- a/src/real-numbers.lagda.md +++ b/src/real-numbers.lagda.md @@ -11,6 +11,8 @@ open import real-numbers.addition-real-numbers public open import real-numbers.addition-upper-dedekind-real-numbers public open import real-numbers.apartness-real-numbers public open import real-numbers.arithmetically-located-dedekind-cuts public +open import real-numbers.binary-maximum-real-numbers public +open import real-numbers.binary-minimum-real-numbers public open import real-numbers.cauchy-completeness-dedekind-real-numbers public open import real-numbers.dedekind-real-numbers public open import real-numbers.difference-real-numbers public @@ -23,11 +25,9 @@ open import real-numbers.isometry-addition-real-numbers public open import real-numbers.isometry-negation-real-numbers public open import real-numbers.lower-dedekind-real-numbers public open import real-numbers.maximum-lower-dedekind-real-numbers public -open import real-numbers.maximum-real-numbers public open import real-numbers.maximum-upper-dedekind-real-numbers public open import real-numbers.metric-space-of-real-numbers public open import real-numbers.minimum-lower-dedekind-real-numbers public -open import real-numbers.minimum-real-numbers public open import real-numbers.minimum-upper-dedekind-real-numbers public open import real-numbers.negation-lower-upper-dedekind-real-numbers public open import real-numbers.negation-real-numbers public diff --git a/src/real-numbers/absolute-value-real-numbers.lagda.md b/src/real-numbers/absolute-value-real-numbers.lagda.md index b03b295ecb..e0caee7336 100644 --- a/src/real-numbers/absolute-value-real-numbers.lagda.md +++ b/src/real-numbers/absolute-value-real-numbers.lagda.md @@ -25,9 +25,9 @@ open import foundation.universe-levels open import metric-spaces.short-functions-metric-spaces open import real-numbers.addition-real-numbers +open import real-numbers.binary-maximum-real-numbers open import real-numbers.dedekind-real-numbers open import real-numbers.inequality-real-numbers -open import real-numbers.maximum-real-numbers open import real-numbers.metric-space-of-real-numbers open import real-numbers.negation-real-numbers open import real-numbers.nonnegative-real-numbers @@ -42,7 +42,7 @@ open import real-numbers.similarity-real-numbers The {{#concept "absolute value" Disambiguation="of a real number" Agda=abs-ℝ WD="absolute value" WDID=Q120812}} of a [real number](real-numbers.dedekind-real-numbers.md) is the -[maximum](real-numbers.maximum-real-numbers.md) of it and its +[binary maximum](real-numbers.binary-maximum-real-numbers.md) of it and its [negation](real-numbers.negation-real-numbers.md). The absolute value is a [short function](metric-spaces.short-functions-metric-spaces.md) of the [metric space of real numbers](real-numbers.metric-space-of-real-numbers.md). @@ -72,9 +72,7 @@ opaque ```agda opaque - unfolding abs-ℝ - unfolding neg-ℚ - unfolding max-ℝ + unfolding abs-ℝ leq-ℝ max-ℝ neg-ℚ neg-ℝ real-ℚ is-nonnegative-abs-ℝ : {l : Level} → (x : ℝ l) → is-nonnegative-ℝ (abs-ℝ x) is-nonnegative-abs-ℝ x q q<0 = @@ -189,23 +187,23 @@ module _ ( abs-ℝ y) ( leq-abs-leq-leq-neg-ℝ ( x) - ( abs-ℝ y +ℝ real-ℚ (rational-ℚ⁺ d)) + ( abs-ℝ y +ℝ real-ℚ⁺ d) ( transitive-leq-ℝ ( x) - ( y +ℝ real-ℚ (rational-ℚ⁺ d)) - ( abs-ℝ y +ℝ real-ℚ (rational-ℚ⁺ d)) + ( y +ℝ real-ℚ⁺ d) + ( abs-ℝ y +ℝ real-ℚ⁺ d) ( preserves-leq-right-add-ℝ - ( real-ℚ (rational-ℚ⁺ d)) + ( real-ℚ⁺ d) ( y) ( abs-ℝ y) ( leq-abs-ℝ y)) ( left-leq-real-bound-neighborhood-ℝ d x y I)) ( transitive-leq-ℝ ( neg-ℝ x) - ( neg-ℝ y +ℝ real-ℚ (rational-ℚ⁺ d)) - ( abs-ℝ y +ℝ real-ℚ (rational-ℚ⁺ d)) + ( neg-ℝ y +ℝ real-ℚ⁺ d) + ( abs-ℝ y +ℝ real-ℚ⁺ d) ( preserves-leq-right-add-ℝ - ( real-ℚ (rational-ℚ⁺ d)) + ( real-ℚ⁺ d) ( neg-ℝ y) ( abs-ℝ y) ( neg-leq-abs-ℝ y)) @@ -216,23 +214,23 @@ module _ ( right-leq-real-bound-neighborhood-ℝ d x y I)))) ( leq-abs-leq-leq-neg-ℝ ( y) - ( abs-ℝ x +ℝ real-ℚ (rational-ℚ⁺ d)) + ( abs-ℝ x +ℝ real-ℚ⁺ d) ( transitive-leq-ℝ ( y) - ( x +ℝ real-ℚ (rational-ℚ⁺ d)) - ( abs-ℝ x +ℝ real-ℚ (rational-ℚ⁺ d)) + ( x +ℝ real-ℚ⁺ d) + ( abs-ℝ x +ℝ real-ℚ⁺ d) ( preserves-leq-right-add-ℝ - ( real-ℚ (rational-ℚ⁺ d)) + ( real-ℚ⁺ d) ( x) ( abs-ℝ x) ( leq-abs-ℝ x)) ( right-leq-real-bound-neighborhood-ℝ d x y I)) ( transitive-leq-ℝ ( neg-ℝ y) - ( neg-ℝ x +ℝ real-ℚ (rational-ℚ⁺ d)) - ( abs-ℝ x +ℝ real-ℚ (rational-ℚ⁺ d)) + ( neg-ℝ x +ℝ real-ℚ⁺ d) + ( abs-ℝ x +ℝ real-ℚ⁺ d) ( preserves-leq-right-add-ℝ - ( real-ℚ (rational-ℚ⁺ d)) + ( real-ℚ⁺ d) ( neg-ℝ x) ( abs-ℝ x) ( neg-leq-abs-ℝ x)) diff --git a/src/real-numbers/addition-real-numbers.lagda.md b/src/real-numbers/addition-real-numbers.lagda.md index 5abb105971..5ad471a273 100644 --- a/src/real-numbers/addition-real-numbers.lagda.md +++ b/src/real-numbers/addition-real-numbers.lagda.md @@ -15,6 +15,7 @@ open import elementary-number-theory.positive-rational-numbers open import elementary-number-theory.rational-numbers open import elementary-number-theory.strict-inequality-rational-numbers +open import foundation.action-on-identifications-binary-functions open import foundation.action-on-identifications-functions open import foundation.binary-transport open import foundation.cartesian-product-types @@ -140,6 +141,12 @@ module _ infixl 35 _+ℝ_ _+ℝ_ = add-ℝ + +ap-add-ℝ : + {l1 : Level} {x x' : ℝ l1} → (x = x') → + {l2 : Level} {y y' : ℝ l2} → (y = y') → + (x +ℝ y) = (x' +ℝ y') +ap-add-ℝ x=x' y=y' = ap-binary add-ℝ x=x' y=y' ``` ## Properties @@ -189,7 +196,7 @@ module _ ```agda opaque - unfolding add-ℝ + unfolding add-ℝ real-ℚ left-unit-law-add-ℝ : {l : Level} → (x : ℝ l) → zero-ℝ +ℝ x = x left-unit-law-add-ℝ x = @@ -210,7 +217,7 @@ opaque ```agda opaque - unfolding add-ℝ + unfolding add-ℝ neg-ℝ right-inverse-law-add-ℝ : {l : Level} → (x : ℝ l) → sim-ℝ (x +ℝ neg-ℝ x) zero-ℝ @@ -241,6 +248,7 @@ opaque ( -qImports @@ -24,6 +24,7 @@ open import foundation.universe-levels open import metric-spaces.metric-space-of-short-functions-metric-spaces open import metric-spaces.short-functions-metric-spaces +open import order-theory.join-semilattices open import order-theory.large-join-semilattices open import order-theory.least-upper-bounds-large-posets @@ -124,7 +125,7 @@ module _ where opaque - unfolding max-ℝ + unfolding leq-ℝ max-ℝ is-least-binary-upper-bound-max-ℝ : is-least-binary-upper-bound-Large-Poset @@ -181,7 +182,7 @@ module _ where opaque - unfolding sim-ℝ + unfolding leq-ℝ sim-ℝ commutative-max-ℝ : max-ℝ x y = max-ℝ y x commutative-max-ℝ = @@ -208,6 +209,15 @@ is-least-binary-upper-bound-join-has-joins-Large-Poset has-joins-ℝ-Large-Poset = is-least-binary-upper-bound-max-ℝ ``` +### The real numbers at a specific universe level are a join semilattice + +```agda +ℝ-Order-Theoretic-Join-Semilattice : + (l : Level) → Order-Theoretic-Join-Semilattice (lsuc l) l +ℝ-Order-Theoretic-Join-Semilattice l = + ( ℝ-Poset l , λ x y → (max-ℝ x y , is-least-binary-upper-bound-max-ℝ x y)) +``` + ### The binary maximum preserves similarity ```agda @@ -257,51 +267,52 @@ module _ (x : ℝ l1) (y : ℝ l2) (z : ℝ l3) where - preserves-lower-neighborhood-leq-left-max-ℝ : - leq-ℝ y (z +ℝ real-ℚ (rational-ℚ⁺ d)) → - leq-ℝ - ( max-ℝ x y) - ( (max-ℝ x z) +ℝ real-ℚ (rational-ℚ⁺ d)) - preserves-lower-neighborhood-leq-left-max-ℝ z≤y+d = - leq-is-least-binary-upper-bound-Large-Poset - ( ℝ-Large-Poset) - ( x) - ( y) - ( is-least-binary-upper-bound-max-ℝ x y) - ( (max-ℝ x z) +ℝ real-ℚ (rational-ℚ⁺ d)) - ( ( transitive-leq-ℝ - ( x) - ( max-ℝ x z) - ( max-ℝ x z +ℝ real-ℚ (rational-ℚ⁺ d)) - ( leq-le-ℝ + abstract + preserves-lower-neighborhood-leq-left-max-ℝ : + leq-ℝ y (z +ℝ real-ℚ⁺ d) → + leq-ℝ + ( max-ℝ x y) + ( (max-ℝ x z) +ℝ real-ℚ⁺ d) + preserves-lower-neighborhood-leq-left-max-ℝ z≤y+d = + leq-is-least-binary-upper-bound-Large-Poset + ( ℝ-Large-Poset) + ( x) + ( y) + ( is-least-binary-upper-bound-max-ℝ x y) + ( (max-ℝ x z) +ℝ real-ℚ⁺ d) + ( ( transitive-leq-ℝ + ( x) ( max-ℝ x z) - ( max-ℝ x z +ℝ real-ℚ (rational-ℚ⁺ d)) - ( le-left-add-real-ℝ⁺ + ( max-ℝ x z +ℝ real-ℚ⁺ d) + ( leq-le-ℝ ( max-ℝ x z) - ( positive-real-ℚ⁺ d))) - ( leq-left-max-ℝ x z)) , - ( transitive-leq-ℝ - ( y) - ( z +ℝ real-ℚ (rational-ℚ⁺ d)) - ( max-ℝ x z +ℝ real-ℚ (rational-ℚ⁺ d)) - ( preserves-leq-right-add-ℝ - ( real-ℚ (rational-ℚ⁺ d)) - ( z) - ( max-ℝ x z) - ( leq-right-max-ℝ x z)) - ( z≤y+d))) - - preserves-lower-neighborhood-leq-right-max-ℝ : - leq-ℝ y (z +ℝ real-ℚ (rational-ℚ⁺ d)) → - leq-ℝ - ( max-ℝ y x) - ( (max-ℝ z x) +ℝ real-ℚ (rational-ℚ⁺ d)) - preserves-lower-neighborhood-leq-right-max-ℝ z≤y+d = - binary-tr - ( λ u v → leq-ℝ u (v +ℝ real-ℚ (rational-ℚ⁺ d))) - ( commutative-max-ℝ x y) - ( commutative-max-ℝ x z) - ( preserves-lower-neighborhood-leq-left-max-ℝ z≤y+d) + ( max-ℝ x z +ℝ real-ℚ⁺ d) + ( le-left-add-real-ℝ⁺ + ( max-ℝ x z) + ( positive-real-ℚ⁺ d))) + ( leq-left-max-ℝ x z)) , + ( transitive-leq-ℝ + ( y) + ( z +ℝ real-ℚ⁺ d) + ( max-ℝ x z +ℝ real-ℚ⁺ d) + ( preserves-leq-right-add-ℝ + ( real-ℚ⁺ d) + ( z) + ( max-ℝ x z) + ( leq-right-max-ℝ x z)) + ( z≤y+d))) + + preserves-lower-neighborhood-leq-right-max-ℝ : + leq-ℝ y (z +ℝ real-ℚ⁺ d) → + leq-ℝ + ( max-ℝ y x) + ( (max-ℝ z x) +ℝ real-ℚ⁺ d) + preserves-lower-neighborhood-leq-right-max-ℝ z≤y+d = + binary-tr + ( λ u v → leq-ℝ u (v +ℝ real-ℚ⁺ d)) + ( commutative-max-ℝ x y) + ( commutative-max-ℝ x z) + ( preserves-lower-neighborhood-leq-left-max-ℝ z≤y+d) ``` ### The maximum with a real number is a short function `ℝ → ℝ` @@ -311,20 +322,21 @@ module _ {l1 l2 : Level} (x : ℝ l1) where - is-short-function-left-max-ℝ : - is-short-function-Metric-Space - ( metric-space-ℝ l2) - ( metric-space-ℝ (l1 ⊔ l2)) - ( max-ℝ x) - is-short-function-left-max-ℝ d y z Nyz = - neighborhood-real-bound-each-leq-ℝ - ( d) - ( max-ℝ x y) - ( max-ℝ x z) - ( preserves-lower-neighborhood-leq-left-max-ℝ d x y z - ( left-leq-real-bound-neighborhood-ℝ d y z Nyz)) - ( preserves-lower-neighborhood-leq-left-max-ℝ d x z y - ( right-leq-real-bound-neighborhood-ℝ d y z Nyz)) + abstract + is-short-function-left-max-ℝ : + is-short-function-Metric-Space + ( metric-space-ℝ l2) + ( metric-space-ℝ (l1 ⊔ l2)) + ( max-ℝ x) + is-short-function-left-max-ℝ d y z Nyz = + neighborhood-real-bound-each-leq-ℝ + ( d) + ( max-ℝ x y) + ( max-ℝ x z) + ( preserves-lower-neighborhood-leq-left-max-ℝ d x y z + ( left-leq-real-bound-neighborhood-ℝ d y z Nyz)) + ( preserves-lower-neighborhood-leq-left-max-ℝ d x z y + ( right-leq-real-bound-neighborhood-ℝ d y z Nyz)) short-left-max-ℝ : short-function-Metric-Space @@ -341,22 +353,23 @@ module _ {l1 l2 : Level} where - is-short-function-short-left-max-ℝ : - is-short-function-Metric-Space - ( metric-space-ℝ l1) - ( metric-space-of-short-functions-Metric-Space - ( metric-space-ℝ l2) - ( metric-space-ℝ (l1 ⊔ l2))) - ( short-left-max-ℝ) - is-short-function-short-left-max-ℝ d x y Nxy z = - neighborhood-real-bound-each-leq-ℝ - ( d) - ( max-ℝ x z) - ( max-ℝ y z) - ( preserves-lower-neighborhood-leq-right-max-ℝ d z x y - ( left-leq-real-bound-neighborhood-ℝ d x y Nxy)) - ( preserves-lower-neighborhood-leq-right-max-ℝ d z y x - ( right-leq-real-bound-neighborhood-ℝ d x y Nxy)) + abstract + is-short-function-short-left-max-ℝ : + is-short-function-Metric-Space + ( metric-space-ℝ l1) + ( metric-space-of-short-functions-Metric-Space + ( metric-space-ℝ l2) + ( metric-space-ℝ (l1 ⊔ l2))) + ( short-left-max-ℝ) + is-short-function-short-left-max-ℝ d x y Nxy z = + neighborhood-real-bound-each-leq-ℝ + ( d) + ( max-ℝ x z) + ( max-ℝ y z) + ( preserves-lower-neighborhood-leq-right-max-ℝ d z x y + ( left-leq-real-bound-neighborhood-ℝ d x y Nxy)) + ( preserves-lower-neighborhood-leq-right-max-ℝ d z y x + ( right-leq-real-bound-neighborhood-ℝ d x y Nxy)) short-max-ℝ : short-function-Metric-Space @@ -375,55 +388,56 @@ module _ {l1 l2 : Level} (x : ℝ l1) (y : ℝ l2) where - approximate-below-max-ℝ : - (ε : ℚ⁺) → - type-disjunction-Prop - ( le-ℝ-Prop (max-ℝ x y -ℝ real-ℚ⁺ ε) x) - ( le-ℝ-Prop (max-ℝ x y -ℝ real-ℚ⁺ ε) y) - approximate-below-max-ℝ ε⁺@(ε , _) = - let - motive = - ( le-ℝ-Prop (max-ℝ x y -ℝ real-ℚ ε) x) ∨ - ( le-ℝ-Prop (max-ℝ x y -ℝ real-ℚ ε) y) - open do-syntax-trunc-Prop motive - in do - (q , max-εImports @@ -22,12 +22,13 @@ open import foundation.universe-levels open import order-theory.greatest-lower-bounds-large-posets open import order-theory.large-meet-semilattices +open import order-theory.meet-semilattices open import real-numbers.addition-real-numbers +open import real-numbers.binary-maximum-real-numbers open import real-numbers.dedekind-real-numbers open import real-numbers.difference-real-numbers open import real-numbers.inequality-real-numbers -open import real-numbers.maximum-real-numbers open import real-numbers.negation-real-numbers open import real-numbers.rational-real-numbers open import real-numbers.strict-inequality-real-numbers @@ -67,7 +68,7 @@ module _ where opaque - unfolding min-ℝ + unfolding leq-ℝ min-ℝ is-greatest-binary-lower-bound-min-ℝ : is-greatest-binary-lower-bound-Large-Poset @@ -104,6 +105,34 @@ module _ forward-implication (is-greatest-binary-lower-bound-min-ℝ z) (x≤z , y≤z) ``` +### The binary minimum is a binary lower bound + +```agda +module _ + {l1 l2 : Level} + (x : ℝ l1) (y : ℝ l2) + where + + abstract + leq-left-min-ℝ : leq-ℝ (min-ℝ x y) x + leq-left-min-ℝ = + pr1 + ( is-binary-lower-bound-is-greatest-binary-lower-bound-Large-Poset + ( ℝ-Large-Poset) + ( x) + ( y) + ( is-greatest-binary-lower-bound-min-ℝ x y)) + + leq-right-min-ℝ : leq-ℝ (min-ℝ x y) y + leq-right-min-ℝ = + pr2 + ( is-binary-lower-bound-is-greatest-binary-lower-bound-Large-Poset + ( ℝ-Large-Poset) + ( x) + ( y) + ( is-greatest-binary-lower-bound-min-ℝ x y)) +``` + ### The large poset of real numbers has meets ```agda @@ -113,6 +142,15 @@ is-greatest-binary-lower-bound-meet-has-meets-Large-Poset has-meets-ℝ-Large-Poset = is-greatest-binary-lower-bound-min-ℝ ``` +### The real numbers at a specific universe level are a meet semilattice + +```agda +ℝ-Order-Theoretic-Meet-Semilattice : + (l : Level) → Order-Theoretic-Meet-Semilattice (lsuc l) l +ℝ-Order-Theoretic-Meet-Semilattice l = + ( ℝ-Poset l , λ x y → (min-ℝ x y , is-greatest-binary-lower-bound-min-ℝ x y)) +``` + ### For any `ε : ℚ⁺`, `(x < min-ℝ x y + ε) ∨ (y < min-ℝ x y + ε)` ```agda @@ -126,8 +164,8 @@ module _ approximate-above-min-ℝ : (ε : ℚ⁺) → type-disjunction-Prop - ( le-ℝ-Prop x (min-ℝ x y +ℝ real-ℚ⁺ ε)) - ( le-ℝ-Prop y (min-ℝ x y +ℝ real-ℚ⁺ ε)) + ( le-prop-ℝ x (min-ℝ x y +ℝ real-ℚ⁺ ε)) + ( le-prop-ℝ y (min-ℝ x y +ℝ real-ℚ⁺ ε)) approximate-above-min-ℝ ε = let case : @@ -141,8 +179,8 @@ module _ ( neg-le-ℝ _ (neg-ℝ w) max-ε<-w) in elim-disjunction - ( (le-ℝ-Prop x (min-ℝ x y +ℝ real-ℚ⁺ ε)) ∨ - (le-ℝ-Prop y (min-ℝ x y +ℝ real-ℚ⁺ ε))) + ( (le-prop-ℝ x (min-ℝ x y +ℝ real-ℚ⁺ ε)) ∨ + (le-prop-ℝ y (min-ℝ x y +ℝ real-ℚ⁺ ε))) ( λ max-ε<-x → inl-disjunction (case x max-ε<-x)) ( λ max-ε<-y → inr-disjunction (case y max-ε<-y)) ( approximate-below-max-ℝ (neg-ℝ x) (neg-ℝ y) ε) diff --git a/src/real-numbers/cauchy-completeness-dedekind-real-numbers.lagda.md b/src/real-numbers/cauchy-completeness-dedekind-real-numbers.lagda.md index ea2f866ab9..853d22ee60 100644 --- a/src/real-numbers/cauchy-completeness-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/cauchy-completeness-dedekind-real-numbers.lagda.md @@ -301,7 +301,9 @@ module _ is-inhabited-upper-cut-lim-cauchy-approximation-ℝ , is-rounded-upper-cut-lim-cauchy-approximation-ℝ - abstract + opaque + unfolding neighborhood-ℝ + is-disjoint-cut-lim-cauchy-approximation-ℝ : (q : ℚ) → ¬ ( is-in-subtype lower-cut-lim-cauchy-approximation-ℝ q × @@ -406,13 +408,14 @@ module _ ( 2ε⁺<ε'⁺) ( 2ε⁺<ε'⁺))))))) - lim-cauchy-approximation-ℝ : ℝ l - lim-cauchy-approximation-ℝ = - real-lower-upper-ℝ - ( lower-real-lim-cauchy-approximation-ℝ) - ( upper-real-lim-cauchy-approximation-ℝ) - ( is-disjoint-cut-lim-cauchy-approximation-ℝ) - ( is-located-lower-upper-cut-lim-cauchy-approximation-ℝ) + opaque + lim-cauchy-approximation-ℝ : ℝ l + lim-cauchy-approximation-ℝ = + real-lower-upper-ℝ + ( lower-real-lim-cauchy-approximation-ℝ) + ( upper-real-lim-cauchy-approximation-ℝ) + ( is-disjoint-cut-lim-cauchy-approximation-ℝ) + ( is-located-lower-upper-cut-lim-cauchy-approximation-ℝ) ``` ### The limit satisfies the definition of a limit of a Cauchy approximation @@ -422,93 +425,109 @@ module _ {l : Level} (x : cauchy-approximation-ℝ l) where - is-limit-lim-cauchy-approximation-ℝ : - is-limit-cauchy-approximation-Metric-Space - ( metric-space-ℝ l) - ( x) - ( lim-cauchy-approximation-ℝ x) - is-limit-lim-cauchy-approximation-ℝ ε⁺@(ε , _) θ⁺@(θ , _) = - let - open - do-syntax-trunc-Prop - ( neighborhood-prop-ℝ - ( l) - ( ε⁺ +ℚ⁺ θ⁺) - ( map-cauchy-approximation-ℝ x ε⁺) - ( lim-cauchy-approximation-ℝ x)) - lim = lim-cauchy-approximation-ℝ x - xε = map-cauchy-approximation-ℝ x ε⁺ - θ'⁺@(θ' , _) = left-summand-split-ℚ⁺ θ⁺ - θ''⁺@(θ'' , _) = right-summand-split-ℚ⁺ θ⁺ - ε+θ'+θ''=ε+θ = - associative-add-ℚ _ _ _ ∙ - ap (ε +ℚ_) (ap rational-ℚ⁺ (eq-add-split-ℚ⁺ θ⁺)) - ε+θ = real-ℚ (ε +ℚ θ) - ε+θ' = real-ℚ (ε +ℚ θ') - in do - ( r , xε+ε+θ' Date: Tue, 2 Sep 2025 21:55:46 -0700 Subject: [PATCH 42/97] Metric spaces induced by metric functions (#1520) I do find myself wondering if it'd be better to define the metric space of real numbers in terms of the distance function, rather than in terms of the neighborhood shenanigans, though they are of course equivalent. (I haven't bothered proving that yet.) This of course gives locatedness and bounded distance for free. (I also haven't yet proven that the distance function available to all located metric spaces with all elements at bounded distance is the same as the original distance function.) --- .../nonnegative-rational-numbers.lagda.md | 21 + .../functoriality-disjunction.lagda.md | 12 +- src/metric-spaces.lagda.md | 1 + ...at-bounded-distance-metric-spaces.lagda.md | 13 + .../located-metric-spaces.lagda.md | 39 +- src/metric-spaces/metric-spaces.lagda.md | 5 + src/metric-spaces/metrics.lagda.md | 351 +++++++++++++++++ src/real-numbers.lagda.md | 1 + .../apartness-real-numbers.lagda.md | 8 +- .../binary-maximum-real-numbers.lagda.md | 45 ++- ...ompleteness-dedekind-real-numbers.lagda.md | 4 - ...ximum-lower-dedekind-real-numbers.lagda.md | 18 +- ...nimum-upper-dedekind-real-numbers.lagda.md | 18 +- .../nonnegative-real-numbers.lagda.md | 359 ++++++++++++++++++ ...sing-universe-levels-real-numbers.lagda.md | 8 +- .../rational-real-numbers.lagda.md | 4 + ...ional-upper-dedekind-real-numbers.lagda.md | 3 + ...-from-lower-dedekind-real-numbers.lagda.md | 12 +- ...aturation-inequality-real-numbers.lagda.md | 60 +++ .../similarity-real-numbers.lagda.md | 12 +- .../strict-inequality-real-numbers.lagda.md | 76 +++- .../disjunction.lagda.md | 32 +- 22 files changed, 987 insertions(+), 115 deletions(-) create mode 100644 src/metric-spaces/metrics.lagda.md create mode 100644 src/real-numbers/saturation-inequality-real-numbers.lagda.md diff --git a/src/elementary-number-theory/nonnegative-rational-numbers.lagda.md b/src/elementary-number-theory/nonnegative-rational-numbers.lagda.md index 33f9f2b933..043f1ae128 100644 --- a/src/elementary-number-theory/nonnegative-rational-numbers.lagda.md +++ b/src/elementary-number-theory/nonnegative-rational-numbers.lagda.md @@ -122,6 +122,9 @@ abstract zero-ℚ⁰⁺ : ℚ⁰⁺ zero-ℚ⁰⁺ = zero-ℚ , _ + +one-ℚ⁰⁺ : ℚ⁰⁺ +one-ℚ⁰⁺ = one-ℚ , _ ``` ## Properties @@ -387,3 +390,21 @@ abstract nonnegative-diff-leq-ℚ : (x y : ℚ) → leq-ℚ x y → ℚ⁰⁺ nonnegative-diff-leq-ℚ x y x≤y = (y -ℚ x , is-nonnegative-diff-leq-ℚ x y x≤y) ``` + +### Strict inequality on nonnegative rational numbers + +```agda +le-ℚ⁰⁺-Prop : (p q : ℚ⁰⁺) → Prop lzero +le-ℚ⁰⁺-Prop p q = le-ℚ-Prop (rational-ℚ⁰⁺ p) (rational-ℚ⁰⁺ q) + +le-ℚ⁰⁺ : (p q : ℚ⁰⁺) → UU lzero +le-ℚ⁰⁺ p q = type-Prop (le-ℚ⁰⁺-Prop p q) +``` + +### Zero is less than positive rational numbers as nonnegative rational numbers + +```agda +abstract + le-zero-nonnegative-ℚ⁰⁺ : (q : ℚ⁺) → le-ℚ⁰⁺ zero-ℚ⁰⁺ (nonnegative-ℚ⁺ q) + le-zero-nonnegative-ℚ⁰⁺ (q , pos-q) = le-zero-is-positive-ℚ q pos-q +``` diff --git a/src/foundation/functoriality-disjunction.lagda.md b/src/foundation/functoriality-disjunction.lagda.md index b37fca2817..88cfe4f8f7 100644 --- a/src/foundation/functoriality-disjunction.lagda.md +++ b/src/foundation/functoriality-disjunction.lagda.md @@ -9,7 +9,8 @@ module foundation.functoriality-disjunction where ```agda open import foundation.disjunction open import foundation.function-types -open import foundation.propositions +open import foundation.functoriality-coproduct-types +open import foundation.functoriality-propositional-truncation open import foundation.universe-levels ``` @@ -26,11 +27,10 @@ Any two implications `f : A ⇒ B` and `g : C ⇒ D` induce an implication ```agda module _ - {l1 l2 l3 l4 : Level} (A : Prop l1) (B : Prop l2) (C : Prop l3) (D : Prop l4) - (f : type-Prop (A ⇒ B)) (g : type-Prop (C ⇒ D)) + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} + (f : A → B) (g : C → D) where - map-disjunction : type-Prop ((A ∨ C) ⇒ (B ∨ D)) - map-disjunction = - elim-disjunction (B ∨ D) (inl-disjunction ∘ f) (inr-disjunction ∘ g) + map-disjunction : disjunction-type A C → disjunction-type B D + map-disjunction = map-trunc-Prop (map-coproduct f g) ``` diff --git a/src/metric-spaces.lagda.md b/src/metric-spaces.lagda.md index 3134d961b1..cf0307b7d6 100644 --- a/src/metric-spaces.lagda.md +++ b/src/metric-spaces.lagda.md @@ -99,6 +99,7 @@ open import metric-spaces.metric-space-of-lipschitz-functions-metric-spaces publ open import metric-spaces.metric-space-of-rational-numbers public open import metric-spaces.metric-space-of-short-functions-metric-spaces public open import metric-spaces.metric-spaces public +open import metric-spaces.metrics public open import metric-spaces.monotonic-rational-neighborhood-relations public open import metric-spaces.nets-located-metric-spaces public open import metric-spaces.nets-metric-spaces public diff --git a/src/metric-spaces/elements-at-bounded-distance-metric-spaces.lagda.md b/src/metric-spaces/elements-at-bounded-distance-metric-spaces.lagda.md index 5658add67d..5ea2732e9a 100644 --- a/src/metric-spaces/elements-at-bounded-distance-metric-spaces.lagda.md +++ b/src/metric-spaces/elements-at-bounded-distance-metric-spaces.lagda.md @@ -260,4 +260,17 @@ module _ ( q≤0) ( le-zero-is-positive-ℚ ε is-pos-ε)) ( εImports + +```agda +open import elementary-number-theory.nonnegative-rational-numbers +open import elementary-number-theory.positive-rational-numbers + +open import foundation.conjunction +open import foundation.dependent-pair-types +open import foundation.disjunction +open import foundation.functoriality-disjunction +open import foundation.identity-types +open import foundation.negation +open import foundation.propositions +open import foundation.sets +open import foundation.subtypes +open import foundation.transport-along-identifications +open import foundation.universe-levels + +open import logic.functoriality-existential-quantification + +open import metric-spaces.elements-at-bounded-distance-metric-spaces +open import metric-spaces.extensionality-pseudometric-spaces +open import metric-spaces.located-metric-spaces +open import metric-spaces.metric-spaces +open import metric-spaces.pseudometric-spaces +open import metric-spaces.rational-neighborhood-relations +open import metric-spaces.reflexive-rational-neighborhood-relations +open import metric-spaces.saturated-rational-neighborhood-relations +open import metric-spaces.symmetric-rational-neighborhood-relations +open import metric-spaces.triangular-rational-neighborhood-relations + +open import real-numbers.dedekind-real-numbers +open import real-numbers.nonnegative-real-numbers +open import real-numbers.rational-real-numbers +open import real-numbers.strict-inequality-real-numbers +``` + +
+ +## Idea + +A {{#concept "metric" WDID=Q865746 WD="metric function" Agda=Metric}} on a +[set](foundation.sets.md) `X` is a function `d` from two elements of `X` to the +[nonnegative real numbers](real-numbers.nonnegative-real-numbers.md) with the +following properties: + +- **Reflexivity.** `d x x = 0` for all `x : X`. +- **Symmetry.** `d x y = d y x` for all `x y : X`. +- **Triangularity.** `d x z ≤ d x y + d y z` for all `x y z : X`. +- **Extensionality.** `d x y = 0` implies `x = y` for all `x y : X`. + +A metric induces a unique [located](metric-spaces.located-metric-spaces.md) +[metric space](metric-spaces.metric-spaces.md) in which every pair of elements +is at +[bounded distance](metric-spaces.elements-at-bounded-distance-metric-spaces.md). + +## Definition + +```agda +distance-function : {l1 : Level} → (l2 : Level) → Set l1 → UU (l1 ⊔ lsuc l2) +distance-function l2 X = type-Set X → type-Set X → nonnegative-ℝ l2 + +module _ + {l1 l2 : Level} (X : Set l1) (d : distance-function l2 X) + where + + is-reflexive-prop-distance-function : Prop (l1 ⊔ l2) + is-reflexive-prop-distance-function = + Π-Prop (type-Set X) (λ x → sim-zero-prop-ℝ⁰⁺ (d x x)) + + is-symmetric-prop-distance-function : Prop (l1 ⊔ lsuc l2) + is-symmetric-prop-distance-function = + Π-Prop + ( type-Set X) + ( λ x → + Π-Prop + ( type-Set X) + ( λ y → Id-Prop (ℝ⁰⁺-Set l2) (d x y) (d y x))) + + is-triangular-prop-distance-function : Prop (l1 ⊔ l2) + is-triangular-prop-distance-function = + Π-Prop + ( type-Set X) + ( λ x → + Π-Prop + ( type-Set X) + ( λ y → + Π-Prop + ( type-Set X) + ( λ z → leq-prop-ℝ⁰⁺ (d x z) (d x y +ℝ⁰⁺ d y z)))) + + is-extensional-prop-distance-function : Prop (l1 ⊔ l2) + is-extensional-prop-distance-function = + Π-Prop + ( type-Set X) + ( λ x → + Π-Prop + ( type-Set X) + ( λ y → + hom-Prop (sim-zero-prop-ℝ⁰⁺ (d x y)) (Id-Prop X x y))) + + is-metric-prop-distance-function : Prop (l1 ⊔ lsuc l2) + is-metric-prop-distance-function = + is-reflexive-prop-distance-function ∧ + is-symmetric-prop-distance-function ∧ + is-triangular-prop-distance-function ∧ + is-extensional-prop-distance-function + +Metric : {l1 : Level} (l2 : Level) (X : Set l1) → UU (l1 ⊔ lsuc l2) +Metric l2 X = type-subtype (is-metric-prop-distance-function {l2 = l2} X) + +module _ + {l1 l2 : Level} (X : Set l1) (μ : Metric l2 X) + where + + dist-Metric : distance-function l2 X + dist-Metric = pr1 μ + + is-reflexive-dist-Metric : (x : type-Set X) → sim-zero-ℝ⁰⁺ (dist-Metric x x) + is-reflexive-dist-Metric = pr1 (pr2 μ) + + is-symmetric-dist-Metric : + (x y : type-Set X) → dist-Metric x y = dist-Metric y x + is-symmetric-dist-Metric = pr1 (pr2 (pr2 μ)) + + is-triangular-dist-Metric : + (x y z : type-Set X) → + leq-ℝ⁰⁺ (dist-Metric x z) (dist-Metric x y +ℝ⁰⁺ dist-Metric y z) + is-triangular-dist-Metric = pr1 (pr2 (pr2 (pr2 μ))) + + is-extensional-dist-Metric : + (x y : type-Set X) → sim-zero-ℝ⁰⁺ (dist-Metric x y) → x = y + is-extensional-dist-Metric = pr2 (pr2 (pr2 (pr2 μ))) +``` + +## Properties + +### The rational neighborhood relation induced by a metric + +```agda +module _ + {l1 l2 : Level} (X : Set l1) (μ : Metric l2 X) + where + + neighborhood-prop-Metric : + Rational-Neighborhood-Relation l2 (type-Set X) + neighborhood-prop-Metric ε x y = + leq-prop-ℝ⁰⁺ (dist-Metric X μ x y) (nonnegative-real-ℚ⁺ ε) +``` + +### The rational neighborhood relation induced by a metric is reflexive + +```agda +module _ + {l1 l2 : Level} (X : Set l1) (μ : Metric l2 X) + where + + abstract + is-reflexive-neighborhood-prop-Metric : + is-reflexive-Rational-Neighborhood-Relation (neighborhood-prop-Metric X μ) + is-reflexive-neighborhood-prop-Metric ε x = + preserves-leq-left-sim-ℝ⁰⁺ + ( nonnegative-real-ℚ⁺ ε) + ( zero-ℝ⁰⁺) + ( dist-Metric X μ x x) + ( is-reflexive-dist-Metric X μ x) + ( leq-zero-ℝ⁰⁺ (nonnegative-real-ℚ⁺ ε)) +``` + +### The rational neighborhood relation induced by a metric is symmetric + +```agda +module _ + {l1 l2 : Level} (X : Set l1) (μ : Metric l2 X) + where + + abstract + is-symmetric-neighborhood-prop-Metric : + is-symmetric-Rational-Neighborhood-Relation (neighborhood-prop-Metric X μ) + is-symmetric-neighborhood-prop-Metric ε x y = + tr + ( λ d → leq-ℝ⁰⁺ d (nonnegative-real-ℚ⁺ ε)) + ( is-symmetric-dist-Metric X μ x y) +``` + +### The rational neighborhood relation induced by a metric is triangular + +```agda +module _ + {l1 l2 : Level} (X : Set l1) (μ : Metric l2 X) + where + + abstract + is-triangular-neighborhood-prop-Metric : + is-triangular-Rational-Neighborhood-Relation + ( neighborhood-prop-Metric X μ) + is-triangular-neighborhood-prop-Metric x y z εxy εyz dyz≤εyz dxy≤εxy = + transitive-leq-ℝ⁰⁺ + ( dist-Metric X μ x z) + ( dist-Metric X μ x y +ℝ⁰⁺ dist-Metric X μ y z) + ( nonnegative-real-ℚ⁺ (εxy +ℚ⁺ εyz)) + ( tr + ( leq-ℝ⁰⁺ (dist-Metric X μ x y +ℝ⁰⁺ dist-Metric X μ y z)) + ( add-nonnegative-real-ℚ⁺ εxy εyz) + ( preserves-leq-add-ℝ⁰⁺ + ( dist-Metric X μ x y) + ( nonnegative-real-ℚ⁺ εxy) + ( dist-Metric X μ y z) + ( nonnegative-real-ℚ⁺ εyz) + ( dxy≤εxy) + ( dyz≤εyz))) + ( is-triangular-dist-Metric X μ x y z) +``` + +### The rational neighborhood relation induced by a metric is saturated + +```agda +module _ + {l1 l2 : Level} (X : Set l1) (μ : Metric l2 X) + where + + abstract + is-saturated-neighborhood-prop-Metric : + is-saturated-Rational-Neighborhood-Relation + ( neighborhood-prop-Metric X μ) + is-saturated-neighborhood-prop-Metric ε x y H = + saturated-leq-ℝ⁰⁺ + ( dist-Metric X μ x y) + ( nonnegative-real-ℚ⁺ ε) + ( λ δ → + inv-tr + ( leq-ℝ⁰⁺ (dist-Metric X μ x y)) + ( add-nonnegative-real-ℚ⁺ ε δ) + ( H δ)) +``` + +### The pseudometric space induced by a metric + +```agda +module _ + {l1 l2 : Level} (X : Set l1) (μ : Metric l2 X) + where + + pseudometric-structure-Metric : Pseudometric-Structure l2 (type-Set X) + pseudometric-structure-Metric = + ( neighborhood-prop-Metric X μ , + is-reflexive-neighborhood-prop-Metric X μ , + is-symmetric-neighborhood-prop-Metric X μ , + is-triangular-neighborhood-prop-Metric X μ , + is-saturated-neighborhood-prop-Metric X μ) + + pseudometric-space-Metric : Pseudometric-Space l1 l2 + pseudometric-space-Metric = + ( type-Set X , pseudometric-structure-Metric) +``` + +### The pseudometric space induced by a metric is tight + +```agda +module _ + {l1 l2 : Level} (X : Set l1) (μ : Metric l2 X) + where + + abstract + is-tight-pseudometric-space-Metric : + is-tight-Pseudometric-Space (pseudometric-space-Metric X μ) + is-tight-pseudometric-space-Metric x y H = + is-extensional-dist-Metric X μ x y + ( sim-zero-le-positive-rational-ℝ⁰⁺ (dist-Metric X μ x y) H) +``` + +### The pseudometric space induced by a metric is extensional + +```agda +module _ + {l1 l2 : Level} (X : Set l1) (μ : Metric l2 X) + where + + abstract + is-extensional-pseudometric-space-Metric : + is-extensional-Pseudometric-Space (pseudometric-space-Metric X μ) + is-extensional-pseudometric-space-Metric = + is-extensional-is-tight-Pseudometric-Space + ( pseudometric-space-Metric X μ) + ( is-tight-pseudometric-space-Metric X μ) +``` + +### The metric space induced by a metric + +```agda +module _ + {l1 l2 : Level} (X : Set l1) (μ : Metric l2 X) + where + + metric-space-Metric : Metric-Space l1 l2 + metric-space-Metric = + ( pseudometric-space-Metric X μ , + is-extensional-pseudometric-space-Metric X μ) +``` + +### The metric space induced by a metric is located + +```agda +module _ + {l1 l2 : Level} (X : Set l1) (μ : Metric l2 X) + where + + abstract + is-located-metric-space-Metric : + is-located-Metric-Space (metric-space-Metric X μ) + is-located-metric-space-Metric x y δ ε δ<ε = + map-disjunction + ( not-leq-le-ℝ + ( real-ℚ⁺ δ) + ( real-ℝ⁰⁺ (dist-Metric X μ x y))) + ( leq-le-ℝ + ( real-ℝ⁰⁺ (dist-Metric X μ x y)) + ( real-ℚ⁺ ε)) + ( is-located-le-ℝ + ( real-ℝ⁰⁺ (dist-Metric X μ x y)) + ( rational-ℚ⁺ δ) + ( rational-ℚ⁺ ε) + ( δ<ε)) + + located-metric-space-Metric : Located-Metric-Space l1 l2 + located-metric-space-Metric = + ( metric-space-Metric X μ , is-located-metric-space-Metric) +``` + +### Every element in a located metric space is at bounded distance + +```agda +module _ + {l1 l2 : Level} (X : Set l1) (μ : Metric l2 X) + where + + abstract + bounded-dist-metric-space-Metric : + (x y : type-Set X) → + bounded-dist-Metric-Space (metric-space-Metric X μ) x y + bounded-dist-metric-space-Metric x y = + map-tot-exists + ( λ ε → leq-le-ℝ (real-ℝ⁰⁺ (dist-Metric X μ x y)) (real-ℚ⁺ ε)) + ( le-some-positive-rational-ℝ⁰⁺ (dist-Metric X μ x y)) +``` diff --git a/src/real-numbers.lagda.md b/src/real-numbers.lagda.md index 3c8fe2e3ec..65413ec2dc 100644 --- a/src/real-numbers.lagda.md +++ b/src/real-numbers.lagda.md @@ -39,6 +39,7 @@ open import real-numbers.rational-real-numbers public open import real-numbers.rational-upper-dedekind-real-numbers public open import real-numbers.real-numbers-from-lower-dedekind-real-numbers public open import real-numbers.real-numbers-from-upper-dedekind-real-numbers public +open import real-numbers.saturation-inequality-real-numbers public open import real-numbers.similarity-real-numbers public open import real-numbers.strict-inequality-real-numbers public open import real-numbers.subsets-real-numbers public diff --git a/src/real-numbers/apartness-real-numbers.lagda.md b/src/real-numbers/apartness-real-numbers.lagda.md index aa63139678..5a0bc050c6 100644 --- a/src/real-numbers/apartness-real-numbers.lagda.md +++ b/src/real-numbers/apartness-real-numbers.lagda.md @@ -11,6 +11,7 @@ open import foundation.apartness-relations open import foundation.disjunction open import foundation.empty-types open import foundation.function-types +open import foundation.functoriality-disjunction open import foundation.identity-types open import foundation.large-apartness-relations open import foundation.large-binary-relations @@ -73,10 +74,9 @@ cotransitive-apart-ℝ x y z = elim-disjunction ( apart-ℝ-Prop x z ∨ apart-ℝ-Prop z y) ( λ xImports ```agda +open import elementary-number-theory.nonnegative-rational-numbers +open import elementary-number-theory.positive-rational-numbers +open import elementary-number-theory.rational-numbers + +open import foundation.dependent-pair-types +open import foundation.existential-quantification +open import foundation.identity-types +open import foundation.propositional-truncations open import foundation.propositions +open import foundation.sets open import foundation.subtypes +open import foundation.transport-along-identifications open import foundation.universe-levels +open import logic.functoriality-existential-quantification + +open import real-numbers.addition-real-numbers open import real-numbers.dedekind-real-numbers open import real-numbers.inequality-real-numbers open import real-numbers.rational-real-numbers +open import real-numbers.saturation-inequality-real-numbers +open import real-numbers.similarity-real-numbers +open import real-numbers.strict-inequality-real-numbers ```
@@ -37,4 +53,347 @@ is-nonnegative-prop-ℝ = leq-prop-ℝ zero-ℝ nonnegative-ℝ : (l : Level) → UU (lsuc l) nonnegative-ℝ l = type-subtype (is-nonnegative-prop-ℝ {l}) + +ℝ⁰⁺ : (l : Level) → UU (lsuc l) +ℝ⁰⁺ = nonnegative-ℝ + +real-ℝ⁰⁺ : {l : Level} → ℝ⁰⁺ l → ℝ l +real-ℝ⁰⁺ = pr1 + +is-nonnegative-real-ℝ⁰⁺ : + {l : Level} (x : ℝ⁰⁺ l) → is-nonnegative-ℝ (real-ℝ⁰⁺ x) +is-nonnegative-real-ℝ⁰⁺ = pr2 +``` + +## Properties + +### The nonnegative real numbers form a set + +```agda +ℝ⁰⁺-Set : (l : Level) → Set (lsuc l) +ℝ⁰⁺-Set l = set-subset (ℝ-Set l) is-nonnegative-prop-ℝ +``` + +### Equality in the nonnegative real numbers + +```agda +eq-ℝ⁰⁺ : {l : Level} (x y : ℝ⁰⁺ l) → real-ℝ⁰⁺ x = real-ℝ⁰⁺ y → x = y +eq-ℝ⁰⁺ _ _ = eq-type-subtype is-nonnegative-prop-ℝ +``` + +### The canonical embedding from nonnegative rational numbers to nonnegative real numbers + +```agda +abstract + is-nonnegative-real-ℚ⁰⁺ : (q : ℚ⁰⁺) → is-nonnegative-ℝ (real-ℚ⁰⁺ q) + is-nonnegative-real-ℚ⁰⁺ (q , nonneg-q) = + preserves-leq-real-ℚ zero-ℚ q (leq-zero-is-nonnegative-ℚ q nonneg-q) + +nonnegative-real-ℚ⁰⁺ : ℚ⁰⁺ → ℝ⁰⁺ lzero +nonnegative-real-ℚ⁰⁺ q = (real-ℚ⁰⁺ q , is-nonnegative-real-ℚ⁰⁺ q) + +nonnegative-real-ℚ⁺ : ℚ⁺ → ℝ⁰⁺ lzero +nonnegative-real-ℚ⁺ q = nonnegative-real-ℚ⁰⁺ (nonnegative-ℚ⁺ q) +``` + +### Important nonnegative real numbers + +```agda +zero-ℝ⁰⁺ : ℝ⁰⁺ lzero +zero-ℝ⁰⁺ = nonnegative-real-ℚ⁰⁺ zero-ℚ⁰⁺ + +one-ℝ⁰⁺ : ℝ⁰⁺ lzero +one-ℝ⁰⁺ = nonnegative-real-ℚ⁰⁺ one-ℚ⁰⁺ +``` + +### Similarity of nonnegative real numbers + +```agda +module _ + {l1 l2 : Level} (x : ℝ⁰⁺ l1) (y : ℝ⁰⁺ l2) + where + + sim-prop-ℝ⁰⁺ : Prop (l1 ⊔ l2) + sim-prop-ℝ⁰⁺ = sim-prop-ℝ (real-ℝ⁰⁺ x) (real-ℝ⁰⁺ y) + + sim-ℝ⁰⁺ : UU (l1 ⊔ l2) + sim-ℝ⁰⁺ = sim-ℝ (real-ℝ⁰⁺ x) (real-ℝ⁰⁺ y) + +infix 6 _~ℝ⁰⁺_ +_~ℝ⁰⁺_ : {l1 l2 : Level} → ℝ⁰⁺ l1 → ℝ⁰⁺ l2 → UU (l1 ⊔ l2) +_~ℝ⁰⁺_ = sim-ℝ⁰⁺ + +sim-zero-prop-ℝ⁰⁺ : {l : Level} → ℝ⁰⁺ l → Prop l +sim-zero-prop-ℝ⁰⁺ = sim-prop-ℝ⁰⁺ zero-ℝ⁰⁺ + +sim-zero-ℝ⁰⁺ : {l : Level} → ℝ⁰⁺ l → UU l +sim-zero-ℝ⁰⁺ = sim-ℝ⁰⁺ zero-ℝ⁰⁺ + +eq-sim-ℝ⁰⁺ : {l : Level} (x y : ℝ⁰⁺ l) → sim-ℝ⁰⁺ x y → x = y +eq-sim-ℝ⁰⁺ x y x~y = eq-ℝ⁰⁺ x y (eq-sim-ℝ {x = real-ℝ⁰⁺ x} {y = real-ℝ⁰⁺ y} x~y) +``` + +#### Similarity is symmetric + +```agda +abstract + symmetric-sim-ℝ⁰⁺ : + {l1 l2 : Level} → (x : ℝ⁰⁺ l1) (y : ℝ⁰⁺ l2) → x ~ℝ⁰⁺ y → y ~ℝ⁰⁺ x + symmetric-sim-ℝ⁰⁺ _ _ = symmetric-sim-ℝ +``` + +### Inequality on nonnegative real numbers + +```agda +module _ + {l1 l2 : Level} (x : ℝ⁰⁺ l1) (y : ℝ⁰⁺ l2) + where + + leq-prop-ℝ⁰⁺ : Prop (l1 ⊔ l2) + leq-prop-ℝ⁰⁺ = leq-prop-ℝ (real-ℝ⁰⁺ x) (real-ℝ⁰⁺ y) + + leq-ℝ⁰⁺ : UU (l1 ⊔ l2) + leq-ℝ⁰⁺ = type-Prop leq-prop-ℝ⁰⁺ +``` + +### Zero is less than or equal to every nonnegative real number + +```agda +leq-zero-ℝ⁰⁺ : {l : Level} (x : ℝ⁰⁺ l) → leq-ℝ⁰⁺ zero-ℝ⁰⁺ x +leq-zero-ℝ⁰⁺ = is-nonnegative-real-ℝ⁰⁺ +``` + +### Similarity preserves inequality + +```agda +module _ + {l1 l2 l3 : Level} (z : ℝ⁰⁺ l1) (x : ℝ⁰⁺ l2) (y : ℝ⁰⁺ l3) (x~y : sim-ℝ⁰⁺ x y) + where + + abstract + preserves-leq-left-sim-ℝ⁰⁺ : leq-ℝ⁰⁺ x z → leq-ℝ⁰⁺ y z + preserves-leq-left-sim-ℝ⁰⁺ = + preserves-leq-left-sim-ℝ (real-ℝ⁰⁺ z) _ _ x~y +``` + +### Inequality is transitive + +```agda +module _ + {l1 l2 l3 : Level} (x : ℝ⁰⁺ l1) (y : ℝ⁰⁺ l2) (z : ℝ⁰⁺ l3) + where + + transitive-leq-ℝ⁰⁺ : leq-ℝ⁰⁺ y z → leq-ℝ⁰⁺ x y → leq-ℝ⁰⁺ x z + transitive-leq-ℝ⁰⁺ = transitive-leq-ℝ (real-ℝ⁰⁺ x) (real-ℝ⁰⁺ y) (real-ℝ⁰⁺ z) +``` + +### Strict inequality on nonnegative real numbers + +```agda +module _ + {l1 l2 : Level} (x : ℝ⁰⁺ l1) (y : ℝ⁰⁺ l2) + where + + le-prop-ℝ⁰⁺ : Prop (l1 ⊔ l2) + le-prop-ℝ⁰⁺ = le-prop-ℝ (real-ℝ⁰⁺ x) (real-ℝ⁰⁺ y) + + le-ℝ⁰⁺ : UU (l1 ⊔ l2) + le-ℝ⁰⁺ = type-Prop le-prop-ℝ⁰⁺ +``` + +### The canonical embedding of nonnegative rational numbers to nonnegative reals preserves strict inequality + +```agda +abstract + preserves-le-nonnegative-real-ℚ⁰⁺ : + (p q : ℚ⁰⁺) → + le-ℚ⁰⁺ p q → le-ℝ⁰⁺ (nonnegative-real-ℚ⁰⁺ p) (nonnegative-real-ℚ⁰⁺ q) + preserves-le-nonnegative-real-ℚ⁰⁺ p q = preserves-le-real-ℚ _ _ +``` + +### Similarity preserves strict inequality + +```agda +module _ + {l1 l2 l3 : Level} (z : ℝ⁰⁺ l1) (x : ℝ⁰⁺ l2) (y : ℝ⁰⁺ l3) (x~y : sim-ℝ⁰⁺ x y) + where + + abstract + preserves-le-left-sim-ℝ⁰⁺ : le-ℝ⁰⁺ x z → le-ℝ⁰⁺ y z + preserves-le-left-sim-ℝ⁰⁺ = + preserves-le-left-sim-ℝ (real-ℝ⁰⁺ z) _ _ x~y +``` + +### Concatenation of inequality and strict inequality + +```agda +module _ + {l1 l2 l3 : Level} (x : ℝ⁰⁺ l1) (y : ℝ⁰⁺ l2) (z : ℝ⁰⁺ l3) + where + + abstract + concatenate-leq-le-ℝ⁰⁺ : leq-ℝ⁰⁺ x y → le-ℝ⁰⁺ y z → le-ℝ⁰⁺ x z + concatenate-leq-le-ℝ⁰⁺ = + concatenate-leq-le-ℝ (real-ℝ⁰⁺ x) (real-ℝ⁰⁺ y) (real-ℝ⁰⁺ z) +``` + +### Every nonnegative real number is less than some positive rational number + +```agda +module _ + {l : Level} (x : ℝ⁰⁺ l) + where + + abstract + le-some-positive-rational-ℝ⁰⁺ : + exists ℚ⁺ (λ q → le-prop-ℝ⁰⁺ x (nonnegative-real-ℚ⁺ q)) + le-some-positive-rational-ℝ⁰⁺ = + let + open + do-syntax-trunc-Prop + ( ∃ ℚ⁺ (λ q → le-prop-ℝ⁰⁺ x (nonnegative-real-ℚ⁺ q))) + in do + (q , xImports + +```agda +open import elementary-number-theory.positive-rational-numbers + +open import foundation.universe-levels + +open import real-numbers.addition-real-numbers +open import real-numbers.dedekind-real-numbers +open import real-numbers.inequality-real-numbers +open import real-numbers.rational-real-numbers +open import real-numbers.strict-inequality-real-numbers +``` + + + +## Idea + +If `x ≤ y + ε` for [real numbers](real-numbers.dedekind-real-numbers.md) `x` and +`y` and every +[positive rational](elementary-number-theory.positive-rational-numbers.md) `ε`, +then `x ≤ y`. + +Despite being a property of +[inequality of real numbers](real-numbers.inequality-real-numbers.md), this is +much easier to prove via +[strict inequality](real-numbers.strict-inequality-real-numbers.md), so it is +moved to its own file to prevent circular dependency. + +## Proof + +```agda +module _ + {l1 l2 : Level} (x : ℝ l1) (y : ℝ l2) + where + + abstract + saturated-leq-ℝ : ((ε : ℚ⁺) → leq-ℝ x (y +ℝ real-ℚ⁺ ε)) → leq-ℝ x y + saturated-leq-ℝ H = + saturated-le-ℝ x y + ( λ ε → + concatenate-leq-le-ℝ + ( x) + ( y +ℝ real-ℚ⁺ (mediant-zero-ℚ⁺ ε)) + ( y +ℝ real-ℚ⁺ ε) + ( H (mediant-zero-ℚ⁺ ε)) + ( preserves-le-left-add-ℝ + ( y) + ( real-ℚ⁺ (mediant-zero-ℚ⁺ ε)) + ( real-ℚ⁺ ε) + ( preserves-le-real-ℚ _ _ (le-mediant-zero-ℚ⁺ ε)))) +``` diff --git a/src/real-numbers/similarity-real-numbers.lagda.md b/src/real-numbers/similarity-real-numbers.lagda.md index 2707fd29d2..6baabbbbcf 100644 --- a/src/real-numbers/similarity-real-numbers.lagda.md +++ b/src/real-numbers/similarity-real-numbers.lagda.md @@ -41,11 +41,15 @@ differing universe levels. ```agda opaque - sim-prop-ℝ : {l1 l2 : Level} → ℝ l1 → ℝ l2 → Prop (l1 ⊔ l2) - sim-prop-ℝ x y = sim-prop-subtype (lower-cut-ℝ x) (lower-cut-ℝ y) - sim-ℝ : {l1 l2 : Level} → ℝ l1 → ℝ l2 → UU (l1 ⊔ l2) - sim-ℝ x y = type-Prop (sim-prop-ℝ x y) + sim-ℝ x y = sim-subtype (lower-cut-ℝ x) (lower-cut-ℝ y) + + is-prop-sim-ℝ : {l1 l2 : Level} (x : ℝ l1) (y : ℝ l2) → is-prop (sim-ℝ x y) + is-prop-sim-ℝ x y = + is-prop-type-Prop (sim-prop-subtype (lower-cut-ℝ x) (lower-cut-ℝ y)) + +sim-prop-ℝ : {l1 l2 : Level} → ℝ l1 → ℝ l2 → Prop (l1 ⊔ l2) +sim-prop-ℝ x y = (sim-ℝ x y , is-prop-sim-ℝ x y) infix 6 _~ℝ_ _~ℝ_ : {l1 l2 : Level} → ℝ l1 → ℝ l2 → UU (l1 ⊔ l2) diff --git a/src/real-numbers/strict-inequality-real-numbers.lagda.md b/src/real-numbers/strict-inequality-real-numbers.lagda.md index 268cebff6b..69a5c50763 100644 --- a/src/real-numbers/strict-inequality-real-numbers.lagda.md +++ b/src/real-numbers/strict-inequality-real-numbers.lagda.md @@ -265,6 +265,36 @@ module _ is-in-upper-cut-le-real-ℚ = backward-implication le-iff-upper-cut-real-ℚ ``` +### The real numbers are located + +```agda +module _ + {l : Level} (x : ℝ l) (p q : ℚ) (p Date: Tue, 2 Sep 2025 22:12:47 -0700 Subject: [PATCH 43/97] Maximum and minimum of finite families of real numbers (#1522) Pulled out of #1510; depends on #1521. --- src/real-numbers.lagda.md | 2 + .../binary-minimum-real-numbers.lagda.md | 1 - ...imum-finite-families-real-numbers.lagda.md | 332 ++++++++++++++++++ ...imum-finite-families-real-numbers.lagda.md | 124 +++++++ .../positive-real-numbers.lagda.md | 3 +- .../strict-inequality-real-numbers.lagda.md | 3 +- 6 files changed, 460 insertions(+), 5 deletions(-) create mode 100644 src/real-numbers/maximum-finite-families-real-numbers.lagda.md create mode 100644 src/real-numbers/minimum-finite-families-real-numbers.lagda.md diff --git a/src/real-numbers.lagda.md b/src/real-numbers.lagda.md index 65413ec2dc..a8f4ee2974 100644 --- a/src/real-numbers.lagda.md +++ b/src/real-numbers.lagda.md @@ -24,9 +24,11 @@ open import real-numbers.infima-families-real-numbers public open import real-numbers.isometry-addition-real-numbers public open import real-numbers.isometry-negation-real-numbers public open import real-numbers.lower-dedekind-real-numbers public +open import real-numbers.maximum-finite-families-real-numbers public open import real-numbers.maximum-lower-dedekind-real-numbers public open import real-numbers.maximum-upper-dedekind-real-numbers public open import real-numbers.metric-space-of-real-numbers public +open import real-numbers.minimum-finite-families-real-numbers public open import real-numbers.minimum-lower-dedekind-real-numbers public open import real-numbers.minimum-upper-dedekind-real-numbers public open import real-numbers.negation-lower-upper-dedekind-real-numbers public diff --git a/src/real-numbers/binary-minimum-real-numbers.lagda.md b/src/real-numbers/binary-minimum-real-numbers.lagda.md index 54a8feb9c1..f156bb4674 100644 --- a/src/real-numbers/binary-minimum-real-numbers.lagda.md +++ b/src/real-numbers/binary-minimum-real-numbers.lagda.md @@ -14,7 +14,6 @@ open import elementary-number-theory.positive-rational-numbers open import foundation.binary-transport open import foundation.dependent-pair-types open import foundation.disjunction -open import foundation.empty-types open import foundation.identity-types open import foundation.logical-equivalences open import foundation.transport-along-identifications diff --git a/src/real-numbers/maximum-finite-families-real-numbers.lagda.md b/src/real-numbers/maximum-finite-families-real-numbers.lagda.md new file mode 100644 index 0000000000..44165bc6bf --- /dev/null +++ b/src/real-numbers/maximum-finite-families-real-numbers.lagda.md @@ -0,0 +1,332 @@ +# The maximum of finite families of real numbers + +```agda +module real-numbers.maximum-finite-families-real-numbers where +``` + +
Imports + +```agda +open import elementary-number-theory.natural-numbers +open import elementary-number-theory.positive-rational-numbers + +open import foundation.action-on-identifications-functions +open import foundation.coproduct-types +open import foundation.dependent-pair-types +open import foundation.disjunction +open import foundation.empty-types +open import foundation.equivalences +open import foundation.existential-quantification +open import foundation.function-types +open import foundation.identity-types +open import foundation.inhabited-types +open import foundation.propositional-truncations +open import foundation.transport-along-identifications +open import foundation.unit-type +open import foundation.universe-levels + +open import lists.finite-sequences + +open import logic.functoriality-existential-quantification + +open import order-theory.join-semilattices +open import order-theory.joins-finite-families-join-semilattices +open import order-theory.least-upper-bounds-large-posets +open import order-theory.upper-bounds-large-posets + +open import real-numbers.addition-real-numbers +open import real-numbers.binary-maximum-real-numbers +open import real-numbers.dedekind-real-numbers +open import real-numbers.difference-real-numbers +open import real-numbers.inequality-real-numbers +open import real-numbers.negation-real-numbers +open import real-numbers.positive-real-numbers +open import real-numbers.rational-real-numbers +open import real-numbers.strict-inequality-real-numbers +open import real-numbers.suprema-families-real-numbers + +open import univalent-combinatorics.counting +open import univalent-combinatorics.inhabited-finite-types +open import univalent-combinatorics.standard-finite-types +``` + +
+ +## Idea + +The +{{#concept "maximum" Disambiguation="inhabited finite family, Dedekind real numbers" Agda=max-finite-family-ℝ WD="maximum" WDID=Q10578722}} +of a family of [Dedekind real numbers](real-numbers.dedekind-real-numbers.md) +indexed by an +[inhabited finite type](univalent-combinatorics.inhabited-finite-types.md) is +their [least upper bound](order-theory.least-upper-bounds-large-posets.md). + +## Definition + +### The maximum of a nonempty finite sequence of real numbers + +```agda +module _ + {l : Level} (n : ℕ) (x : fin-sequence (ℝ l) (succ-ℕ n)) + where + + max-fin-sequence-ℝ : ℝ l + max-fin-sequence-ℝ = + join-fin-sequence-type-Order-Theoretic-Join-Semilattice + ( ℝ-Order-Theoretic-Join-Semilattice l) + ( n) + ( x) +``` + +### The maximum of a counted, inhabited family of real numbers + +```agda +module _ + {l1 l2 : Level} {I : UU l1} (|I| : is-inhabited I) (cI : count I) + (x : I → ℝ l2) + where + + max-counted-family-ℝ : ℝ l2 + max-counted-family-ℝ = + join-counted-family-type-Order-Theoretic-Join-Semilattice + ( ℝ-Order-Theoretic-Join-Semilattice l2) + ( |I|) + ( cI) + ( x) +``` + +### The maximum of an inhabited finite family of real numbers + +```agda +module _ + {l1 l2 : Level} (I : Inhabited-Finite-Type l1) + (f : type-Inhabited-Finite-Type I → ℝ l2) + where + + max-finite-family-ℝ : ℝ l2 + max-finite-family-ℝ = + join-inhabited-finite-family-Order-Theoretic-Join-Semilattice + ( ℝ-Order-Theoretic-Join-Semilattice l2) + ( I) + ( f) +``` + +## Properties + +### The maximum of a finite sequence is its supremum + +```agda +abstract + is-upper-bound-max-fin-sequence-ℝ : + {l : Level} (n : ℕ) (x : fin-sequence (ℝ l) (succ-ℕ n)) → + is-upper-bound-family-of-elements-Large-Poset + ( ℝ-Large-Poset) + ( x) + ( max-fin-sequence-ℝ n x) + is-upper-bound-max-fin-sequence-ℝ zero-ℕ x (inr star) = + refl-leq-ℝ (x (inr star)) + is-upper-bound-max-fin-sequence-ℝ (succ-ℕ n) x (inr star) = + leq-right-max-ℝ _ _ + is-upper-bound-max-fin-sequence-ℝ (succ-ℕ n) x (inl i) = + transitive-leq-ℝ + ( x (inl i)) + ( max-fin-sequence-ℝ n (x ∘ inl)) + ( max-fin-sequence-ℝ (succ-ℕ n) x) + ( leq-left-max-ℝ _ _) + ( is-upper-bound-max-fin-sequence-ℝ n (x ∘ inl) i) + + is-approximated-below-max-fin-sequence-ℝ : + {l : Level} (n : ℕ) (x : fin-sequence (ℝ l) (succ-ℕ n)) → + is-approximated-below-family-ℝ x (max-fin-sequence-ℝ n x) + is-approximated-below-max-fin-sequence-ℝ zero-ℕ x ε = + intro-exists + ( inr star) + ( le-diff-real-ℝ⁺ (x (inr star)) (positive-real-ℚ⁺ ε)) + is-approximated-below-max-fin-sequence-ℝ (succ-ℕ n) x ε = + let + (ε₁ , ε₂ , ε₁+ε₂=ε) = split-ℚ⁺ ε + motive = + ∃ + ( Fin (succ-ℕ (succ-ℕ n))) + ( λ i → + le-prop-ℝ (max-fin-sequence-ℝ (succ-ℕ n) x -ℝ real-ℚ⁺ ε) (x i)) + max-ε₁-ε₂=max-ε = + associative-add-ℝ _ _ _ ∙ + ap-add-ℝ refl (inv (distributive-neg-add-ℝ _ _)) ∙ + ap-diff-ℝ refl (add-real-ℚ _ _ ∙ ap real-ℚ⁺ ε₁+ε₂=ε) + in + elim-disjunction + ( motive) + ( λ max-ε₁Imports + +```agda +open import elementary-number-theory.natural-numbers + +open import foundation.function-types +open import foundation.universe-levels + +open import lists.finite-sequences + +open import order-theory.greatest-lower-bounds-large-posets + +open import real-numbers.dedekind-real-numbers +open import real-numbers.inequality-real-numbers +open import real-numbers.infima-families-real-numbers +open import real-numbers.maximum-finite-families-real-numbers +open import real-numbers.negation-real-numbers + +open import univalent-combinatorics.inhabited-finite-types +``` + + + +## Idea + +The +{{#concept "minimum" Disambiguation="inhabited finite family, Dedekind real numbers" Agda=min-finite-family-ℝ WD="minimum" WDID=Q10578722}} +of a family of [Dedekind real numbers](real-numbers.dedekind-real-numbers.md) +indexed by an +[inhabited finite type](univalent-combinatorics.inhabited-finite-types.md) is +their +[greatest lower bound](order-theory.greatest-lower-bounds-large-posets.md). + +## Definition + +### The minimum of a nonempty finite sequence of real numbers + +```agda +module _ + {l : Level} (n : ℕ) (x : fin-sequence (ℝ l) (succ-ℕ n)) + where + + opaque + min-fin-sequence-ℝ : ℝ l + min-fin-sequence-ℝ = neg-ℝ (max-fin-sequence-ℝ n (neg-ℝ ∘ x)) +``` + +### The minimum of an inhabited finite family of real numbers + +```agda +module _ + {l1 l2 : Level} (I : Inhabited-Finite-Type l1) + (f : type-Inhabited-Finite-Type I → ℝ l2) + where + + opaque + min-finite-family-ℝ : ℝ l2 + min-finite-family-ℝ = neg-ℝ (max-finite-family-ℝ I (neg-ℝ ∘ f)) +``` + +## Properties + +### The minimum of a finite sequence is its infimum + +```agda +opaque + unfolding min-fin-sequence-ℝ + + is-infimum-min-fin-sequence-ℝ : + {l : Level} (n : ℕ) (x : fin-sequence (ℝ l) (succ-ℕ n)) → + is-infimum-family-ℝ x (min-fin-sequence-ℝ n x) + is-infimum-min-fin-sequence-ℝ n x = + is-infimum-neg-supremum-neg-family-ℝ + ( x) + ( max-fin-sequence-ℝ n (neg-ℝ ∘ x)) + ( is-supremum-max-fin-sequence-ℝ n (neg-ℝ ∘ x)) +``` + +### The minimum of a finite family is its infimum + +```agda +module _ + {l1 l2 : Level} (I : Inhabited-Finite-Type l1) + (x : type-Inhabited-Finite-Type I → ℝ l2) + where + + opaque + unfolding min-finite-family-ℝ + + is-infimum-min-finite-family-ℝ : + is-infimum-family-ℝ x (min-finite-family-ℝ I x) + is-infimum-min-finite-family-ℝ = + is-infimum-neg-supremum-neg-family-ℝ + ( x) + ( max-finite-family-ℝ I (neg-ℝ ∘ x)) + ( is-supremum-max-finite-family-ℝ I (neg-ℝ ∘ x)) +``` + +### The minimum of a finite family is its greatest lower bound + +```agda +module _ + {l1 l2 : Level} (I : Inhabited-Finite-Type l1) + (x : type-Inhabited-Finite-Type I → ℝ l2) + where + + abstract + is-greatest-lower-bound-min-finite-family-ℝ : + is-greatest-lower-bound-family-of-elements-Large-Poset + ( ℝ-Large-Poset) + ( x) + ( min-finite-family-ℝ I x) + is-greatest-lower-bound-min-finite-family-ℝ = + is-greatest-lower-bound-is-infimum-family-ℝ + ( x) + ( min-finite-family-ℝ I x) + ( is-infimum-min-finite-family-ℝ I x) +``` diff --git a/src/real-numbers/positive-real-numbers.lagda.md b/src/real-numbers/positive-real-numbers.lagda.md index 2c8fc34c45..8922e6023b 100644 --- a/src/real-numbers/positive-real-numbers.lagda.md +++ b/src/real-numbers/positive-real-numbers.lagda.md @@ -133,8 +133,7 @@ exists-ℚ⁺-in-lower-cut-ℝ⁺ = ind-Σ exists-ℚ⁺-in-lower-cut-is-positiv ```agda opaque - unfolding add-ℝ - unfolding le-ℝ + unfolding add-ℝ le-ℝ le-left-add-real-ℝ⁺ : {l1 l2 : Level} → (x : ℝ l1) (d : ℝ⁺ l2) → le-ℝ x (x +ℝ real-ℝ⁺ d) diff --git a/src/real-numbers/strict-inequality-real-numbers.lagda.md b/src/real-numbers/strict-inequality-real-numbers.lagda.md index 69a5c50763..52078fab17 100644 --- a/src/real-numbers/strict-inequality-real-numbers.lagda.md +++ b/src/real-numbers/strict-inequality-real-numbers.lagda.md @@ -524,8 +524,7 @@ module _ where opaque - unfolding add-ℝ - unfolding le-ℝ + unfolding add-ℝ le-ℝ preserves-le-right-add-ℝ : le-ℝ x y → le-ℝ (x +ℝ z) (y +ℝ z) preserves-le-right-add-ℝ x Date: Tue, 2 Sep 2025 22:22:19 -0700 Subject: [PATCH 44/97] Finite sums in groups and abelian groups (#1527) Just filling these out. --- src/group-theory.lagda.md | 3 + ...milies-of-elements-abelian-groups.lagda.md | 208 +++++++++++++++++ ...s-of-elements-commutative-monoids.lagda.md | 91 ++++++++ ...uences-of-elements-abelian-groups.lagda.md | 217 ++++++++++++++++++ ...nite-sequences-of-elements-groups.lagda.md | 180 +++++++++++++++ src/linear-algebra.lagda.md | 2 + ...inite-sequences-in-abelian-groups.lagda.md | 158 +++++++++++++ .../finite-sequences-in-groups.lagda.md | 151 ++++++++++++ ...te-families-of-elements-semirings.lagda.md | 81 +------ 9 files changed, 1015 insertions(+), 76 deletions(-) create mode 100644 src/group-theory/sums-of-finite-families-of-elements-abelian-groups.lagda.md create mode 100644 src/group-theory/sums-of-finite-sequences-of-elements-abelian-groups.lagda.md create mode 100644 src/group-theory/sums-of-finite-sequences-of-elements-groups.lagda.md create mode 100644 src/linear-algebra/finite-sequences-in-abelian-groups.lagda.md create mode 100644 src/linear-algebra/finite-sequences-in-groups.lagda.md diff --git a/src/group-theory.lagda.md b/src/group-theory.lagda.md index ec2473987c..62242cd9f3 100644 --- a/src/group-theory.lagda.md +++ b/src/group-theory.lagda.md @@ -190,10 +190,13 @@ open import group-theory.subsets-monoids public open import group-theory.subsets-semigroups public open import group-theory.substitution-functor-concrete-group-actions public open import group-theory.substitution-functor-group-actions public +open import group-theory.sums-of-finite-families-of-elements-abelian-groups public open import group-theory.sums-of-finite-families-of-elements-commutative-monoids public open import group-theory.sums-of-finite-families-of-elements-commutative-semigroups public +open import group-theory.sums-of-finite-sequences-of-elements-abelian-groups public open import group-theory.sums-of-finite-sequences-of-elements-commutative-monoids public open import group-theory.sums-of-finite-sequences-of-elements-commutative-semigroups public +open import group-theory.sums-of-finite-sequences-of-elements-groups public open import group-theory.sums-of-finite-sequences-of-elements-monoids public open import group-theory.sums-of-finite-sequences-of-elements-semigroups public open import group-theory.surjective-group-homomorphisms public diff --git a/src/group-theory/sums-of-finite-families-of-elements-abelian-groups.lagda.md b/src/group-theory/sums-of-finite-families-of-elements-abelian-groups.lagda.md new file mode 100644 index 0000000000..d6e82b4ed1 --- /dev/null +++ b/src/group-theory/sums-of-finite-families-of-elements-abelian-groups.lagda.md @@ -0,0 +1,208 @@ +# Sums of finite families of elements in abelian groups + +```agda +module group-theory.sums-of-finite-families-of-elements-abelian-groups where +``` + +
Imports + +```agda +open import foundation.action-on-identifications-functions +open import foundation.coproduct-types +open import foundation.empty-types +open import foundation.equivalences +open import foundation.function-types +open import foundation.homotopies +open import foundation.identity-types +open import foundation.propositional-truncations +open import foundation.sets +open import foundation.type-arithmetic-cartesian-product-types +open import foundation.unit-type +open import foundation.universe-levels + +open import group-theory.abelian-groups +open import group-theory.sums-of-finite-families-of-elements-commutative-monoids +open import group-theory.sums-of-finite-sequences-of-elements-abelian-groups + +open import univalent-combinatorics.coproduct-types +open import univalent-combinatorics.counting +open import univalent-combinatorics.dependent-pair-types +open import univalent-combinatorics.finite-types +open import univalent-combinatorics.standard-finite-types +``` + +
+ +## Idea + +The +{{#concept "sum operation" Disambiguation="of a finite family of elements of a abelian group" WD="sum" WDID=Q218005 Agda=sum-fin-sequence-type-Ab}} +extends the binary addition operation on a +[abelian group](ring-theory.semirings.md) `G` to any family of elements of `G` +indexed by a [finite type](univalent-combinatorics.finite-types.md). + +## Definition + +```agda +sum-count-Ab : + {l1 l2 : Level} (G : Ab l1) (A : UU l2) (cA : count A) → + (A → type-Ab G) → type-Ab G +sum-count-Ab G = + sum-count-Commutative-Monoid (commutative-monoid-Ab G) + +sum-finite-Ab : + {l1 l2 : Level} (G : Ab l1) (A : Finite-Type l2) → + (type-Finite-Type A → type-Ab G) → type-Ab G +sum-finite-Ab G = + sum-finite-Commutative-Monoid (commutative-monoid-Ab G) +``` + +## Properties + +### Sums over the unit type + +```agda +module _ + {l : Level} (G : Ab l) + where + + sum-unit-finite-Ab : + (f : unit → type-Ab G) → + sum-finite-Ab G unit-Finite-Type f = f star + sum-unit-finite-Ab = + sum-finite-unit-type-Commutative-Monoid + ( commutative-monoid-Ab G) +``` + +### Sums are homotopy invariant + +```agda +module _ + {l : Level} (G : Ab l) + where + + htpy-sum-finite-Ab : + {l2 : Level} (A : Finite-Type l2) → + {f g : type-Finite-Type A → type-Ab G} → (f ~ g) → + sum-finite-Ab G A f = sum-finite-Ab G A g + htpy-sum-finite-Ab = + htpy-sum-finite-Commutative-Monoid (commutative-monoid-Ab G) +``` + +### A sum of zeroes is zero + +```agda +module _ + {l : Level} (G : Ab l) + where + + sum-zero-finite-Ab : + {l2 : Level} (A : Finite-Type l2) → + sum-finite-Ab G A (λ _ → zero-Ab G) = zero-Ab G + sum-zero-finite-Ab = + sum-zero-finite-Commutative-Monoid (commutative-monoid-Ab G) +``` + +### Sums over finite types are preserved by equivalences + +```agda +module _ + {l1 l2 l3 : Level} (G : Ab l1) (A : Finite-Type l2) (B : Finite-Type l3) + (H : equiv-Finite-Type A B) + where + + sum-equiv-finite-Ab : + (f : type-Finite-Type A → type-Ab G) → + sum-finite-Ab G A f = sum-finite-Ab G B (f ∘ map-inv-equiv H) + sum-equiv-finite-Ab = + sum-equiv-finite-Commutative-Monoid + ( commutative-monoid-Ab G) + ( A) + ( B) + ( H) +``` + +### Sums over finite types distribute over coproducts + +```agda +module _ + {l1 l2 l3 : Level} (G : Ab l1) (A : Finite-Type l2) (B : Finite-Type l3) + where + + distributive-sum-coproduct-finite-Ab : + (f : + type-Finite-Type A + type-Finite-Type B → type-Ab G) → + sum-finite-Ab G (coproduct-Finite-Type A B) f = + add-Ab + ( G) + ( sum-finite-Ab G A (f ∘ inl)) + ( sum-finite-Ab G B (f ∘ inr)) + distributive-sum-coproduct-finite-Ab = + distributive-distributive-sum-coproduct-finite-Commutative-Monoid + ( commutative-monoid-Ab G) + ( A) + ( B) +``` + +### Sums distribute over dependent pair types + +```agda +module _ + {l1 l2 l3 : Level} (G : Ab l1) + (A : Finite-Type l2) (B : type-Finite-Type A → Finite-Type l3) + where + + sum-Σ-finite-Ab : + (f : (a : type-Finite-Type A) → type-Finite-Type (B a) → type-Ab G) → + sum-finite-Ab G (Σ-Finite-Type A B) (ind-Σ f) = + sum-finite-Ab G A (λ a → sum-finite-Ab G (B a) (f a)) + sum-Σ-finite-Ab = + sum-Σ-finite-Commutative-Monoid (commutative-monoid-Ab G) A B +``` + +### The sum over an empty type is zero + +```agda +module _ + {l1 l2 : Level} (G : Ab l1) (A : Finite-Type l2) + (H : is-empty (type-Finite-Type A)) + where + + eq-zero-sum-finite-is-empty-Ab : + (f : type-Finite-Type A → type-Ab G) → + is-zero-Ab G (sum-finite-Ab G A f) + eq-zero-sum-finite-is-empty-Ab = + eq-zero-sum-finite-is-empty-Commutative-Monoid + ( commutative-monoid-Ab G) + ( A) + ( H) +``` + +### The sum over a finite type is the sum over any count for that type + +```agda +eq-sum-finite-sum-count-Ab : + {l1 l2 : Level} (G : Ab l1) (A : Finite-Type l2) + (cA : count (type-Finite-Type A)) + (f : type-Finite-Type A → type-Ab G) → + sum-finite-Ab G A f = + sum-count-Ab G (type-Finite-Type A) cA f +eq-sum-finite-sum-count-Ab G = + eq-sum-finite-sum-count-Commutative-Monoid + ( commutative-monoid-Ab G) +``` + +### Interchange law of sums and addition + +```agda +module _ + {l1 l2 : Level} (G : Ab l1) (A : Finite-Type l2) + where + + interchange-sum-add-finite-Ab : + (f g : type-Finite-Type A → type-Ab G) → + sum-finite-Ab G A (λ a → add-Ab G (f a) (g a)) = + add-Ab G (sum-finite-Ab G A f) (sum-finite-Ab G A g) + interchange-sum-add-finite-Ab = + interchange-sum-mul-finite-Commutative-Monoid (commutative-monoid-Ab G) A +``` diff --git a/src/group-theory/sums-of-finite-families-of-elements-commutative-monoids.lagda.md b/src/group-theory/sums-of-finite-families-of-elements-commutative-monoids.lagda.md index 1554075883..b9aec167a2 100644 --- a/src/group-theory/sums-of-finite-families-of-elements-commutative-monoids.lagda.md +++ b/src/group-theory/sums-of-finite-families-of-elements-commutative-monoids.lagda.md @@ -26,6 +26,7 @@ open import foundation.identity-types open import foundation.inhabited-types open import foundation.propositional-truncations open import foundation.sets +open import foundation.type-arithmetic-cartesian-product-types open import foundation.type-arithmetic-coproduct-types open import foundation.type-arithmetic-empty-type open import foundation.type-arithmetic-unit-type @@ -704,3 +705,93 @@ module _ ( f) = f star by compute-sum-one-element-Commutative-Monoid M _ ``` + +### Interchange law of sums and addition + +```agda +module _ + {l1 l2 : Level} (G : Commutative-Monoid l1) (A : Finite-Type l2) + where + + interchange-sum-mul-finite-Commutative-Monoid : + (f g : type-Finite-Type A → type-Commutative-Monoid G) → + sum-finite-Commutative-Monoid G A + (λ a → mul-Commutative-Monoid G (f a) (g a)) = + mul-Commutative-Monoid G + (sum-finite-Commutative-Monoid G A f) + (sum-finite-Commutative-Monoid G A g) + interchange-sum-mul-finite-Commutative-Monoid f g = + equational-reasoning + sum-finite-Commutative-Monoid G A + ( λ a → mul-Commutative-Monoid G (f a) (g a)) + = + sum-finite-Commutative-Monoid + ( G) + ( A) + ( λ a → sum-fin-sequence-type-Commutative-Monoid G 2 (h a)) + by + htpy-sum-finite-Commutative-Monoid + ( G) + ( A) + ( λ a → inv (compute-sum-two-elements-Commutative-Monoid G (h a))) + = + sum-finite-Commutative-Monoid + ( G) + ( A) + ( λ a → + sum-finite-Commutative-Monoid G (Fin-Finite-Type 2) (h a)) + by + htpy-sum-finite-Commutative-Monoid G A + ( λ a → + inv + ( eq-sum-finite-sum-count-Commutative-Monoid + ( G) + ( Fin-Finite-Type 2) + ( count-Fin 2) + ( h a))) + = + sum-finite-Commutative-Monoid + ( G) + ( Σ-Finite-Type A (λ _ → Fin-Finite-Type 2)) + ( ind-Σ h) + by inv (sum-Σ-finite-Commutative-Monoid G A (λ _ → Fin-Finite-Type 2) h) + = + sum-finite-Commutative-Monoid + ( G) + ( Σ-Finite-Type (Fin-Finite-Type 2) (λ _ → A)) + ( λ (i , a) → h a i) + by + sum-equiv-finite-Commutative-Monoid G _ _ + ( commutative-product) + ( ind-Σ h) + = + sum-finite-Commutative-Monoid + ( G) + ( Fin-Finite-Type 2) + ( λ i → sum-finite-Commutative-Monoid G A (λ a → h a i)) + by sum-Σ-finite-Commutative-Monoid G _ _ _ + = + sum-fin-sequence-type-Commutative-Monoid + ( G) + ( 2) + ( λ i → sum-finite-Commutative-Monoid G A (λ a → h a i)) + by + eq-sum-finite-sum-count-Commutative-Monoid + ( G) + ( Fin-Finite-Type 2) + ( count-Fin 2) + ( _) + = + mul-Commutative-Monoid + ( G) + ( sum-finite-Commutative-Monoid G A f) + ( sum-finite-Commutative-Monoid G A g) + by + compute-sum-two-elements-Commutative-Monoid + ( G) + ( λ i → sum-finite-Commutative-Monoid G A (λ a → h a i)) + where + h : type-Finite-Type A → Fin 2 → type-Commutative-Monoid G + h a (inl (inr _)) = f a + h a (inr _) = g a +``` diff --git a/src/group-theory/sums-of-finite-sequences-of-elements-abelian-groups.lagda.md b/src/group-theory/sums-of-finite-sequences-of-elements-abelian-groups.lagda.md new file mode 100644 index 0000000000..87acdeccfa --- /dev/null +++ b/src/group-theory/sums-of-finite-sequences-of-elements-abelian-groups.lagda.md @@ -0,0 +1,217 @@ +# Sums of finite sequences of elements in abelian groups + +```agda +{-# OPTIONS --lossy-unification #-} + +module group-theory.sums-of-finite-sequences-of-elements-abelian-groups where +``` + +
Imports + +```agda +open import elementary-number-theory.addition-natural-numbers +open import elementary-number-theory.natural-numbers + +open import finite-group-theory.permutations-standard-finite-types + +open import foundation.action-on-identifications-functions +open import foundation.coproduct-types +open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.function-types +open import foundation.homotopies +open import foundation.identity-types +open import foundation.universe-levels + +open import group-theory.abelian-groups +open import group-theory.commutative-monoids +open import group-theory.sums-of-finite-sequences-of-elements-commutative-monoids +open import group-theory.sums-of-finite-sequences-of-elements-commutative-semigroups + +open import linear-algebra.finite-sequences-in-abelian-groups +open import linear-algebra.finite-sequences-in-commutative-monoids + +open import univalent-combinatorics.coproduct-types +open import univalent-combinatorics.standard-finite-types +``` + +
+ +## Idea + +The +{{#concept "sum operation" Disambiguation="of a finite sequence in a abelian group" WD="sum" WDID=Q218005 Agda=sum-fin-sequence-type-Ab}} +extends the binary operation on a +[abelian group](group-theory.commutative-monoids.md) `G` to any +[finite sequence](lists.finite-sequences.md) of elements of `G`. + +## Definition + +```agda +sum-fin-sequence-type-Ab : + {l : Level} (G : Ab l) (n : ℕ) → + fin-sequence-type-Ab G n → type-Ab G +sum-fin-sequence-type-Ab G = + sum-fin-sequence-type-Commutative-Monoid (commutative-monoid-Ab G) +``` + +## Properties + +### Sums of one and two elements + +```agda +module _ + {l : Level} (G : Ab l) + where + + compute-sum-one-element-Ab : + (f : fin-sequence-type-Ab G 1) → + sum-fin-sequence-type-Ab G 1 f = + head-fin-sequence-type-Ab G 0 f + compute-sum-one-element-Ab = + compute-sum-one-element-Commutative-Monoid (commutative-monoid-Ab G) + + compute-sum-two-elements-Ab : + (f : fin-sequence-type-Ab G 2) → + sum-fin-sequence-type-Ab G 2 f = + add-Ab G (f (zero-Fin 1)) (f (one-Fin 1)) + compute-sum-two-elements-Ab = + compute-sum-two-elements-Commutative-Monoid (commutative-monoid-Ab G) +``` + +### Sums are homotopy invariant + +```agda +module _ + {l : Level} (G : Ab l) + where + + htpy-sum-fin-sequence-type-Ab : + (n : ℕ) {f g : fin-sequence-type-Ab G n} → + (f ~ g) → + sum-fin-sequence-type-Ab G n f = + sum-fin-sequence-type-Ab G n g + htpy-sum-fin-sequence-type-Ab = + htpy-sum-fin-sequence-type-Commutative-Monoid (commutative-monoid-Ab G) +``` + +### Sums are equal to the zero-th term plus the rest + +```agda +module _ + {l : Level} (G : Ab l) + where + + cons-sum-fin-sequence-type-Ab : + (n : ℕ) (f : fin-sequence-type-Ab G (succ-ℕ n)) → + {x : type-Ab G} → + head-fin-sequence-type-Ab G n f = x → + sum-fin-sequence-type-Ab G (succ-ℕ n) f = + add-Ab G + ( sum-fin-sequence-type-Ab G n (f ∘ inl-Fin n)) + ( x) + cons-sum-fin-sequence-type-Ab = + cons-sum-fin-sequence-type-Commutative-Monoid (commutative-monoid-Ab G) + + snoc-sum-fin-sequence-type-Ab : + (n : ℕ) (f : fin-sequence-type-Ab G (succ-ℕ n)) → + {x : type-Ab G} → f (zero-Fin n) = x → + sum-fin-sequence-type-Ab G (succ-ℕ n) f = + add-Ab G + ( x) + ( sum-fin-sequence-type-Ab G n (f ∘ inr-Fin n)) + snoc-sum-fin-sequence-type-Ab = + snoc-sum-fin-sequence-type-Commutative-Monoid (commutative-monoid-Ab G) +``` + +### Extending a sum of elements in a monoid + +```agda +module _ + {l : Level} (G : Ab l) + where + + extend-sum-fin-sequence-type-Ab : + (n : ℕ) (f : fin-sequence-type-Ab G n) → + sum-fin-sequence-type-Ab G + ( succ-ℕ n) + ( cons-fin-sequence-type-Ab + ( G) + ( n) + ( zero-Ab G) f) = + sum-fin-sequence-type-Ab G n f + extend-sum-fin-sequence-type-Ab = + extend-sum-fin-sequence-type-Commutative-Monoid (commutative-monoid-Ab G) +``` + +### Shifting a sum of elements in a monoid + +```agda +module _ + {l : Level} (G : Ab l) + where + + shift-sum-fin-sequence-type-Ab : + (n : ℕ) (f : fin-sequence-type-Ab G n) → + sum-fin-sequence-type-Ab G + ( succ-ℕ n) + ( snoc-fin-sequence-type-Ab G n f + ( zero-Ab G)) = + sum-fin-sequence-type-Ab G n f + shift-sum-fin-sequence-type-Ab = + shift-sum-fin-sequence-type-Commutative-Monoid (commutative-monoid-Ab G) +``` + +### A sum of zeroes is zero + +```agda +module _ + {l : Level} (G : Ab l) + where + + sum-zero-fin-sequence-type-Ab : + (n : ℕ) → + sum-fin-sequence-type-Ab + ( G) + ( n) + ( zero-fin-sequence-type-Ab G n) = + zero-Ab G + sum-zero-fin-sequence-type-Ab = + sum-zero-fin-sequence-type-Commutative-Monoid (commutative-monoid-Ab G) +``` + +### Splitting sums of `n + m` elements into a sum of `n` elements and a sum of `m` elements + +```agda +split-sum-fin-sequence-type-Ab : + {l : Level} (G : Ab l) + (n m : ℕ) (f : fin-sequence-type-Ab G (n +ℕ m)) → + sum-fin-sequence-type-Ab G (n +ℕ m) f = + add-Ab G + ( sum-fin-sequence-type-Ab G n (f ∘ inl-coproduct-Fin n m)) + ( sum-fin-sequence-type-Ab G m (f ∘ inr-coproduct-Fin n m)) +split-sum-fin-sequence-type-Ab G = + split-sum-fin-sequence-type-Commutative-Monoid (commutative-monoid-Ab G) +``` + +### Permutations preserve sums + +```agda +module _ + {l : Level} (G : Ab l) + where + + abstract + preserves-sum-permutation-fin-sequence-type-Ab : + (n : ℕ) → (σ : Permutation n) → + (f : fin-sequence-type-Ab G n) → + sum-fin-sequence-type-Ab G n f = + sum-fin-sequence-type-Ab G n (f ∘ map-equiv σ) + preserves-sum-permutation-fin-sequence-type-Ab = + preserves-sum-permutation-fin-sequence-type-Commutative-Monoid + ( commutative-monoid-Ab G) +``` + +## See also + +- [Sums of finite families of elements in abelian groups](group-theory.sums-of-finite-families-of-elements-commutative-monoids.md) diff --git a/src/group-theory/sums-of-finite-sequences-of-elements-groups.lagda.md b/src/group-theory/sums-of-finite-sequences-of-elements-groups.lagda.md new file mode 100644 index 0000000000..2f4ae37596 --- /dev/null +++ b/src/group-theory/sums-of-finite-sequences-of-elements-groups.lagda.md @@ -0,0 +1,180 @@ +# Sums of finite sequences of elements in groups + +```agda +module group-theory.sums-of-finite-sequences-of-elements-groups where +``` + +
Imports + +```agda +open import elementary-number-theory.addition-natural-numbers +open import elementary-number-theory.natural-numbers + +open import foundation.action-on-identifications-functions +open import foundation.coproduct-types +open import foundation.function-types +open import foundation.homotopies +open import foundation.identity-types +open import foundation.unit-type +open import foundation.universe-levels +open import foundation.whiskering-homotopies-composition + +open import group-theory.groups +open import group-theory.sums-of-finite-sequences-of-elements-monoids + +open import linear-algebra.finite-sequences-in-groups + +open import univalent-combinatorics.coproduct-types +open import univalent-combinatorics.standard-finite-types +``` + +
+ +## Idea + +The +{{#concept "sum operation" Disambiguation="of a finite sequence in a group" WD="sum" WDID=Q218005 Agda=sum-fin-sequence-type-Group}} +operation extends the binary operation on a [group](group-theory.groups.md) `G` +to any [finite sequence](lists.finite-sequences.md) of elements of `G`. + +We use additive terminology consistently with the linear algebra definition of +[finite sequences in groups](linear-algebra.finite-sequences-in-groups.md) +despite the use of multiplicative terminology for groups in general. + +## Definition + +```agda +sum-fin-sequence-type-Group : + {l : Level} (G : Group l) (n : ℕ) → + (fin-sequence-type-Group G n) → type-Group G +sum-fin-sequence-type-Group G = + sum-fin-sequence-type-Monoid (monoid-Group G) +``` + +## Properties + +### Sums of one and two elements + +```agda +module _ + {l : Level} (G : Group l) + where + + compute-sum-one-element-Group : + (f : fin-sequence-type-Group G 1) → + sum-fin-sequence-type-Group G 1 f = head-fin-sequence-type-Group G 0 f + compute-sum-one-element-Group = + compute-sum-one-element-Monoid (monoid-Group G) + + compute-sum-two-elements-Group : + (f : fin-sequence-type-Group G 2) → + sum-fin-sequence-type-Group G 2 f = + mul-Group G (f (zero-Fin 1)) (f (one-Fin 1)) + compute-sum-two-elements-Group = + compute-sum-two-elements-Monoid (monoid-Group G) +``` + +### Sums are homotopy invariant + +```agda +module _ + {l : Level} (G : Group l) + where + + htpy-sum-fin-sequence-type-Group : + (n : ℕ) {f g : fin-sequence-type-Group G n} → + (f ~ g) → + sum-fin-sequence-type-Group G n f = sum-fin-sequence-type-Group G n g + htpy-sum-fin-sequence-type-Group = + htpy-sum-fin-sequence-type-Monoid (monoid-Group G) +``` + +### Sums are equal to the zero-th term plus the rest + +```agda +module _ + {l : Level} (G : Group l) + where + + cons-sum-fin-sequence-type-Group : + (n : ℕ) (f : fin-sequence-type-Group G (succ-ℕ n)) → + {x : type-Group G} → head-fin-sequence-type-Group G n f = x → + sum-fin-sequence-type-Group G (succ-ℕ n) f = + mul-Group G (sum-fin-sequence-type-Group G n (f ∘ inl-Fin n)) x + cons-sum-fin-sequence-type-Group n f refl = refl + + snoc-sum-fin-sequence-type-Group : + (n : ℕ) (f : fin-sequence-type-Group G (succ-ℕ n)) → + {x : type-Group G} → f (zero-Fin n) = x → + sum-fin-sequence-type-Group G (succ-ℕ n) f = + mul-Group G + ( x) + ( sum-fin-sequence-type-Group G n (f ∘ inr-Fin n)) + snoc-sum-fin-sequence-type-Group = + snoc-sum-fin-sequence-type-Monoid (monoid-Group G) +``` + +### Extending a sum of elements in a group + +```agda +module _ + {l : Level} (G : Group l) + where + + extend-sum-fin-sequence-type-Group : + (n : ℕ) (f : fin-sequence-type-Group G n) → + sum-fin-sequence-type-Group G + ( succ-ℕ n) + ( cons-fin-sequence-type-Group G n (unit-Group G) f) = + sum-fin-sequence-type-Group G n f + extend-sum-fin-sequence-type-Group = + extend-sum-fin-sequence-type-Monoid (monoid-Group G) +``` + +### Shifting a sum of elements in a group + +```agda +module _ + {l : Level} (G : Group l) + where + + shift-sum-fin-sequence-type-Group : + (n : ℕ) (f : fin-sequence-type-Group G n) → + sum-fin-sequence-type-Group G + ( succ-ℕ n) + ( snoc-fin-sequence-type-Group G n f + ( unit-Group G)) = + sum-fin-sequence-type-Group G n f + shift-sum-fin-sequence-type-Group = + shift-sum-fin-sequence-type-Monoid (monoid-Group G) +``` + +### A sum of zeros is zero + +```agda +module _ + {l : Level} (G : Group l) + where + + abstract + sum-zero-fin-sequence-type-Group : + (n : ℕ) → + sum-fin-sequence-type-Group G n (zero-fin-sequence-type-Group G n) = + unit-Group G + sum-zero-fin-sequence-type-Group = + sum-zero-fin-sequence-type-Monoid (monoid-Group G) +``` + +### Splitting sums of `n + m` elements into a sum of `n` elements and a sum of `m` elements + +```agda +split-sum-fin-sequence-type-Group : + {l : Level} (G : Group l) + (n m : ℕ) (f : fin-sequence-type-Group G (n +ℕ m)) → + sum-fin-sequence-type-Group G (n +ℕ m) f = + mul-Group G + ( sum-fin-sequence-type-Group G n (f ∘ inl-coproduct-Fin n m)) + ( sum-fin-sequence-type-Group G m (f ∘ inr-coproduct-Fin n m)) +split-sum-fin-sequence-type-Group G = + split-sum-fin-sequence-type-Monoid (monoid-Group G) +``` diff --git a/src/linear-algebra.lagda.md b/src/linear-algebra.lagda.md index 772bad9d20..5804ec6d0a 100644 --- a/src/linear-algebra.lagda.md +++ b/src/linear-algebra.lagda.md @@ -9,11 +9,13 @@ open import linear-algebra.constant-matrices public open import linear-algebra.constant-tuples public open import linear-algebra.dependent-products-left-modules-rings public open import linear-algebra.diagonal-matrices-on-rings public +open import linear-algebra.finite-sequences-in-abelian-groups public open import linear-algebra.finite-sequences-in-commutative-monoids public open import linear-algebra.finite-sequences-in-commutative-rings public open import linear-algebra.finite-sequences-in-commutative-semigroups public open import linear-algebra.finite-sequences-in-commutative-semirings public open import linear-algebra.finite-sequences-in-euclidean-domains public +open import linear-algebra.finite-sequences-in-groups public open import linear-algebra.finite-sequences-in-monoids public open import linear-algebra.finite-sequences-in-rings public open import linear-algebra.finite-sequences-in-semigroups public diff --git a/src/linear-algebra/finite-sequences-in-abelian-groups.lagda.md b/src/linear-algebra/finite-sequences-in-abelian-groups.lagda.md new file mode 100644 index 0000000000..6a1ff1dea0 --- /dev/null +++ b/src/linear-algebra/finite-sequences-in-abelian-groups.lagda.md @@ -0,0 +1,158 @@ +# Finite sequences in abelian groups + +```agda +module linear-algebra.finite-sequences-in-abelian-groups where +``` + +
Imports + +```agda +open import elementary-number-theory.natural-numbers + +open import foundation.identity-types +open import foundation.universe-levels + +open import group-theory.abelian-groups +open import group-theory.commutative-monoids +open import group-theory.function-abelian-groups +open import group-theory.groups +open import group-theory.monoids +open import group-theory.semigroups + +open import linear-algebra.finite-sequences-in-monoids + +open import lists.finite-sequences + +open import univalent-combinatorics.standard-finite-types +``` + +
+ +## Idea + +Given an [abelian group](group-theory.abelian-groups.md) `G`, the type +`fin-sequence n G` of [finite sequences](lists.finite-sequences.md) of length +`n` of elements of `G` is a group given by componentwise addition. + +## Definitions + +```agda +module _ + {l : Level} (G : Ab l) + where + + fin-sequence-type-Ab : ℕ → UU l + fin-sequence-type-Ab = fin-sequence (type-Ab G) + + head-fin-sequence-type-Ab : + (n : ℕ) → fin-sequence-type-Ab (succ-ℕ n) → + type-Ab G + head-fin-sequence-type-Ab = + head-fin-sequence-type-Monoid (monoid-Ab G) + + tail-fin-sequence-type-Ab : + (n : ℕ) → fin-sequence-type-Ab (succ-ℕ n) → + fin-sequence-type-Ab n + tail-fin-sequence-type-Ab = + tail-fin-sequence-type-Monoid (monoid-Ab G) + + cons-fin-sequence-type-Ab : + (n : ℕ) → type-Ab G → + fin-sequence-type-Ab n → + fin-sequence-type-Ab (succ-ℕ n) + cons-fin-sequence-type-Ab = + cons-fin-sequence-type-Monoid (monoid-Ab G) + + snoc-fin-sequence-type-Ab : + (n : ℕ) → fin-sequence-type-Ab n → + type-Ab G → fin-sequence-type-Ab (succ-ℕ n) + snoc-fin-sequence-type-Ab = + snoc-fin-sequence-type-Monoid (monoid-Ab G) +``` + +### Zero finite sequences in a group + +```agda +module _ + {l : Level} (G : Ab l) + where + + zero-fin-sequence-type-Ab : + (n : ℕ) → fin-sequence-type-Ab G n + zero-fin-sequence-type-Ab n i = zero-Ab G +``` + +### Negation of finite sequences in a group + +```agda +module _ + {l : Level} (G : Ab l) + where + + neg-fin-sequence-type-Ab : + (n : ℕ) → fin-sequence-type-Ab G n → fin-sequence-type-Ab G n + neg-fin-sequence-type-Ab n = neg-function-Ab G (Fin n) +``` + +### Pointwise addition of finite sequences in a group + +```agda +module _ + {l : Level} (G : Ab l) + where + + add-fin-sequence-type-Ab : + (n : ℕ) (v w : fin-sequence-type-Ab G n) → + fin-sequence-type-Ab G n + add-fin-sequence-type-Ab = + add-fin-sequence-type-Monoid (monoid-Ab G) + + associative-add-fin-sequence-type-Ab : + (n : ℕ) (v1 v2 v3 : fin-sequence-type-Ab G n) → + ( add-fin-sequence-type-Ab n + ( add-fin-sequence-type-Ab n v1 v2) v3) = + ( add-fin-sequence-type-Ab n v1 + ( add-fin-sequence-type-Ab n v2 v3)) + associative-add-fin-sequence-type-Ab = + associative-add-fin-sequence-type-Monoid (monoid-Ab G) + + left-unit-law-add-fin-sequence-type-Ab : + (n : ℕ) (v : fin-sequence-type-Ab G n) → + add-fin-sequence-type-Ab n + ( zero-fin-sequence-type-Ab G n) v = v + left-unit-law-add-fin-sequence-type-Ab = + left-unit-law-add-fin-sequence-type-Monoid (monoid-Ab G) + + right-unit-law-add-fin-sequence-type-Ab : + (n : ℕ) (v : fin-sequence-type-Ab G n) → + add-fin-sequence-type-Ab n v + ( zero-fin-sequence-type-Ab G n) = v + right-unit-law-add-fin-sequence-type-Ab = + right-unit-law-add-fin-sequence-type-Monoid (monoid-Ab G) + + left-inverse-law-add-fin-sequence-type-Ab : + (n : ℕ) (v : fin-sequence-type-Ab G n) → + add-fin-sequence-type-Ab n + ( neg-fin-sequence-type-Ab G n v) + ( v) = + zero-fin-sequence-type-Ab G n + left-inverse-law-add-fin-sequence-type-Ab n = + left-inverse-law-add-function-Ab G (Fin n) + + right-inverse-law-add-fin-sequence-type-Ab : + (n : ℕ) (v : fin-sequence-type-Ab G n) → + add-fin-sequence-type-Ab n + ( v) + ( neg-fin-sequence-type-Ab G n v) = + zero-fin-sequence-type-Ab G n + right-inverse-law-add-fin-sequence-type-Ab n = + right-inverse-law-add-function-Ab G (Fin n) + + commutative-add-fin-sequence-type-Ab : + (n : ℕ) → (v w : fin-sequence-type-Ab G n) → + add-fin-sequence-type-Ab n v w = add-fin-sequence-type-Ab n w v + commutative-add-fin-sequence-type-Ab n = commutative-add-function-Ab G (Fin n) + + ab-fin-sequence-type-Ab : ℕ → Ab l + ab-fin-sequence-type-Ab n = function-Ab G (Fin n) +``` diff --git a/src/linear-algebra/finite-sequences-in-groups.lagda.md b/src/linear-algebra/finite-sequences-in-groups.lagda.md new file mode 100644 index 0000000000..a4ef10f2a6 --- /dev/null +++ b/src/linear-algebra/finite-sequences-in-groups.lagda.md @@ -0,0 +1,151 @@ +# Finite sequences in groups + +```agda +module linear-algebra.finite-sequences-in-groups where +``` + +
Imports + +```agda +open import elementary-number-theory.natural-numbers + +open import foundation.identity-types +open import foundation.universe-levels + +open import group-theory.function-groups +open import group-theory.groups + +open import linear-algebra.finite-sequences-in-monoids + +open import univalent-combinatorics.standard-finite-types +``` + +
+ +## Idea + +Given a [group](group-theory.groups.md) `G`, the type `fin-sequence n G` of +[finite sequences](lists.finite-sequences.md) of length `n` of elements of `G` +is a group given by componentwise addition. + +We use additive terminology for vectors, as is standard in linear algebra +contexts, despite using multiplicative terminology for groups. + +## Definitions + +```agda +module _ + {l : Level} (G : Group l) + where + + fin-sequence-type-Group : ℕ → UU l + fin-sequence-type-Group = + fin-sequence-type-Monoid (monoid-Group G) + + head-fin-sequence-type-Group : + (n : ℕ) → fin-sequence-type-Group (succ-ℕ n) → + type-Group G + head-fin-sequence-type-Group = + head-fin-sequence-type-Monoid (monoid-Group G) + + tail-fin-sequence-type-Group : + (n : ℕ) → fin-sequence-type-Group (succ-ℕ n) → + fin-sequence-type-Group n + tail-fin-sequence-type-Group = + tail-fin-sequence-type-Monoid (monoid-Group G) + + cons-fin-sequence-type-Group : + (n : ℕ) → type-Group G → + fin-sequence-type-Group n → + fin-sequence-type-Group (succ-ℕ n) + cons-fin-sequence-type-Group = + cons-fin-sequence-type-Monoid (monoid-Group G) + + snoc-fin-sequence-type-Group : + (n : ℕ) → fin-sequence-type-Group n → + type-Group G → fin-sequence-type-Group (succ-ℕ n) + snoc-fin-sequence-type-Group = + snoc-fin-sequence-type-Monoid (monoid-Group G) +``` + +### Zero finite sequences in a group + +```agda +module _ + {l : Level} (G : Group l) + where + + zero-fin-sequence-type-Group : + (n : ℕ) → fin-sequence-type-Group G n + zero-fin-sequence-type-Group n i = unit-Group G +``` + +### Negation of finite sequences in a group + +```agda +module _ + {l : Level} (G : Group l) + where + + neg-fin-sequence-type-Group : + (n : ℕ) → fin-sequence-type-Group G n → fin-sequence-type-Group G n + neg-fin-sequence-type-Group n = inv-function-Group G (Fin n) +``` + +### Pointwise addition of finite sequences in a group + +```agda +module _ + {l : Level} (G : Group l) + where + + add-fin-sequence-type-Group : + (n : ℕ) (v w : fin-sequence-type-Group G n) → + fin-sequence-type-Group G n + add-fin-sequence-type-Group = + add-fin-sequence-type-Monoid (monoid-Group G) + + associative-add-fin-sequence-type-Group : + (n : ℕ) (v1 v2 v3 : fin-sequence-type-Group G n) → + ( add-fin-sequence-type-Group n + ( add-fin-sequence-type-Group n v1 v2) v3) = + ( add-fin-sequence-type-Group n v1 + ( add-fin-sequence-type-Group n v2 v3)) + associative-add-fin-sequence-type-Group = + associative-add-fin-sequence-type-Monoid (monoid-Group G) + + left-unit-law-add-fin-sequence-type-Group : + (n : ℕ) (v : fin-sequence-type-Group G n) → + add-fin-sequence-type-Group n + ( zero-fin-sequence-type-Group G n) v = v + left-unit-law-add-fin-sequence-type-Group = + left-unit-law-add-fin-sequence-type-Monoid (monoid-Group G) + + right-unit-law-add-fin-sequence-type-Group : + (n : ℕ) (v : fin-sequence-type-Group G n) → + add-fin-sequence-type-Group n v + ( zero-fin-sequence-type-Group G n) = v + right-unit-law-add-fin-sequence-type-Group = + right-unit-law-add-fin-sequence-type-Monoid (monoid-Group G) + + left-inverse-law-add-fin-sequence-type-Group : + (n : ℕ) (v : fin-sequence-type-Group G n) → + add-fin-sequence-type-Group n + ( neg-fin-sequence-type-Group G n v) + ( v) = + zero-fin-sequence-type-Group G n + left-inverse-law-add-fin-sequence-type-Group n = + left-inverse-law-mul-function-Group G (Fin n) + + right-inverse-law-add-fin-sequence-type-Group : + (n : ℕ) (v : fin-sequence-type-Group G n) → + add-fin-sequence-type-Group n + ( v) + ( neg-fin-sequence-type-Group G n v) = + zero-fin-sequence-type-Group G n + right-inverse-law-add-fin-sequence-type-Group n = + right-inverse-law-mul-function-Group G (Fin n) + + group-fin-sequence-type-Group : ℕ → Group l + group-fin-sequence-type-Group n = function-Group G (Fin n) +``` diff --git a/src/ring-theory/sums-of-finite-families-of-elements-semirings.lagda.md b/src/ring-theory/sums-of-finite-families-of-elements-semirings.lagda.md index 232828273f..7c67519855 100644 --- a/src/ring-theory/sums-of-finite-families-of-elements-semirings.lagda.md +++ b/src/ring-theory/sums-of-finite-families-of-elements-semirings.lagda.md @@ -291,80 +291,9 @@ module _ (f g : type-Finite-Type A → type-Semiring R) → sum-finite-Semiring R A (λ a → add-Semiring R (f a) (g a)) = - add-Semiring R - (sum-finite-Semiring R A f) - (sum-finite-Semiring R A g) - interchange-sum-add-finite-Semiring f g = equational-reasoning - sum-finite-Semiring R A - ( λ a → add-Semiring R (f a) (g a)) - = - sum-finite-Semiring - ( R) - ( A) - ( λ a → sum-fin-sequence-type-Semiring R 2 (h a)) - by - htpy-sum-finite-Semiring - ( R) - ( A) - ( λ a → inv (compute-sum-two-elements-Semiring R (h a))) - = - sum-finite-Semiring - ( R) - ( A) - ( λ a → - sum-finite-Semiring R (Fin-Finite-Type 2) (h a)) - by - htpy-sum-finite-Semiring R A - ( λ a → - inv - ( eq-sum-finite-sum-count-Semiring - ( R) - ( Fin-Finite-Type 2) - ( count-Fin 2) - ( h a))) - = - sum-finite-Semiring - ( R) - ( Σ-Finite-Type A (λ _ → Fin-Finite-Type 2)) - ( ind-Σ h) - by inv (sum-Σ-finite-Semiring R A (λ _ → Fin-Finite-Type 2) h) - = - sum-finite-Semiring - ( R) - ( Σ-Finite-Type (Fin-Finite-Type 2) (λ _ → A)) - ( λ (i , a) → h a i) - by - sum-equiv-finite-Semiring R _ _ - ( commutative-product) - ( ind-Σ h) - = - sum-finite-Semiring - ( R) - ( Fin-Finite-Type 2) - ( λ i → sum-finite-Semiring R A (λ a → h a i)) - by sum-Σ-finite-Semiring R _ _ _ - = - sum-fin-sequence-type-Semiring - ( R) - ( 2) - ( λ i → sum-finite-Semiring R A (λ a → h a i)) - by - eq-sum-finite-sum-count-Semiring - ( R) - ( Fin-Finite-Type 2) - ( count-Fin 2) - ( _) - = - add-Semiring - ( R) - ( sum-finite-Semiring R A f) - ( sum-finite-Semiring R A g) - by - compute-sum-two-elements-Semiring - ( R) - ( λ i → sum-finite-Semiring R A (λ a → h a i)) - where - h : type-Finite-Type A → Fin 2 → type-Semiring R - h a (inl (inr _)) = f a - h a (inr _) = g a + add-Semiring R (sum-finite-Semiring R A f) (sum-finite-Semiring R A g) + interchange-sum-add-finite-Semiring = + interchange-sum-mul-finite-Commutative-Monoid + ( additive-commutative-monoid-Semiring R) + ( A) ``` From dddf41ade7acfbb8aacb8a49f174dfe2a828b85a Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 3 Sep 2025 20:15:13 +0200 Subject: [PATCH 45/97] Axe `pasting-vertical-coherence-cube-maps` (#1526) #1525 --- src/foundation/commuting-cubes-of-maps.lagda.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/foundation/commuting-cubes-of-maps.lagda.md b/src/foundation/commuting-cubes-of-maps.lagda.md index 0309bafe4b..ad8d6aa51f 100644 --- a/src/foundation/commuting-cubes-of-maps.lagda.md +++ b/src/foundation/commuting-cubes-of-maps.lagda.md @@ -321,7 +321,10 @@ expect to be able to construct a coherence ### Vertical pasting of commuting cubes -```agda +> The following Agda code is not checked due to bad performance. +> [#1525](https://github.com/UniMath/agda-unimath/issues/1525) + +```text module _ {l1 l2 l3 l4 l1' l2' l3' l4' l1'' l2'' l3'' l4'' : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} From fd0e91589d8c626397a203e060a9b186ef22167d Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Wed, 3 Sep 2025 13:25:21 -0700 Subject: [PATCH 46/97] Maximum and minimum of finitely enumerable subsets of the real numbers (#1523) Depends on #1522. The next step in breaking up #1510. --- src/foundation/images-subtypes.lagda.md | 31 ++ src/foundation/subtypes.lagda.md | 33 ++ src/real-numbers.lagda.md | 3 + ...y-enumerable-subsets-real-numbers.lagda.md | 84 +++++ .../infima-families-real-numbers.lagda.md | 61 ++++ ...y-enumerable-subsets-real-numbers.lagda.md | 288 ++++++++++++++++++ ...y-enumerable-subsets-real-numbers.lagda.md | 157 ++++++++++ .../subsets-real-numbers.lagda.md | 105 +++++++ .../suprema-families-real-numbers.lagda.md | 11 + .../finitely-enumerable-types.lagda.md | 6 + 10 files changed, 779 insertions(+) create mode 100644 src/real-numbers/finitely-enumerable-subsets-real-numbers.lagda.md create mode 100644 src/real-numbers/maximum-finitely-enumerable-subsets-real-numbers.lagda.md create mode 100644 src/real-numbers/minimum-finitely-enumerable-subsets-real-numbers.lagda.md diff --git a/src/foundation/images-subtypes.lagda.md b/src/foundation/images-subtypes.lagda.md index 47f77402b1..a635725dc4 100644 --- a/src/foundation/images-subtypes.lagda.md +++ b/src/foundation/images-subtypes.lagda.md @@ -7,15 +7,19 @@ module foundation.images-subtypes where
Imports ```agda +open import foundation.action-on-identifications-functions open import foundation.dependent-pair-types +open import foundation.existential-quantification open import foundation.full-subtypes open import foundation.functoriality-propositional-truncation open import foundation.images open import foundation.logical-equivalences open import foundation.powersets open import foundation.propositional-truncations +open import foundation.propositions open import foundation.pullbacks-subtypes open import foundation.subtypes +open import foundation.transport-along-identifications open import foundation.type-arithmetic-dependent-pair-types open import foundation.universe-levels @@ -23,6 +27,7 @@ open import foundation-core.contractible-maps open import foundation-core.equivalences open import foundation-core.fibers-of-maps open import foundation-core.function-types +open import foundation-core.functoriality-dependent-pair-types open import foundation-core.identity-types open import order-theory.galois-connections-large-posets @@ -270,3 +275,29 @@ module _ ( compute-im-full-subtype f) ( x) ``` + +### The image of a subtype under an equivalence has the same elements as the subtype precomposed with the inverse equivalence + +```agda +module _ + {l1 l2 l3 : Level} {X : UU l1} {Y : UU l2} (e : X ≃ Y) (S : subtype l3 X) + where + + abstract + has-same-elements-im-subtype-equiv-precomp-inv-equiv : + has-same-elements-subtype + ( im-subtype (map-equiv e) S) + ( S ∘ map-inv-equiv e) + pr1 (has-same-elements-im-subtype-equiv-precomp-inv-equiv y) = + rec-trunc-Prop + ( S (map-inv-equiv e y)) + ( λ ((x , x∈S) , fx=y) → + inv-tr + ( type-Prop ∘ S) + ( ap (map-inv-equiv e) (inv fx=y) ∙ is-retraction-map-inv-equiv e x) + ( x∈S)) + pr2 (has-same-elements-im-subtype-equiv-precomp-inv-equiv y) e⁻¹y∈S = + intro-exists + ( map-inv-equiv e y , e⁻¹y∈S) + ( is-section-map-inv-equiv e y) +``` diff --git a/src/foundation/subtypes.lagda.md b/src/foundation/subtypes.lagda.md index 776428bd96..1e1056e561 100644 --- a/src/foundation/subtypes.lagda.md +++ b/src/foundation/subtypes.lagda.md @@ -9,6 +9,7 @@ open import foundation-core.subtypes public
Imports ```agda +open import foundation.action-on-identifications-functions open import foundation.dependent-pair-types open import foundation.embeddings open import foundation.equality-dependent-function-types @@ -20,6 +21,7 @@ open import foundation.universe-levels open import foundation-core.cartesian-product-types open import foundation-core.equivalences open import foundation-core.function-types +open import foundation-core.functoriality-dependent-pair-types open import foundation-core.homotopies open import foundation-core.identity-types open import foundation-core.injective-maps @@ -28,6 +30,7 @@ open import foundation-core.retractions open import foundation-core.sections open import foundation-core.sets open import foundation-core.torsorial-type-families +open import foundation-core.univalence ```
@@ -114,6 +117,36 @@ module _ map-inv-equiv (extensionality-subtype Q) ``` +### Subtypes with the same elements are equivalent + +```agda +module _ + {l1 l2 l3 : Level} {X : UU l1} (S : subtype l2 X) (T : subtype l3 X) + where + + equiv-has-same-elements-type-subtype : + has-same-elements-subtype S T → type-subtype S ≃ type-subtype T + equiv-has-same-elements-type-subtype H = + equiv-tot (λ x → equiv-iff' (S x) (T x) (H x)) +``` + +### A subtype `S` is equivalent to `S` precomposed with an equivalence + +```agda +module _ + {l1 l2 l3 : Level} {X : UU l1} {Y : UU l2} (e : X ≃ Y) (S : subtype l3 Y) + where + + equiv-precomp-equiv-type-subtype : + type-subtype S ≃ type-subtype (S ∘ map-equiv e) + equiv-precomp-equiv-type-subtype = + equiv-Σ + ( λ x → type-Prop ((S ∘ map-equiv e) x)) + ( inv-equiv e) + ( λ y → + equiv-eq (ap (type-Prop ∘ S) (inv (is-section-map-inv-equiv e y)))) +``` + ### The containment relation is antisymmetric ```agda diff --git a/src/real-numbers.lagda.md b/src/real-numbers.lagda.md index a8f4ee2974..645c8c35ce 100644 --- a/src/real-numbers.lagda.md +++ b/src/real-numbers.lagda.md @@ -17,6 +17,7 @@ open import real-numbers.cauchy-completeness-dedekind-real-numbers public open import real-numbers.dedekind-real-numbers public open import real-numbers.difference-real-numbers public open import real-numbers.distance-real-numbers public +open import real-numbers.finitely-enumerable-subsets-real-numbers public open import real-numbers.inequality-lower-dedekind-real-numbers public open import real-numbers.inequality-real-numbers public open import real-numbers.inequality-upper-dedekind-real-numbers public @@ -25,10 +26,12 @@ open import real-numbers.isometry-addition-real-numbers public open import real-numbers.isometry-negation-real-numbers public open import real-numbers.lower-dedekind-real-numbers public open import real-numbers.maximum-finite-families-real-numbers public +open import real-numbers.maximum-finitely-enumerable-subsets-real-numbers public open import real-numbers.maximum-lower-dedekind-real-numbers public open import real-numbers.maximum-upper-dedekind-real-numbers public open import real-numbers.metric-space-of-real-numbers public open import real-numbers.minimum-finite-families-real-numbers public +open import real-numbers.minimum-finitely-enumerable-subsets-real-numbers public open import real-numbers.minimum-lower-dedekind-real-numbers public open import real-numbers.minimum-upper-dedekind-real-numbers public open import real-numbers.negation-lower-upper-dedekind-real-numbers public diff --git a/src/real-numbers/finitely-enumerable-subsets-real-numbers.lagda.md b/src/real-numbers/finitely-enumerable-subsets-real-numbers.lagda.md new file mode 100644 index 0000000000..bda23e1af7 --- /dev/null +++ b/src/real-numbers/finitely-enumerable-subsets-real-numbers.lagda.md @@ -0,0 +1,84 @@ +# Finitely enumerable subsets of the real numbers + +```agda +module real-numbers.finitely-enumerable-subsets-real-numbers where +``` + +
Imports + +```agda +open import foundation.dependent-pair-types +open import foundation.involutions +open import foundation.subtypes +open import foundation.universe-levels + +open import real-numbers.dedekind-real-numbers +open import real-numbers.negation-real-numbers +open import real-numbers.subsets-real-numbers + +open import univalent-combinatorics.finitely-enumerable-subtypes +open import univalent-combinatorics.finitely-enumerable-types +``` + +
+ +## Idea + +A [subset of the real numbers](real-numbers.subsets-real-numbers.md) is +{{#concept "finitely enumerable" disambiguation="subset of the real numbers" Agda=finitely-enumerable-subset-ℝ}} +if it is +[finitely enumerable](univalent-combinatorics.finitely-enumerable-subtypes.md) +as a [subtype](foundation.subtypes.md) of the +[real numbers](real-numbers.dedekind-real-numbers.md). + +## Definition + +```agda +finitely-enumerable-subset-ℝ : (l1 l2 : Level) → UU (lsuc l1 ⊔ lsuc l2) +finitely-enumerable-subset-ℝ l1 l2 = finitely-enumerable-subtype l1 (ℝ l2) + +module _ + {l1 l2 : Level} (S : finitely-enumerable-subset-ℝ l1 l2) + where + + subset-finitely-enumerable-subset-ℝ : subset-ℝ l1 l2 + subset-finitely-enumerable-subset-ℝ = subtype-finitely-enumerable-subtype S + + type-finitely-enumerable-subset-ℝ : UU (l1 ⊔ lsuc l2) + type-finitely-enumerable-subset-ℝ = + type-subtype subset-finitely-enumerable-subset-ℝ + + is-finitely-enumerable-finitely-enumerable-subset-ℝ : + is-finitely-enumerable-subtype subset-finitely-enumerable-subset-ℝ + is-finitely-enumerable-finitely-enumerable-subset-ℝ = + is-finitely-enumerable-subtype-finitely-enumerable-subtype S + + inclusion-finitely-enumerable-subset-ℝ : + type-finitely-enumerable-subset-ℝ → ℝ l2 + inclusion-finitely-enumerable-subset-ℝ = + inclusion-subtype subset-finitely-enumerable-subset-ℝ +``` + +## Properties + +### The property of being inhabited + +```agda +is-inhabited-finitely-enumerable-subset-ℝ : + {l1 l2 : Level} → finitely-enumerable-subset-ℝ l1 l2 → UU (l1 ⊔ lsuc l2) +is-inhabited-finitely-enumerable-subset-ℝ = + is-inhabited-finitely-enumerable-subtype +``` + +### The elementwise negation of a finitely enumerable subset of real numbers + +```agda +neg-finitely-enumerable-subset-ℝ : + {l1 l2 : Level} → + finitely-enumerable-subset-ℝ l1 l2 → finitely-enumerable-subset-ℝ l1 l2 +neg-finitely-enumerable-subset-ℝ (S , is-finitely-enumerable-S) = + ( neg-subset-ℝ S , + is-finitely-enumerable-equiv + ( equiv-precomp-equiv-type-subtype (equiv-is-involution neg-neg-ℝ) S) + ( is-finitely-enumerable-S)) +``` diff --git a/src/real-numbers/infima-families-real-numbers.lagda.md b/src/real-numbers/infima-families-real-numbers.lagda.md index 0ec15333da..99ec413aff 100644 --- a/src/real-numbers/infima-families-real-numbers.lagda.md +++ b/src/real-numbers/infima-families-real-numbers.lagda.md @@ -198,6 +198,17 @@ module _ has-infimum-prop-family-ℝ : Prop (l1 ⊔ l2 ⊔ lsuc l3) has-infimum-prop-family-ℝ = ( has-infimum-family-ℝ , is-prop-has-infimum-family-ℝ) + +module _ + {l1 l2 : Level} (S : subset-ℝ l1 l2) (l3 : Level) + where + + has-infimum-prop-subset-ℝ : Prop (l1 ⊔ lsuc l2 ⊔ lsuc l3) + has-infimum-prop-subset-ℝ = + has-infimum-prop-family-ℝ (inclusion-subset-ℝ S) l3 + + has-infimum-subset-ℝ : UU (l1 ⊔ lsuc l2 ⊔ lsuc l3) + has-infimum-subset-ℝ = type-Prop has-infimum-prop-subset-ℝ ``` ### A real number `r` is greater than the infimum of the `yᵢ` if and only if it is greater than some `yᵢ` @@ -325,6 +336,56 @@ module _ is-approximated-below-neg-infimum-neg-family-ℝ) ``` +### The infimum of a subset of the real numbers is the negation of the supremum of the elementwise negation of the subset + +```agda +module _ + {l1 l2 l3 : Level} (S : subset-ℝ l1 l2) (x : ℝ l3) + (is-sup-neg-S-x : is-supremum-subset-ℝ (neg-subset-ℝ S) x) + where + + abstract + is-lower-bound-neg-supremum-neg-subset-ℝ : + is-lower-bound-family-of-elements-Large-Poset + ( ℝ-Large-Poset) + ( inclusion-subset-ℝ S) + ( neg-ℝ x) + is-lower-bound-neg-supremum-neg-subset-ℝ (s , s∈S) = + tr + ( leq-ℝ (neg-ℝ x)) + ( neg-neg-ℝ s) + ( neg-leq-ℝ _ _ + ( is-upper-bound-is-supremum-family-ℝ + ( inclusion-subset-ℝ (neg-subset-ℝ S)) + ( x) + ( is-sup-neg-S-x) + ( neg-ℝ s , inv-tr (is-in-subtype S) (neg-neg-ℝ s) s∈S))) + + is-approximated-above-neg-supremum-neg-subset-ℝ : + is-approximated-above-family-ℝ (inclusion-subset-ℝ S) (neg-ℝ x) + is-approximated-above-neg-supremum-neg-subset-ℝ ε = + let open do-syntax-trunc-Prop (∃ _ _) + in do + ((s , -s∈S) , x-εImports + +```agda +open import elementary-number-theory.natural-numbers + +open import foundation.dependent-pair-types +open import foundation.empty-types +open import foundation.function-types +open import foundation.identity-types +open import foundation.inhabited-subtypes +open import foundation.propositional-truncations +open import foundation.surjective-maps +open import foundation.transport-along-identifications +open import foundation.universe-levels + +open import logic.functoriality-existential-quantification + +open import order-theory.least-upper-bounds-large-posets +open import order-theory.upper-bounds-large-posets + +open import real-numbers.dedekind-real-numbers +open import real-numbers.finitely-enumerable-subsets-real-numbers +open import real-numbers.inequality-real-numbers +open import real-numbers.maximum-finite-families-real-numbers +open import real-numbers.subsets-real-numbers +open import real-numbers.suprema-families-real-numbers + +open import univalent-combinatorics.finitely-enumerable-subtypes +open import univalent-combinatorics.finitely-enumerable-types +``` + +
+ +## Idea + +The +{{#concept "maximum" Disambiguation="finitely enumerable subset of Dedekind real numbers" Agda=max-inhabited-finitely-enumerable-subset-ℝ WD="maximum" WDID=Q10578722}} +of a +[finitely enumerable subset of the real numbers](real-numbers.finitely-enumerable-subsets-real-numbers.md) +is their [supremum](real-numbers.suprema-families-real-numbers.md). + +## Subsets with finite enumerations + +### Definition + +```agda +opaque + max-is-inhabited-finite-enumeration-subset-ℝ : + {l1 l2 : Level} → (S : subset-ℝ l1 l2) → + finite-enumeration-subtype S → is-inhabited-subtype S → + ℝ l2 + max-is-inhabited-finite-enumeration-subset-ℝ S eS@(zero-ℕ , _) |S| = + ex-falso + ( is-nonempty-is-inhabited + ( |S|) + ( is-empty-is-zero-finite-enumeration + ( eS) + ( refl))) + max-is-inhabited-finite-enumeration-subset-ℝ + S eS@(succ-ℕ n , Fin-sn↠S) |S| = + max-fin-sequence-ℝ n (inclusion-subset-ℝ S ∘ map-surjection Fin-sn↠S) +``` + +### Properties + +#### The maximum is an upper bound + +```agda +opaque + unfolding max-is-inhabited-finite-enumeration-subset-ℝ + + is-upper-bound-max-is-inhabited-finite-enumeration-subset-ℝ : + {l1 l2 : Level} → (S : subset-ℝ l1 l2) → + (eS : finite-enumeration-subtype S) (|S| : is-inhabited-subtype S) → + is-upper-bound-family-of-elements-Large-Poset + ( ℝ-Large-Poset) + ( inclusion-subset-ℝ S) + ( max-is-inhabited-finite-enumeration-subset-ℝ S eS |S|) + is-upper-bound-max-is-inhabited-finite-enumeration-subset-ℝ + S eS@(zero-ℕ , _) |S| = + ex-falso + ( is-nonempty-is-inhabited + ( |S|) + ( is-empty-is-zero-finite-enumeration + ( eS) + ( refl))) + is-upper-bound-max-is-inhabited-finite-enumeration-subset-ℝ + S eS@(succ-ℕ n , Fin-sn↠S) |S| (s , s∈S) = + let + open + do-syntax-trunc-Prop + ( leq-prop-ℝ + ( s) + ( max-is-inhabited-finite-enumeration-subset-ℝ S eS |S|)) + in do + (i , fi=s) ← is-surjective-map-surjection Fin-sn↠S (s , s∈S) + tr + ( λ x → + leq-ℝ + ( inclusion-subset-ℝ S x) + ( max-is-inhabited-finite-enumeration-subset-ℝ S eS |S|)) + ( fi=s) + ( is-upper-bound-max-fin-sequence-ℝ + ( n) + ( inclusion-subset-ℝ S ∘ map-surjection Fin-sn↠S) + ( i)) +``` + +#### The maximum is approximated below + +```agda +opaque + unfolding max-is-inhabited-finite-enumeration-subset-ℝ + + is-approximated-below-max-is-inhabited-finite-enumeration-subset-ℝ : + {l1 l2 : Level} → (S : subset-ℝ l1 l2) → + (eS : finite-enumeration-subtype S) (|S| : is-inhabited-subtype S) → + is-approximated-below-family-ℝ + ( inclusion-subset-ℝ S) + ( max-is-inhabited-finite-enumeration-subset-ℝ S eS |S|) + is-approximated-below-max-is-inhabited-finite-enumeration-subset-ℝ + S eS@(zero-ℕ , _) |S| _ = + ex-falso + ( is-nonempty-is-inhabited + ( |S|) + ( is-empty-is-zero-finite-enumeration + ( eS) + ( refl))) + is-approximated-below-max-is-inhabited-finite-enumeration-subset-ℝ + S (succ-ℕ n , Fin-sn↠S) |S| ε = + map-exists _ + ( map-surjection Fin-sn↠S) + ( λ _ → id) + ( is-approximated-below-max-fin-sequence-ℝ + ( n) + ( inclusion-subset-ℝ S ∘ map-surjection Fin-sn↠S) + ( ε)) +``` + +#### The maximum is a supremum + +```agda +abstract + is-supremum-max-is-inhabited-finite-enumeration-subset-ℝ : + {l1 l2 : Level} → (S : subset-ℝ l1 l2) → + (eS : finite-enumeration-subtype S) (|S| : is-inhabited-subtype S) → + is-supremum-subset-ℝ + ( S) + ( max-is-inhabited-finite-enumeration-subset-ℝ S eS |S|) + is-supremum-max-is-inhabited-finite-enumeration-subset-ℝ S eS |S| = + ( is-upper-bound-max-is-inhabited-finite-enumeration-subset-ℝ S eS |S| , + is-approximated-below-max-is-inhabited-finite-enumeration-subset-ℝ + ( S) + ( eS) + ( |S|)) +``` + +#### Inhabited subsets of ℝ with finite enumerations have a supremum + +```agda +has-supremum-is-inhabited-finite-enumeration-subset-ℝ : + {l1 l2 : Level} → (S : subset-ℝ l1 l2) → + (eS : finite-enumeration-subtype S) (|S| : is-inhabited-subtype S) → + has-supremum-subset-ℝ S l2 +has-supremum-is-inhabited-finite-enumeration-subset-ℝ S eS |S| = + ( max-is-inhabited-finite-enumeration-subset-ℝ S eS |S| , + is-supremum-max-is-inhabited-finite-enumeration-subset-ℝ S eS |S|) +``` + +## Finitely enumerable subsets of ℝ + +### Definition + +```agda +module _ + {l1 l2 : Level} (S : finitely-enumerable-subset-ℝ l1 l2) + (|S| : is-inhabited-finitely-enumerable-subset-ℝ S) + where + + abstract + has-supremum-inhabited-finitely-enumerable-subset-ℝ : + has-supremum-subset-ℝ (subset-finitely-enumerable-subset-ℝ S) l2 + has-supremum-inhabited-finitely-enumerable-subset-ℝ = + rec-trunc-Prop + ( has-supremum-prop-subset-ℝ (subset-finitely-enumerable-subset-ℝ S) l2) + ( λ eS → + has-supremum-is-inhabited-finite-enumeration-subset-ℝ + ( subset-finitely-enumerable-subset-ℝ S) + ( eS) + ( |S|)) + ( is-finitely-enumerable-finitely-enumerable-subset-ℝ S) + + opaque + max-inhabited-finitely-enumerable-subset-ℝ : ℝ l2 + max-inhabited-finitely-enumerable-subset-ℝ = + pr1 has-supremum-inhabited-finitely-enumerable-subset-ℝ +``` + +### Properties + +#### The maximum is a supremum + +```agda +module _ + {l1 l2 : Level} (S : finitely-enumerable-subset-ℝ l1 l2) + (|S| : is-inhabited-finitely-enumerable-subset-ℝ S) + where + + opaque + unfolding max-inhabited-finitely-enumerable-subset-ℝ + + is-supremum-max-inhabited-finitely-enumerable-subset-ℝ : + is-supremum-subset-ℝ + ( subset-finitely-enumerable-subset-ℝ S) + ( max-inhabited-finitely-enumerable-subset-ℝ S |S|) + is-supremum-max-inhabited-finitely-enumerable-subset-ℝ = + pr2 (has-supremum-inhabited-finitely-enumerable-subset-ℝ S |S|) +``` + +#### The maximum is a least upper bound + +```agda +module _ + {l1 l2 : Level} (S : finitely-enumerable-subset-ℝ l1 l2) + (|S| : is-inhabited-finitely-enumerable-subset-ℝ S) + where + + abstract + is-least-upper-bound-max-inhabited-finitely-enumerable-subset-ℝ : + is-least-upper-bound-family-of-elements-Large-Poset + ( ℝ-Large-Poset) + ( inclusion-finitely-enumerable-subset-ℝ S) + ( max-inhabited-finitely-enumerable-subset-ℝ S |S|) + is-least-upper-bound-max-inhabited-finitely-enumerable-subset-ℝ = + is-least-upper-bound-is-supremum-family-ℝ + ( inclusion-finitely-enumerable-subset-ℝ S) + ( max-inhabited-finitely-enumerable-subset-ℝ S |S|) + ( is-supremum-max-inhabited-finitely-enumerable-subset-ℝ S |S|) +``` + +#### The maximum is approximated below + +```agda +module _ + {l1 l2 : Level} (S : finitely-enumerable-subset-ℝ l1 l2) + (|S| : is-inhabited-finitely-enumerable-subset-ℝ S) + where + + abstract + is-approximated-below-max-inhabited-finitely-enumerable-subset-ℝ : + is-approximated-below-family-ℝ + ( inclusion-finitely-enumerable-subset-ℝ S) + ( max-inhabited-finitely-enumerable-subset-ℝ S |S|) + is-approximated-below-max-inhabited-finitely-enumerable-subset-ℝ = + is-approximated-below-is-supremum-family-ℝ + ( inclusion-finitely-enumerable-subset-ℝ S) + ( max-inhabited-finitely-enumerable-subset-ℝ S |S|) + ( is-supremum-max-inhabited-finitely-enumerable-subset-ℝ S |S|) +``` + +#### The maximum is an upper bound + +```agda +module _ + {l1 l2 : Level} (S : finitely-enumerable-subset-ℝ l1 l2) + (|S| : is-inhabited-finitely-enumerable-subset-ℝ S) + where + + abstract + is-upper-bound-max-inhabited-finitely-enumerable-subset-ℝ : + is-upper-bound-family-of-elements-Large-Poset + ( ℝ-Large-Poset) + ( inclusion-finitely-enumerable-subset-ℝ S) + ( max-inhabited-finitely-enumerable-subset-ℝ S |S|) + is-upper-bound-max-inhabited-finitely-enumerable-subset-ℝ = + is-upper-bound-is-supremum-family-ℝ + ( inclusion-finitely-enumerable-subset-ℝ S) + ( max-inhabited-finitely-enumerable-subset-ℝ S |S|) + ( is-supremum-max-inhabited-finitely-enumerable-subset-ℝ S |S|) +``` diff --git a/src/real-numbers/minimum-finitely-enumerable-subsets-real-numbers.lagda.md b/src/real-numbers/minimum-finitely-enumerable-subsets-real-numbers.lagda.md new file mode 100644 index 0000000000..7bd34bca18 --- /dev/null +++ b/src/real-numbers/minimum-finitely-enumerable-subsets-real-numbers.lagda.md @@ -0,0 +1,157 @@ +# The minimum of finitely enumerable subsets of real numbers + +```agda +{-# OPTIONS --lossy-unification #-} + +module real-numbers.minimum-finitely-enumerable-subsets-real-numbers where +``` + +
Imports + +```agda +open import foundation.dependent-pair-types +open import foundation.universe-levels + +open import order-theory.greatest-lower-bounds-large-posets +open import order-theory.lower-bounds-large-posets + +open import real-numbers.dedekind-real-numbers +open import real-numbers.finitely-enumerable-subsets-real-numbers +open import real-numbers.inequality-real-numbers +open import real-numbers.infima-families-real-numbers +open import real-numbers.maximum-finitely-enumerable-subsets-real-numbers +open import real-numbers.negation-real-numbers +open import real-numbers.subsets-real-numbers + +open import univalent-combinatorics.finitely-enumerable-subtypes +``` + +
+ +## Idea + +The +{{#concept "minimum" Disambiguation="finitely enumerable subset of Dedekind real numbers" Agda=min-inhabited-finitely-enumerable-subset-ℝ WD="minimum" WDID=Q10585806}} +of a +[finitely enumerable subset of the real numbers](real-numbers.finitely-enumerable-subsets-real-numbers.md) +is their [infimum](real-numbers.infima-families-real-numbers.md). + +## Definition + +```agda +module _ + {l1 l2 : Level} (S : finitely-enumerable-subset-ℝ l1 l2) + (|S| : is-inhabited-finitely-enumerable-subset-ℝ S) + where + + opaque + min-inhabited-finitely-enumerable-subset-ℝ : ℝ l2 + min-inhabited-finitely-enumerable-subset-ℝ = + neg-ℝ + ( max-inhabited-finitely-enumerable-subset-ℝ + ( neg-finitely-enumerable-subset-ℝ S) + ( neg-is-inhabited-subset-ℝ + ( subset-finitely-enumerable-subset-ℝ S) + ( |S|))) +``` + +## Properties + +### The minimum is the infimum + +```agda +module _ + {l1 l2 : Level} (S : finitely-enumerable-subset-ℝ l1 l2) + (|S| : is-inhabited-finitely-enumerable-subset-ℝ S) + where + + opaque + unfolding min-inhabited-finitely-enumerable-subset-ℝ + + is-infimum-min-inhabited-finitely-enumerable-subset-ℝ : + is-infimum-subset-ℝ + ( subset-finitely-enumerable-subset-ℝ S) + ( min-inhabited-finitely-enumerable-subset-ℝ S |S|) + is-infimum-min-inhabited-finitely-enumerable-subset-ℝ = + is-infimum-neg-supremum-neg-subset-ℝ + ( subset-finitely-enumerable-subset-ℝ S) + ( max-inhabited-finitely-enumerable-subset-ℝ _ _) + ( is-supremum-max-inhabited-finitely-enumerable-subset-ℝ _ _) +``` + +### Finitely enumerable subsets of the real numbers have an infimum + +```agda +module _ + {l1 l2 : Level} (S : finitely-enumerable-subset-ℝ l1 l2) + (|S| : is-inhabited-finitely-enumerable-subset-ℝ S) + where + + has-infimum-inhabited-finitely-enumerable-subset-ℝ : + has-infimum-subset-ℝ (subset-finitely-enumerable-subset-ℝ S) l2 + has-infimum-inhabited-finitely-enumerable-subset-ℝ = + ( min-inhabited-finitely-enumerable-subset-ℝ S |S| , + is-infimum-min-inhabited-finitely-enumerable-subset-ℝ S |S|) +``` + +### The minimum is the greatest lower bound + +```agda +module _ + {l1 l2 : Level} (S : finitely-enumerable-subset-ℝ l1 l2) + (|S| : is-inhabited-finitely-enumerable-subset-ℝ S) + where + + abstract + is-greatest-lower-bound-min-inhabited-finitely-enumerable-subset-ℝ : + is-greatest-lower-bound-family-of-elements-Large-Poset + ( ℝ-Large-Poset) + ( inclusion-finitely-enumerable-subset-ℝ S) + ( min-inhabited-finitely-enumerable-subset-ℝ S |S|) + is-greatest-lower-bound-min-inhabited-finitely-enumerable-subset-ℝ = + is-greatest-lower-bound-is-infimum-family-ℝ + ( inclusion-finitely-enumerable-subset-ℝ S) + ( min-inhabited-finitely-enumerable-subset-ℝ S |S|) + ( is-infimum-min-inhabited-finitely-enumerable-subset-ℝ S |S|) +``` + +### The minimum is a lower bound + +```agda +module _ + {l1 l2 : Level} (S : finitely-enumerable-subset-ℝ l1 l2) + (|S| : is-inhabited-finitely-enumerable-subset-ℝ S) + where + + abstract + is-lower-bound-min-inhabited-finitely-enumerable-subset-ℝ : + is-lower-bound-family-of-elements-Large-Poset + ( ℝ-Large-Poset) + ( inclusion-finitely-enumerable-subset-ℝ S) + ( min-inhabited-finitely-enumerable-subset-ℝ S |S|) + is-lower-bound-min-inhabited-finitely-enumerable-subset-ℝ = + is-lower-bound-is-infimum-family-ℝ + ( inclusion-finitely-enumerable-subset-ℝ S) + ( min-inhabited-finitely-enumerable-subset-ℝ S |S|) + ( is-infimum-min-inhabited-finitely-enumerable-subset-ℝ S |S|) +``` + +### The minimum is approximated above + +```agda +module _ + {l1 l2 : Level} (S : finitely-enumerable-subset-ℝ l1 l2) + (|S| : is-inhabited-finitely-enumerable-subset-ℝ S) + where + + abstract + is-approximated-above-min-inhabited-finitely-enumerable-subset-ℝ : + is-approximated-above-family-ℝ + ( inclusion-finitely-enumerable-subset-ℝ S) + ( min-inhabited-finitely-enumerable-subset-ℝ S |S|) + is-approximated-above-min-inhabited-finitely-enumerable-subset-ℝ = + is-approximated-above-is-infimum-family-ℝ + ( inclusion-finitely-enumerable-subset-ℝ S) + ( min-inhabited-finitely-enumerable-subset-ℝ S |S|) + ( is-infimum-min-inhabited-finitely-enumerable-subset-ℝ S |S|) +``` diff --git a/src/real-numbers/subsets-real-numbers.lagda.md b/src/real-numbers/subsets-real-numbers.lagda.md index 52672539bf..b83bc66f44 100644 --- a/src/real-numbers/subsets-real-numbers.lagda.md +++ b/src/real-numbers/subsets-real-numbers.lagda.md @@ -7,12 +7,34 @@ module real-numbers.subsets-real-numbers where
Imports ```agda +open import foundation.action-on-identifications-functions +open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.function-extensionality +open import foundation.function-types +open import foundation.identity-types open import foundation.images-subtypes +open import foundation.inhabited-subtypes +open import foundation.inhabited-types +open import foundation.involutions +open import foundation.logical-equivalences open import foundation.sets open import foundation.subtypes +open import foundation.transport-along-identifications open import foundation.universe-levels +open import logic.functoriality-existential-quantification + +open import metric-spaces.equality-of-metric-spaces +open import metric-spaces.images-isometries-metric-spaces +open import metric-spaces.isometries-metric-spaces +open import metric-spaces.metric-spaces +open import metric-spaces.subspaces-metric-spaces + open import real-numbers.dedekind-real-numbers +open import real-numbers.isometry-negation-real-numbers +open import real-numbers.metric-space-of-real-numbers +open import real-numbers.negation-real-numbers ```
@@ -35,6 +57,9 @@ type-subset-ℝ = type-subtype inclusion-subset-ℝ : {l1 l2 : Level} → (S : subset-ℝ l1 l2) → type-subset-ℝ S → ℝ l2 inclusion-subset-ℝ = inclusion-subtype + +is-inhabited-subset-ℝ : {l1 l2 : Level} → subset-ℝ l1 l2 → UU (l1 ⊔ lsuc l2) +is-inhabited-subset-ℝ = is-inhabited-subtype ``` ## Properties @@ -47,3 +72,83 @@ abstract {l1 l2 : Level} → (S : subset-ℝ l1 l2) → is-set (type-subset-ℝ S) is-set-subset-ℝ S = is-set-type-subtype S (is-set-type-Set (ℝ-Set _)) ``` + +### The metric space associated with a subset of the real numbers + +```agda +metric-space-subset-ℝ : + {l1 l2 : Level} → subset-ℝ l1 l2 → Metric-Space (l1 ⊔ lsuc l2) l2 +metric-space-subset-ℝ {l1} {l2} = subspace-Metric-Space (metric-space-ℝ l2) +``` + +### The elementwise negation of a subset of real numbers + +```agda +neg-subset-ℝ : {l1 l2 : Level} → subset-ℝ l1 l2 → subset-ℝ l1 l2 +neg-subset-ℝ S = S ∘ neg-ℝ +``` + +### If a subset of real numbers is inhabited, so is its elementwise negation + +```agda +abstract + neg-is-inhabited-subset-ℝ : + {l1 l2 : Level} → (S : subset-ℝ l1 l2) → is-inhabited-subset-ℝ S → + is-inhabited-subset-ℝ (neg-subset-ℝ S) + neg-is-inhabited-subset-ℝ S = + map-is-inhabited + ( map-equiv + ( equiv-precomp-equiv-type-subtype (equiv-is-involution neg-neg-ℝ) S)) +``` + +### The elementwise negation of the elementwise negation of a subset of real numbers is the original subset + +```agda +abstract + neg-neg-subset-ℝ : + {l1 l2 : Level} → (S : subset-ℝ l1 l2) → neg-subset-ℝ (neg-subset-ℝ S) = S + neg-neg-subset-ℝ S = eq-htpy (λ x → ap S (neg-neg-ℝ x)) +``` + +### The elementwise negation of a subset of real numbers is isometrically equivalent to the image of the subset under elementwise negation + +```agda +module _ + {l1 l2 : Level} (S : subset-ℝ l1 l2) + where + + equiv-isometric-equiv-neg-subset-im-neg-subset-ℝ : + type-im-subtype neg-ℝ S ≃ + type-subtype (neg-subset-ℝ S) + equiv-isometric-equiv-neg-subset-im-neg-subset-ℝ = + equiv-has-same-elements-type-subtype + ( im-subtype neg-ℝ S) + ( neg-subset-ℝ S) + ( has-same-elements-im-subtype-equiv-precomp-inv-equiv + ( equiv-is-involution neg-neg-ℝ) + ( S)) + + is-isometry-map-equiv-isometric-equiv-neg-subset-im-neg-subset-ℝ : + is-isometry-Metric-Space + ( metric-space-subset-ℝ (im-subtype neg-ℝ S)) + ( metric-space-subset-ℝ (neg-subset-ℝ S)) + ( map-equiv equiv-isometric-equiv-neg-subset-im-neg-subset-ℝ) + is-isometry-map-equiv-isometric-equiv-neg-subset-im-neg-subset-ℝ _ _ _ = + id-iff + + isometric-equiv-neg-subset-im-neg-subset-ℝ : + isometric-equiv-Metric-Space + ( im-isometry-Metric-Space + ( metric-space-subset-ℝ S) + ( metric-space-ℝ l2) + ( comp-isometry-Metric-Space + ( metric-space-subset-ℝ S) + ( metric-space-ℝ l2) + ( metric-space-ℝ l2) + ( isometry-neg-ℝ) + ( isometry-inclusion-subspace-Metric-Space (metric-space-ℝ l2) S))) + ( metric-space-subset-ℝ (neg-subset-ℝ S)) + isometric-equiv-neg-subset-im-neg-subset-ℝ = + ( equiv-isometric-equiv-neg-subset-im-neg-subset-ℝ , + is-isometry-map-equiv-isometric-equiv-neg-subset-im-neg-subset-ℝ) +``` diff --git a/src/real-numbers/suprema-families-real-numbers.lagda.md b/src/real-numbers/suprema-families-real-numbers.lagda.md index 7ee4968ae0..216204ba53 100644 --- a/src/real-numbers/suprema-families-real-numbers.lagda.md +++ b/src/real-numbers/suprema-families-real-numbers.lagda.md @@ -187,6 +187,17 @@ module _ has-supremum-prop-family-ℝ : Prop (l1 ⊔ l2 ⊔ lsuc l3) has-supremum-prop-family-ℝ = ( has-supremum-family-ℝ , is-prop-has-supremum-family-ℝ) + +module _ + {l1 l2 : Level} (S : subset-ℝ l1 l2) (l3 : Level) + where + + has-supremum-prop-subset-ℝ : Prop (l1 ⊔ lsuc l2 ⊔ lsuc l3) + has-supremum-prop-subset-ℝ = + has-supremum-prop-family-ℝ (inclusion-subset-ℝ S) l3 + + has-supremum-subset-ℝ : UU (l1 ⊔ lsuc l2 ⊔ lsuc l3) + has-supremum-subset-ℝ = type-Prop has-supremum-prop-subset-ℝ ``` ### A real number `r` is less than the supremum of the `yᵢ` if and only if it is less than some `yᵢ` diff --git a/src/univalent-combinatorics/finitely-enumerable-types.lagda.md b/src/univalent-combinatorics/finitely-enumerable-types.lagda.md index 11cc061fef..a99199ce57 100644 --- a/src/univalent-combinatorics/finitely-enumerable-types.lagda.md +++ b/src/univalent-combinatorics/finitely-enumerable-types.lagda.md @@ -118,6 +118,12 @@ finite-enumeration-equiv (n , Fin-n↠X) X≃Y = ( n , map-equiv X≃Y ∘ map-surjection Fin-n↠X , is-surjective-left-comp-equiv X≃Y (is-surjective-map-surjection Fin-n↠X)) + +is-finitely-enumerable-equiv : + {l1 l2 : Level} {X : UU l1} {Y : UU l2} → X ≃ Y → + is-finitely-enumerable X → is-finitely-enumerable Y +is-finitely-enumerable-equiv X≃Y = + map-is-inhabited (λ eX → finite-enumeration-equiv eX X≃Y) ``` ### Finitely enumerable types with decidable equality are finite From ceb057152d96b9913b46fb3182b27f54af555a13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojt=C4=9Bch=20=C5=A0t=C4=9Bpan=C4=8D=C3=ADk?= Date: Wed, 3 Sep 2025 22:27:43 +0200 Subject: [PATCH 47/97] Fix Agda references in species concepts (#1529) #1502 introduced concepts with mismatched Agda definitions --- src/species/composition-cauchy-series-species-of-types.lagda.md | 2 +- src/species/products-dirichlet-series-species-of-types.lagda.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/species/composition-cauchy-series-species-of-types.lagda.md b/src/species/composition-cauchy-series-species-of-types.lagda.md index e89452ef92..50802c15ad 100644 --- a/src/species/composition-cauchy-series-species-of-types.lagda.md +++ b/src/species/composition-cauchy-series-species-of-types.lagda.md @@ -30,7 +30,7 @@ open import species.species-of-types ## Idea The -{{#concept "composition" Disambiguation="of Cauchy series of two species of types in subuniverses" Agda=composition-cauchy-series-species-subuniverse}} +{{#concept "composition" Disambiguation="of Cauchy series of two species of types" Agda=composition-cauchy-series-species-types}} of [Cauchy series](species.cauchy-series-species-of-types.md) of two [species of types](species.species-of-types.md) `S` and `T` at `X` is defined as the Cauchy series of `S` applied to the Cauchy series of `T` at `X`. diff --git a/src/species/products-dirichlet-series-species-of-types.lagda.md b/src/species/products-dirichlet-series-species-of-types.lagda.md index a431942e47..1ce2279563 100644 --- a/src/species/products-dirichlet-series-species-of-types.lagda.md +++ b/src/species/products-dirichlet-series-species-of-types.lagda.md @@ -29,7 +29,7 @@ open import species.species-of-types ## Idea The -{{#concept "product" Disambiguation="of Caucy series of species of types" Agda=product-dirichlet-series-species-subuniverse}} +{{#concept "product" Disambiguation="of Caucy series of species of types" Agda=product-dirichlet-series-species-types}} of two [Dirichlet series](species.dirichlet-series-species-of-types.md) of [species of types in subuniverses](species.species-of-types.md) is just the pointwise [product](foundation.cartesian-product-types.md). From 26a456244743a5ef1a7957c2c61e8fbd3c706a48 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Wed, 3 Sep 2025 14:46:41 -0700 Subject: [PATCH 48/97] Series in metric abelian groups (#1528) I think this is a reasonable place to start -- both for series in general, and for an `analysis` package. Depends on #1527. --- config/codespell-ignore.txt | 2 + src/analysis.lagda.md | 9 + ...gent-series-metric-abelian-groups.lagda.md | 104 +++++++++ src/analysis/metric-abelian-groups.lagda.md | 158 +++++++++++++ .../series-metric-abelian-groups.lagda.md | 211 ++++++++++++++++++ 5 files changed, 484 insertions(+) create mode 100644 src/analysis.lagda.md create mode 100644 src/analysis/convergent-series-metric-abelian-groups.lagda.md create mode 100644 src/analysis/metric-abelian-groups.lagda.md create mode 100644 src/analysis/series-metric-abelian-groups.lagda.md diff --git a/config/codespell-ignore.txt b/config/codespell-ignore.txt index 24767cd674..f4b861042a 100644 --- a/config/codespell-ignore.txt +++ b/config/codespell-ignore.txt @@ -5,6 +5,8 @@ hom homs iff intensional +intensionality +intensionally lets master whitelist diff --git a/src/analysis.lagda.md b/src/analysis.lagda.md new file mode 100644 index 0000000000..99788b360c --- /dev/null +++ b/src/analysis.lagda.md @@ -0,0 +1,9 @@ +# Analysis + +```agda +module analysis where + +open import analysis.convergent-series-metric-abelian-groups public +open import analysis.metric-abelian-groups public +open import analysis.series-metric-abelian-groups public +``` diff --git a/src/analysis/convergent-series-metric-abelian-groups.lagda.md b/src/analysis/convergent-series-metric-abelian-groups.lagda.md new file mode 100644 index 0000000000..167dcbcd09 --- /dev/null +++ b/src/analysis/convergent-series-metric-abelian-groups.lagda.md @@ -0,0 +1,104 @@ +# Convergent series in metric abelian groups + +```agda +module analysis.convergent-series-metric-abelian-groups where +``` + +
Imports + +```agda +open import analysis.metric-abelian-groups +open import analysis.series-metric-abelian-groups + +open import foundation.dependent-pair-types +open import foundation.propositions +open import foundation.subtypes +open import foundation.universe-levels + +open import lists.sequences + +open import metric-spaces.convergent-sequences-metric-spaces +open import metric-spaces.limits-of-sequences-metric-spaces +``` + +
+ +## Idea + +A [series](analysis.series-metric-abelian-groups.md) in a +[metric abelian group](analysis.metric-abelian-groups.md) is +{{#concept "convergent" Disambiguation="series in a metric abelian group" Agda=converges-series-Metric-Ab WDID=Q1211057 WD="convergent series"}} +if its [sequence](lists.sequences.md) of partial sums +[converges](metric-spaces.convergent-sequences-metric-spaces.md) in the +associated [metric space](metric-spaces.metric-spaces.md). + +## Definition + +```agda +module _ + {l1 l2 : Level} (G : Metric-Ab l1 l2) (σ : series-Metric-Ab G) + where + + is-convergent-prop-series-Metric-Ab : Prop (l1 ⊔ l2) + is-convergent-prop-series-Metric-Ab = + subtype-convergent-sequence-Metric-Space + ( metric-space-Metric-Ab G) + ( partial-sum-series-Metric-Ab G σ) + + is-convergent-series-Metric-Ab : UU (l1 ⊔ l2) + is-convergent-series-Metric-Ab = + type-Prop is-convergent-prop-series-Metric-Ab + +convergent-series-Metric-Ab : + {l1 l2 : Level} (G : Metric-Ab l1 l2) → UU (l1 ⊔ l2) +convergent-series-Metric-Ab G = + type-subtype (is-convergent-prop-series-Metric-Ab G) +``` + +## Properties + +```agda +module _ + {l1 l2 : Level} (G : Metric-Ab l1 l2) (σ : convergent-series-Metric-Ab G) + where + + series-convergent-series-Metric-Ab : series-Metric-Ab G + series-convergent-series-Metric-Ab = pr1 σ + + partial-sum-convergent-series-Metric-Ab : sequence (type-Metric-Ab G) + partial-sum-convergent-series-Metric-Ab = + partial-sum-series-Metric-Ab G series-convergent-series-Metric-Ab +``` + +## The partial sums of a convergent series have a limit, the sum of the series + +```agda +module _ + {l1 l2 : Level} (G : Metric-Ab l1 l2) (σ : convergent-series-Metric-Ab G) + where + + has-limit-partial-sum-convergent-series-Metric-Ab : + has-limit-sequence-Metric-Space + ( metric-space-Metric-Ab G) + ( partial-sum-convergent-series-Metric-Ab G σ) + has-limit-partial-sum-convergent-series-Metric-Ab = + pr2 σ + + sum-convergent-series-Metric-Ab : type-Metric-Ab G + sum-convergent-series-Metric-Ab = + limit-has-limit-sequence-Metric-Space + ( metric-space-Metric-Ab G) + ( partial-sum-convergent-series-Metric-Ab G σ) + ( has-limit-partial-sum-convergent-series-Metric-Ab) + + is-limit-partial-sum-convergent-series-Metric-Ab : + is-limit-sequence-Metric-Space + ( metric-space-Metric-Ab G) + ( partial-sum-convergent-series-Metric-Ab G σ) + ( sum-convergent-series-Metric-Ab) + is-limit-partial-sum-convergent-series-Metric-Ab = + is-limit-limit-has-limit-sequence-Metric-Space + ( metric-space-Metric-Ab G) + ( partial-sum-convergent-series-Metric-Ab G σ) + ( has-limit-partial-sum-convergent-series-Metric-Ab) +``` diff --git a/src/analysis/metric-abelian-groups.lagda.md b/src/analysis/metric-abelian-groups.lagda.md new file mode 100644 index 0000000000..3306202936 --- /dev/null +++ b/src/analysis/metric-abelian-groups.lagda.md @@ -0,0 +1,158 @@ +# Metric abelian groups + +```agda +module analysis.metric-abelian-groups where +``` + +
Imports + +```agda +open import elementary-number-theory.positive-rational-numbers + +open import foundation.action-on-identifications-binary-functions +open import foundation.binary-relations +open import foundation.cartesian-product-types +open import foundation.dependent-pair-types +open import foundation.identity-types +open import foundation.universe-levels + +open import group-theory.abelian-groups + +open import metric-spaces.extensionality-pseudometric-spaces +open import metric-spaces.isometries-metric-spaces +open import metric-spaces.isometries-pseudometric-spaces +open import metric-spaces.metric-spaces +open import metric-spaces.pseudometric-spaces +open import metric-spaces.rational-neighborhood-relations +``` + +
+ +## Idea + +A {{#concept "metric abelian group" Agda=Metric-Ab}} is an +[abelian group](group-theory.abelian-groups.md) endowed with the structure of a +[metric space](metric-spaces.metric-spaces.md) such that the addition operation +and negation operation are +[isometries](metric-spaces.isometries-metric-spaces.md). + +## Definition + +```agda +Metric-Ab : (l1 l2 : Level) → UU (lsuc l1 ⊔ lsuc l2) +Metric-Ab l1 l2 = + Σ ( Ab l1) + ( λ G → + Σ ( Pseudometric-Structure l2 (type-Ab G)) + ( λ M → + let MS = (type-Ab G , M) + in + is-extensional-Pseudometric-Space MS × + is-isometry-Pseudometric-Space MS MS (neg-Ab G) × + ( (x : type-Ab G) → + is-isometry-Pseudometric-Space MS MS (add-Ab G x)))) + +module _ + {l1 l2 : Level} (MG : Metric-Ab l1 l2) + where + + ab-Metric-Ab : Ab l1 + ab-Metric-Ab = pr1 MG + + type-Metric-Ab : UU l1 + type-Metric-Ab = type-Ab ab-Metric-Ab +``` + +### Abelian group properties of metric abelian groups + +```agda +module _ + {l1 l2 : Level} (MG : Metric-Ab l1 l2) + where + + zero-Metric-Ab : type-Metric-Ab MG + zero-Metric-Ab = zero-Ab (ab-Metric-Ab MG) + + add-Metric-Ab : type-Metric-Ab MG → type-Metric-Ab MG → type-Metric-Ab MG + add-Metric-Ab = add-Ab (ab-Metric-Ab MG) + + add-Metric-Ab' : type-Metric-Ab MG → type-Metric-Ab MG → type-Metric-Ab MG + add-Metric-Ab' = add-Ab' (ab-Metric-Ab MG) + + ap-add-Metric-Ab : + {x x' y y' : type-Metric-Ab MG} → x = x' → y = y' → + add-Metric-Ab x y = add-Metric-Ab x' y' + ap-add-Metric-Ab = ap-add-Ab (ab-Metric-Ab MG) + + neg-Metric-Ab : type-Metric-Ab MG → type-Metric-Ab MG + neg-Metric-Ab = neg-Ab (ab-Metric-Ab MG) + + diff-Metric-Ab : type-Metric-Ab MG → type-Metric-Ab MG → type-Metric-Ab MG + diff-Metric-Ab x y = add-Metric-Ab x (neg-Metric-Ab y) + + ap-diff-Metric-Ab : + {x x' y y' : type-Metric-Ab MG} → x = x' → y = y' → + diff-Metric-Ab x y = diff-Metric-Ab x' y' + ap-diff-Metric-Ab = ap-right-subtraction-Ab (ab-Metric-Ab MG) + + commutative-add-Metric-Ab : + (x y : type-Metric-Ab MG) → add-Metric-Ab x y = add-Metric-Ab y x + commutative-add-Metric-Ab = commutative-add-Ab (ab-Metric-Ab MG) +``` + +### Metric properties of metric abelian groups + +```agda +module _ + {l1 l2 : Level} (MG : Metric-Ab l1 l2) + where + + pseudometric-structure-Metric-Ab : + Pseudometric-Structure l2 (type-Metric-Ab MG) + pseudometric-structure-Metric-Ab = pr1 (pr2 MG) + + pseudometric-space-Metric-Ab : Pseudometric-Space l1 l2 + pseudometric-space-Metric-Ab = + ( type-Metric-Ab MG , pseudometric-structure-Metric-Ab) + + metric-space-Metric-Ab : Metric-Space l1 l2 + metric-space-Metric-Ab = + ( pseudometric-space-Metric-Ab , + pr1 (pr2 (pr2 MG))) + + neighborhood-prop-Metric-Ab : + Rational-Neighborhood-Relation l2 (type-Metric-Ab MG) + neighborhood-prop-Metric-Ab = + neighborhood-prop-Metric-Space metric-space-Metric-Ab + + neighborhood-Metric-Ab : ℚ⁺ → Relation l2 (type-Metric-Ab MG) + neighborhood-Metric-Ab = neighborhood-Metric-Space metric-space-Metric-Ab + + is-isometry-add-Metric-Ab : + (x : type-Metric-Ab MG) → + is-isometry-Metric-Space + ( metric-space-Metric-Ab) + ( metric-space-Metric-Ab) + ( add-Metric-Ab MG x) + is-isometry-add-Metric-Ab = pr2 (pr2 (pr2 (pr2 MG))) + + isometry-add-Metric-Ab : + (x : type-Metric-Ab MG) → + isometry-Metric-Space + ( metric-space-Metric-Ab) + ( metric-space-Metric-Ab) + isometry-add-Metric-Ab x = (add-Metric-Ab MG x , is-isometry-add-Metric-Ab x) + + is-isometry-neg-Metric-Ab : + is-isometry-Metric-Space + ( metric-space-Metric-Ab) + ( metric-space-Metric-Ab) + ( neg-Metric-Ab MG) + is-isometry-neg-Metric-Ab = pr1 (pr2 (pr2 (pr2 MG))) + + isometry-neg-Metric-Ab : + isometry-Metric-Space + ( metric-space-Metric-Ab) + ( metric-space-Metric-Ab) + isometry-neg-Metric-Ab = (neg-Metric-Ab MG , is-isometry-neg-Metric-Ab) +``` diff --git a/src/analysis/series-metric-abelian-groups.lagda.md b/src/analysis/series-metric-abelian-groups.lagda.md new file mode 100644 index 0000000000..1bb3d80a5e --- /dev/null +++ b/src/analysis/series-metric-abelian-groups.lagda.md @@ -0,0 +1,211 @@ +# Series in metric abelian groups + +```agda +module analysis.series-metric-abelian-groups where +``` + +
Imports + +```agda +open import analysis.metric-abelian-groups + +open import elementary-number-theory.addition-natural-numbers +open import elementary-number-theory.natural-numbers + +open import foundation.action-on-identifications-functions +open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.function-extensionality +open import foundation.function-types +open import foundation.homotopies +open import foundation.identity-types +open import foundation.universe-levels + +open import group-theory.abelian-groups +open import group-theory.sums-of-finite-sequences-of-elements-abelian-groups + +open import lists.sequences + +open import univalent-combinatorics.coproduct-types +open import univalent-combinatorics.standard-finite-types +``` + +
+ +## Idea + +A +{{#concept "series" WD="series" WDID=Q170198 disambiguation="in an abelian group" Agda=series-Metric-Ab}} +in a [metric abelian group](analysis.metric-abelian-groups.md) `G` is a sum over +a countably infinite [sequence](lists.sequences.md) of elements of `G`. + +## Definition + +Series are defined with a record to make them intensionally distinct from the +sequence of their terms. + +```agda +record series-Metric-Ab {l1 l2 : Level} (G : Metric-Ab l1 l2) : UU l1 where + constructor series-terms-Metric-Ab + field + term-series-Metric-Ab : sequence (type-Metric-Ab G) + +open series-Metric-Ab public +``` + +## Properties + +### Equality of series + +```agda +module _ + {l1 l2 : Level} (G : Metric-Ab l1 l2) + where + + equiv-series-sequence-Metric-Ab : + series-Metric-Ab G ≃ sequence (type-Metric-Ab G) + equiv-series-sequence-Metric-Ab = + ( term-series-Metric-Ab , + is-equiv-is-invertible series-terms-Metric-Ab (λ x → refl) (λ x → refl)) + + eq-series-Metric-Ab : + {f g : series-Metric-Ab G} → + term-series-Metric-Ab f = term-series-Metric-Ab g → f = g + eq-series-Metric-Ab = ap series-terms-Metric-Ab + + eq-htpy-term-series-Metric-Ab : + {f g : series-Metric-Ab G} → + term-series-Metric-Ab f ~ term-series-Metric-Ab g → f = g + eq-htpy-term-series-Metric-Ab f~g = eq-series-Metric-Ab (eq-htpy f~g) +``` + +### Partial sums of a series + +```agda +module _ + {l1 l2 : Level} (G : Metric-Ab l1 l2) + where + + partial-sum-series-Metric-Ab : series-Metric-Ab G → ℕ → type-Metric-Ab G + partial-sum-series-Metric-Ab (series-terms-Metric-Ab f) n = + sum-fin-sequence-type-Ab (ab-Metric-Ab G) n (λ i → f (nat-Fin n i)) +``` + +### The `n`th term of a series is the difference of the `succ-ℕ n`th partial sum and the `n`th + +```agda +module _ + {l1 l2 : Level} (G : Metric-Ab l1 l2) + where + + eq-term-diff-partial-sum-series-Metric-Ab : + (f : series-Metric-Ab G) (n : ℕ) → + add-Metric-Ab G + ( partial-sum-series-Metric-Ab G f (succ-ℕ n)) + ( neg-Metric-Ab G (partial-sum-series-Metric-Ab G f n)) = + term-series-Metric-Ab f n + eq-term-diff-partial-sum-series-Metric-Ab (series-terms-Metric-Ab f) n = + ap-add-Metric-Ab G + ( cons-sum-fin-sequence-type-Ab + ( ab-Metric-Ab G) + ( n) + ( f ∘ nat-Fin (succ-ℕ n)) refl) + ( refl) ∙ + is-identity-left-conjugation-Ab (ab-Metric-Ab G) _ _ +``` + +### Two series are equal if and only if their partial sums are homotopic + +```agda +module _ + {l1 l2 : Level} (G : Metric-Ab l1 l2) + where + + htpy-htpy-partial-sum-series-Metric-Ab : + {σ τ : series-Metric-Ab G} → + (partial-sum-series-Metric-Ab G σ ~ partial-sum-series-Metric-Ab G τ) → + term-series-Metric-Ab σ ~ term-series-Metric-Ab τ + htpy-htpy-partial-sum-series-Metric-Ab {σ} {τ} psσ~psτ n = + inv (eq-term-diff-partial-sum-series-Metric-Ab G σ n) ∙ + ap-right-subtraction-Ab (ab-Metric-Ab G) (psσ~psτ (succ-ℕ n)) (psσ~psτ n) ∙ + eq-term-diff-partial-sum-series-Metric-Ab G τ n + + eq-htpy-partial-sum-series-Metric-Ab : + {σ τ : series-Metric-Ab G} → + (partial-sum-series-Metric-Ab G σ ~ partial-sum-series-Metric-Ab G τ) → + σ = τ + eq-htpy-partial-sum-series-Metric-Ab psσ~psτ = + eq-htpy-term-series-Metric-Ab G + ( htpy-htpy-partial-sum-series-Metric-Ab psσ~psτ) +``` + +### Dropping terms from a series + +```agda +module _ + {l1 l2 : Level} {G : Metric-Ab l1 l2} + where + + drop-series-Metric-Ab : ℕ → series-Metric-Ab G → series-Metric-Ab G + drop-series-Metric-Ab n (series-terms-Metric-Ab f) = + series-terms-Metric-Ab (f ∘ add-ℕ n) +``` + +### The partial sums of a series after dropping terms + +```agda +module _ + {l1 l2 : Level} (G : Metric-Ab l1 l2) + where + + abstract + partial-sum-drop-series-Metric-Ab : + (n : ℕ) → (σ : series-Metric-Ab G) → (i : ℕ) → + partial-sum-series-Metric-Ab G (drop-series-Metric-Ab n σ) i = + diff-Metric-Ab G + ( partial-sum-series-Metric-Ab G σ (n +ℕ i)) + ( partial-sum-series-Metric-Ab G σ n) + partial-sum-drop-series-Metric-Ab n (series-terms-Metric-Ab σ) i = + inv + ( equational-reasoning + diff-Metric-Ab G + ( partial-sum-series-Metric-Ab G (series-terms-Metric-Ab σ) + ( n +ℕ i)) + ( partial-sum-series-Metric-Ab G (series-terms-Metric-Ab σ) n) + = + diff-Metric-Ab G + ( add-Metric-Ab G + ( sum-fin-sequence-type-Ab (ab-Metric-Ab G) n + ( σ ∘ nat-Fin (n +ℕ i) ∘ inl-coproduct-Fin n i)) + ( sum-fin-sequence-type-Ab (ab-Metric-Ab G) i + ( σ ∘ nat-Fin (n +ℕ i) ∘ inr-coproduct-Fin n i))) + ( partial-sum-series-Metric-Ab G (series-terms-Metric-Ab σ) n) + by + ap-diff-Metric-Ab G + ( split-sum-fin-sequence-type-Ab + ( ab-Metric-Ab G) + ( n) + ( i) + ( σ ∘ nat-Fin (n +ℕ i))) + ( refl) + = + diff-Metric-Ab G + ( add-Metric-Ab G + ( partial-sum-series-Metric-Ab G (series-terms-Metric-Ab σ) n) + ( partial-sum-series-Metric-Ab G + ( series-terms-Metric-Ab (σ ∘ add-ℕ n)) i)) + ( partial-sum-series-Metric-Ab G (series-terms-Metric-Ab σ) n) + by + ap-diff-Metric-Ab G + ( ap-add-Metric-Ab G + ( htpy-sum-fin-sequence-type-Ab (ab-Metric-Ab G) n + ( λ j → ap σ (nat-inl-coproduct-Fin n i j))) + ( htpy-sum-fin-sequence-type-Ab (ab-Metric-Ab G) i + ( λ j → ap σ (nat-inr-coproduct-Fin n i j)))) + ( refl) + = + partial-sum-series-Metric-Ab G + ( series-terms-Metric-Ab (σ ∘ add-ℕ n)) + ( i) + by is-identity-left-conjugation-Ab (ab-Metric-Ab G) _ _) +``` From d31ee9658f750e71017e6a44699eab8e2aa242a2 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Thu, 4 Sep 2025 22:52:30 -0700 Subject: [PATCH 49/97] Suprema and infima of totally bounded subsets of the reals (#1510) This was a lot, and I still need to do infima, but this feels pretty exciting. Depends on #1494 . --- .../positive-rational-numbers.lagda.md | 6 + .../approximations-metric-spaces.lagda.md | 23 + .../complete-metric-spaces.lagda.md | 32 ++ src/metric-spaces/nets-metric-spaces.lagda.md | 19 + .../totally-bounded-metric-spaces.lagda.md | 2 +- src/real-numbers.lagda.md | 1 + ...ally-bounded-subsets-real-numbers.lagda.md | 432 ++++++++++++++++++ 7 files changed, 514 insertions(+), 1 deletion(-) create mode 100644 src/real-numbers/totally-bounded-subsets-real-numbers.lagda.md diff --git a/src/elementary-number-theory/positive-rational-numbers.lagda.md b/src/elementary-number-theory/positive-rational-numbers.lagda.md index a5c14dc83a..2cdf96cf0f 100644 --- a/src/elementary-number-theory/positive-rational-numbers.lagda.md +++ b/src/elementary-number-theory/positive-rational-numbers.lagda.md @@ -1032,6 +1032,12 @@ abstract ( le-ℚ x) ( commutative-add-ℚ x (rational-ℚ⁺ d)) ( le-left-add-rational-ℚ⁺ x d) + + leq-left-add-rational-ℚ⁺ : (x : ℚ) (d : ℚ⁺) → leq-ℚ x (rational-ℚ⁺ d +ℚ x) + leq-left-add-rational-ℚ⁺ x d = leq-le-ℚ (le-left-add-rational-ℚ⁺ x d) + + leq-right-add-rational-ℚ⁺ : (x : ℚ) (d : ℚ⁺) → leq-ℚ x (x +ℚ rational-ℚ⁺ d) + leq-right-add-rational-ℚ⁺ x d = leq-le-ℚ (le-right-add-rational-ℚ⁺ x d) ``` ### Subtraction by a positive rational number is a strictly deflationary map diff --git a/src/metric-spaces/approximations-metric-spaces.lagda.md b/src/metric-spaces/approximations-metric-spaces.lagda.md index a3e19c2da4..6de3b0be3c 100644 --- a/src/metric-spaces/approximations-metric-spaces.lagda.md +++ b/src/metric-spaces/approximations-metric-spaces.lagda.md @@ -15,6 +15,8 @@ open import foundation.full-subtypes open import foundation.function-types open import foundation.images open import foundation.images-subtypes +open import foundation.inhabited-subtypes +open import foundation.inhabited-types open import foundation.logical-equivalences open import foundation.propositional-truncations open import foundation.propositions @@ -238,6 +240,27 @@ module _ is-approximation-im-isometric-equiv-approximation-Metric-Space) ``` +### If a metric space is inhabited, so is any approximation + +```agda +module _ + {l1 l2 l3 : Level} + (X : Metric-Space l1 l2) (|X| : is-inhabited (type-Metric-Space X)) + (ε : ℚ⁺) (S : subset-Metric-Space l3 X) + where + + abstract + is-inhabited-is-approximation-inhabited-Metric-Space : + is-approximation-Metric-Space X ε S → + is-inhabited-subtype S + is-inhabited-is-approximation-inhabited-Metric-Space is-approx = + let open do-syntax-trunc-Prop (is-inhabited-subtype-Prop S) + in do + x ← |X| + (s , Nεsx) ← is-approx x + unit-trunc-Prop s +``` + ## References {{#bibliography}} diff --git a/src/metric-spaces/complete-metric-spaces.lagda.md b/src/metric-spaces/complete-metric-spaces.lagda.md index 6914e67ad3..6b10db7b42 100644 --- a/src/metric-spaces/complete-metric-spaces.lagda.md +++ b/src/metric-spaces/complete-metric-spaces.lagda.md @@ -9,6 +9,7 @@ module metric-spaces.complete-metric-spaces where ```agda open import elementary-number-theory.positive-rational-numbers +open import foundation.binary-relations open import foundation.dependent-pair-types open import foundation.equivalences open import foundation.identity-types @@ -86,6 +87,11 @@ module _ is-complete-metric-space-Complete-Metric-Space : is-complete-Metric-Space metric-space-Complete-Metric-Space is-complete-metric-space-Complete-Metric-Space = pr2 A + + neighborhood-Complete-Metric-Space : + ℚ⁺ → Relation l2 type-Complete-Metric-Space + neighborhood-Complete-Metric-Space = + neighborhood-Metric-Space metric-space-Complete-Metric-Space ``` ### The equivalence between Cauchy approximations and convergent Cauchy approximations in a complete metric space @@ -166,6 +172,32 @@ module _ ( convergent-cauchy-approximation-Complete-Metric-Space A u) ``` +### Saturation of the limit + +```agda +module _ + {l1 l2 : Level} (A : Complete-Metric-Space l1 l2) + (f : cauchy-approximation-Metric-Space (metric-space-Complete-Metric-Space A)) + where + + abstract + saturated-is-limit-limit-cauchy-approximation-Complete-Metric-Space : + (ε : ℚ⁺) → + neighborhood-Complete-Metric-Space A + ( ε) + ( map-cauchy-approximation-Metric-Space + ( metric-space-Complete-Metric-Space A) + ( f) + ( ε)) + ( limit-cauchy-approximation-Complete-Metric-Space A f) + saturated-is-limit-limit-cauchy-approximation-Complete-Metric-Space = + saturated-is-limit-cauchy-approximation-Metric-Space + ( metric-space-Complete-Metric-Space A) + ( f) + ( limit-cauchy-approximation-Complete-Metric-Space A f) + ( is-limit-limit-cauchy-approximation-Complete-Metric-Space A f) +``` + ## External links - [Complete metric space](https://en.wikipedia.org/wiki/Complete_metric_space) diff --git a/src/metric-spaces/nets-metric-spaces.lagda.md b/src/metric-spaces/nets-metric-spaces.lagda.md index b880cc12ff..a313ff780e 100644 --- a/src/metric-spaces/nets-metric-spaces.lagda.md +++ b/src/metric-spaces/nets-metric-spaces.lagda.md @@ -11,6 +11,7 @@ open import elementary-number-theory.positive-rational-numbers open import foundation.dependent-pair-types open import foundation.images +open import foundation.inhabited-types open import foundation.propositions open import foundation.subtypes open import foundation.universe-levels @@ -86,6 +87,24 @@ module _ is-approximation-subset-net-Metric-Space) ``` +### If a metric space is inhabited, so is any net on it + +```agda +module _ + {l1 l2 l3 : Level} + (X : Metric-Space l1 l2) (|X| : is-inhabited (type-Metric-Space X)) + (ε : ℚ⁺) (S : net-Metric-Space l3 X ε) + where + + abstract + is-inhabited-net-inhabited-Metric-Space : + is-inhabited-finitely-enumerable-subtype (pr1 S) + is-inhabited-net-inhabited-Metric-Space = + is-inhabited-is-approximation-inhabited-Metric-Space X |X| ε + ( subset-net-Metric-Space X ε S) + ( is-approximation-subset-net-Metric-Space X ε S) +``` + ## Properties ### If `μ` is a modulus of uniform continuity for `f : X → Y` and `N` is a `(μ ε)`-net of `X`, then `im f N` is an `ε`-net of `im f X` diff --git a/src/metric-spaces/totally-bounded-metric-spaces.lagda.md b/src/metric-spaces/totally-bounded-metric-spaces.lagda.md index 36833e56f7..07d7409b91 100644 --- a/src/metric-spaces/totally-bounded-metric-spaces.lagda.md +++ b/src/metric-spaces/totally-bounded-metric-spaces.lagda.md @@ -33,7 +33,7 @@ open import metric-spaces.uniformly-continuous-functions-metric-spaces ## Idea A [metric space](metric-spaces.metric-spaces.md) is -{{#concept "totally bounded" WDID=Q1362228 WD="totally bounded space" Agda=is-totally-bounded-Metric-Space}} +{{#concept "totally bounded" disambiguation="metric space" WDID=Q1362228 WD="totally bounded space" Agda=is-totally-bounded-Metric-Space}} if for every `ε : ℚ⁺`, it has an `ε`-[net](metric-spaces.nets-metric-spaces.md). ## Definition diff --git a/src/real-numbers.lagda.md b/src/real-numbers.lagda.md index 645c8c35ce..419a418c0c 100644 --- a/src/real-numbers.lagda.md +++ b/src/real-numbers.lagda.md @@ -49,6 +49,7 @@ open import real-numbers.similarity-real-numbers public open import real-numbers.strict-inequality-real-numbers public open import real-numbers.subsets-real-numbers public open import real-numbers.suprema-families-real-numbers public +open import real-numbers.totally-bounded-subsets-real-numbers public open import real-numbers.transposition-addition-subtraction-cuts-dedekind-real-numbers public open import real-numbers.upper-dedekind-real-numbers public ``` diff --git a/src/real-numbers/totally-bounded-subsets-real-numbers.lagda.md b/src/real-numbers/totally-bounded-subsets-real-numbers.lagda.md new file mode 100644 index 0000000000..f642ceb39b --- /dev/null +++ b/src/real-numbers/totally-bounded-subsets-real-numbers.lagda.md @@ -0,0 +1,432 @@ +# Totally bounded subsets of the real numbers + +```agda +{-# OPTIONS --lossy-unification #-} + +module real-numbers.totally-bounded-subsets-real-numbers where +``` + +
Imports + +```agda +open import elementary-number-theory.positive-rational-numbers + +open import foundation.dependent-pair-types +open import foundation.empty-types +open import foundation.existential-quantification +open import foundation.function-types +open import foundation.identity-types +open import foundation.images +open import foundation.inhabited-subtypes +open import foundation.inhabited-types +open import foundation.logical-equivalences +open import foundation.propositional-truncations +open import foundation.propositions +open import foundation.subtypes +open import foundation.transport-along-identifications +open import foundation.universe-levels + +open import metric-spaces.approximations-metric-spaces +open import metric-spaces.isometries-metric-spaces +open import metric-spaces.metric-spaces +open import metric-spaces.nets-metric-spaces +open import metric-spaces.subspaces-metric-spaces +open import metric-spaces.totally-bounded-metric-spaces + +open import order-theory.upper-bounds-large-posets + +open import real-numbers.addition-real-numbers +open import real-numbers.cauchy-completeness-dedekind-real-numbers +open import real-numbers.dedekind-real-numbers +open import real-numbers.difference-real-numbers +open import real-numbers.finitely-enumerable-subsets-real-numbers +open import real-numbers.inequality-real-numbers +open import real-numbers.infima-families-real-numbers +open import real-numbers.isometry-negation-real-numbers +open import real-numbers.maximum-finitely-enumerable-subsets-real-numbers +open import real-numbers.metric-space-of-real-numbers +open import real-numbers.negation-real-numbers +open import real-numbers.positive-real-numbers +open import real-numbers.rational-real-numbers +open import real-numbers.strict-inequality-real-numbers +open import real-numbers.subsets-real-numbers +open import real-numbers.suprema-families-real-numbers + +open import univalent-combinatorics.finitely-enumerable-subtypes +``` + +
+ +## Idea + +A [subset of the real numbers](real-numbers.subsets-real-numbers.md) is +{{#concept "totally bounded" disambiguation="subset of the real numbers" WDID=Q1362228 WD="totally bounded space" Agda=is-totally-bounded-subset-ℝ}} +if it is [totally bounded](metric-spaces.totally-bounded-metric-spaces.md) as a +[subspace](metric-spaces.subspaces-metric-spaces.md) of the +[metric space of real numbers](real-numbers.metric-space-of-real-numbers.md). + +## Definition + +```agda +module _ + {l1 l2 : Level} (l3 : Level) (S : subset-ℝ l1 l2) + where + + modulus-of-total-boundedness-subset-ℝ : UU (l1 ⊔ lsuc l2 ⊔ lsuc l3) + modulus-of-total-boundedness-subset-ℝ = + modulus-of-total-boundedness-Metric-Space l3 (metric-space-subset-ℝ S) + + is-totally-bounded-prop-subset-ℝ : Prop (l1 ⊔ lsuc l2 ⊔ lsuc l3) + is-totally-bounded-prop-subset-ℝ = + is-totally-bounded-prop-Metric-Space l3 (metric-space-subset-ℝ S) + + is-totally-bounded-subset-ℝ : UU (l1 ⊔ lsuc l2 ⊔ lsuc l3) + is-totally-bounded-subset-ℝ = type-Prop is-totally-bounded-prop-subset-ℝ + +totally-bounded-subset-ℝ : (l1 l2 l3 : Level) → UU (lsuc l1 ⊔ lsuc l2 ⊔ lsuc l3) +totally-bounded-subset-ℝ l1 l2 l3 = + type-subtype (is-totally-bounded-prop-subset-ℝ {l1} {l2} l3) + +module _ + {l1 l2 l3 : Level} (S : totally-bounded-subset-ℝ l1 l2 l3) + where + + subset-totally-bounded-subset-ℝ : subset-ℝ l1 l2 + subset-totally-bounded-subset-ℝ = pr1 S + + metric-space-totally-bounded-subset-ℝ : Metric-Space (l1 ⊔ lsuc l2) l2 + metric-space-totally-bounded-subset-ℝ = + metric-space-subset-ℝ subset-totally-bounded-subset-ℝ + + is-totally-bounded-totally-bounded-subset-ℝ : + is-totally-bounded-subset-ℝ l3 subset-totally-bounded-subset-ℝ + is-totally-bounded-totally-bounded-subset-ℝ = pr2 S + + is-inhabited-totally-bounded-subset-ℝ : UU (l1 ⊔ lsuc l2) + is-inhabited-totally-bounded-subset-ℝ = + is-inhabited-subset-ℝ subset-totally-bounded-subset-ℝ +``` + +## Properties + +### The elementwise negation of a totally bounded subset of ℝ is totally bounded + +```agda +module _ + {l1 l2 l3 : Level} (S : totally-bounded-subset-ℝ l1 l2 l3) + where + + abstract + is-totally-bounded-neg-totally-bounded-subset-ℝ : + is-totally-bounded-subset-ℝ + ( l1 ⊔ lsuc l2 ⊔ l3) + ( neg-subset-ℝ (subset-totally-bounded-subset-ℝ S)) + is-totally-bounded-neg-totally-bounded-subset-ℝ = + preserves-is-totally-bounded-isometric-equiv-Metric-Space _ _ + ( is-totally-bounded-im-isometry-is-totally-bounded-Metric-Space + ( metric-space-totally-bounded-subset-ℝ S) + ( metric-space-ℝ l2) + ( is-totally-bounded-totally-bounded-subset-ℝ S) + ( comp-isometry-Metric-Space + ( metric-space-totally-bounded-subset-ℝ S) + ( metric-space-ℝ l2) + ( metric-space-ℝ l2) + ( isometry-neg-ℝ) + ( isometry-inclusion-subspace-Metric-Space + ( metric-space-ℝ l2) + ( subset-totally-bounded-subset-ℝ S)))) + ( isometric-equiv-neg-subset-im-neg-subset-ℝ + ( subset-totally-bounded-subset-ℝ S)) + + neg-totally-bounded-subset-ℝ : + totally-bounded-subset-ℝ l1 l2 (l1 ⊔ lsuc l2 ⊔ l3) + neg-totally-bounded-subset-ℝ = + ( neg-subset-ℝ (subset-totally-bounded-subset-ℝ S) , + is-totally-bounded-neg-totally-bounded-subset-ℝ) +``` + +### Inhabited, totally bounded subsets of ℝ have a supremum + +This proof is adapted from Theorem 11.5.7 of {{#cite UF13}}. + +```agda +module _ + {l1 l2 l3 : Level} (S : subset-ℝ l1 l2) (|S| : is-inhabited-subtype S) + (M : modulus-of-total-boundedness-subset-ℝ l3 S) + where + + private + net : ℚ⁺ → finitely-enumerable-subset-ℝ (l1 ⊔ lsuc l2 ⊔ l3) l2 + net δ = + finitely-enumerable-subtype-im-finitely-enumerable-subtype + ( inclusion-subset-ℝ S) + ( finitely-enumerable-subset-net-Metric-Space + ( metric-space-subset-ℝ S) + ( δ) + ( M δ)) + + is-net : + (δ : ℚ⁺) → + is-approximation-Metric-Space + ( metric-space-subset-ℝ S) + ( δ) + ( subtype-finitely-enumerable-subtype (pr1 (M δ))) + is-net δ = pr2 (M δ) + + net⊆S : + (δ : ℚ⁺) → (subset-finitely-enumerable-subset-ℝ (net δ)) ⊆ S + net⊆S δ n = + rec-trunc-Prop + ( S n) + ( λ z → tr (type-Prop ∘ S) (pr2 z) (pr2 (pr1 (pr1 z)))) + + is-inhabited-net : + (δ : ℚ⁺) → + is-inhabited-finitely-enumerable-subset-ℝ (net δ) + is-inhabited-net δ = + map-is-inhabited + ( map-unit-im (pr1 ∘ pr1)) + ( is-inhabited-net-inhabited-Metric-Space + ( metric-space-subset-ℝ S) + ( |S|) + ( δ) + ( M δ)) + + max-net : ℚ⁺ → ℝ l2 + max-net δ = + max-inhabited-finitely-enumerable-subset-ℝ + ( net δ) + ( is-inhabited-net δ) + + abstract + cauchy-approximation-sup-modulated-totally-bounded-subset-ℝ : + cauchy-approximation-ℝ l2 + cauchy-approximation-sup-modulated-totally-bounded-subset-ℝ = + let + bound : (ε η : ℚ⁺) → leq-ℝ (max-net ε) (max-net η +ℝ real-ℚ⁺ η) + bound ε η = + forward-implication + ( is-least-upper-bound-max-inhabited-finitely-enumerable-subset-ℝ + ( net ε) + ( is-inhabited-net ε) + ( max-net η +ℝ real-ℚ⁺ η)) + ( λ (z , z∈net-ε) → + let + open + do-syntax-trunc-Prop + ( leq-prop-ℝ z (max-net η +ℝ real-ℚ⁺ η)) + in do + (((y , y∈S) , y∈net-η) , Nηyz) ← + is-net η (z , net⊆S ε z z∈net-ε) + transitive-leq-ℝ + ( z) + ( y +ℝ real-ℚ⁺ η) + ( max-net η +ℝ real-ℚ⁺ η) + ( preserves-leq-right-add-ℝ + ( real-ℚ⁺ η) + ( y) + ( max-net η) + ( is-upper-bound-max-inhabited-finitely-enumerable-subset-ℝ + ( net η) + ( is-inhabited-net η) + ( map-unit-im (pr1 ∘ pr1) ((y , y∈S) , y∈net-η)))) + ( right-leq-real-bound-neighborhood-ℝ η _ _ Nηyz)) + in + ( max-net , + λ ε η → + neighborhood-real-bound-each-leq-ℝ (ε +ℚ⁺ η) _ _ + ( transitive-leq-ℝ + ( max-net ε) + ( max-net η +ℝ real-ℚ⁺ η) + ( max-net η +ℝ real-ℚ⁺ (ε +ℚ⁺ η)) + ( preserves-leq-left-add-ℝ (max-net η) _ _ + ( preserves-leq-real-ℚ _ _ (leq-left-add-rational-ℚ⁺ _ ε))) + ( bound ε η)) + ( transitive-leq-ℝ + ( max-net η) + ( max-net ε +ℝ real-ℚ⁺ ε) + ( max-net ε +ℝ real-ℚ⁺ (ε +ℚ⁺ η)) + ( preserves-leq-left-add-ℝ (max-net ε) _ _ + ( preserves-leq-real-ℚ _ _ (leq-right-add-rational-ℚ⁺ _ η))) + ( bound η ε))) + + sup-modulated-totally-bounded-subset-ℝ : ℝ l2 + sup-modulated-totally-bounded-subset-ℝ = + lim-cauchy-approximation-ℝ + ( cauchy-approximation-sup-modulated-totally-bounded-subset-ℝ) + + is-upper-bound-sup-modulated-totally-bounded-subset-ℝ : + is-upper-bound-family-of-elements-Large-Poset + ( ℝ-Large-Poset) + ( inclusion-subset-ℝ S) + ( sup-modulated-totally-bounded-subset-ℝ) + is-upper-bound-sup-modulated-totally-bounded-subset-ℝ (x , x∈S) = + leq-not-le-ℝ _ _ + ( λ sup Date: Fri, 5 Sep 2025 00:05:16 -0600 Subject: [PATCH 50/97] Category of algebras of a theory (#1483) For a signature `S` and `S`-theory `T`, there is a large precategory of `T`-algebras and `T`-algebra homomorphisms. Even better, this (large) precategory is a (large) category. To define this category, this PR also characterizes the identity types of `T`-algebras, as both homomorphisms which are also equivalences and as equivalences which preserve operations, making good use of various identity-type technology in the `foundation` namespace. --- docs/tables/categories.md | 43 +-- .../subtype-identity-principle.lagda.md | 6 + src/lists/functoriality-tuples.lagda.md | 37 +++ src/universal-algebra.lagda.md | 5 + ...bstract-equations-over-signatures.lagda.md | 14 +- .../algebraic-theories.lagda.md | 11 +- .../algebras-of-theories.lagda.md | 132 ++++++--- .../category-of-algebras-of-theories.lagda.md | 60 ++++ src/universal-algebra/congruences.lagda.md | 46 ++- ...ivalences-of-models-of-signatures.lagda.md | 188 ++++++++++++ .../homomorphisms-of-algebras.lagda.md | 228 ++++++++++++++- .../isomorphisms-of-algebras.lagda.md | 272 ++++++++++++++++++ src/universal-algebra/kernels.lagda.md | 46 +-- .../models-of-signatures.lagda.md | 30 +- ...morphisms-of-models-of-signatures.lagda.md | 160 +++++++++++ ...ecategory-of-algebras-of-theories.lagda.md | 53 ++++ .../quotient-algebras.lagda.md | 75 ++--- src/universal-algebra/signatures.lagda.md | 64 ++--- .../terms-over-signatures.lagda.md | 76 ++--- 19 files changed, 1297 insertions(+), 249 deletions(-) create mode 100644 src/universal-algebra/category-of-algebras-of-theories.lagda.md create mode 100644 src/universal-algebra/equivalences-of-models-of-signatures.lagda.md create mode 100644 src/universal-algebra/isomorphisms-of-algebras.lagda.md create mode 100644 src/universal-algebra/morphisms-of-models-of-signatures.lagda.md create mode 100644 src/universal-algebra/precategory-of-algebras-of-theories.lagda.md diff --git a/docs/tables/categories.md b/docs/tables/categories.md index d1dbd92acd..cbca68ffea 100644 --- a/docs/tables/categories.md +++ b/docs/tables/categories.md @@ -1,21 +1,22 @@ -| Category | File | -| --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Abelian groups | [`group-theory.category-of-abelian-groups`](group-theory.category-of-abelian-groups.md) | -| Commutative rings | [`commutative-algebra.category-of-commutative-rings`](commutative-algebra.category-of-commutative-rings.md) | -| Connected set bundles over 𝕊¹ | [`synthetic-homotopy-theory.category-of-connected-set-bundles-circle`](synthetic-homotopy-theory.category-of-connected-set-bundles-circle.md) | -| Copresheaves on a precategory | [`category-theory.copresheaf-categories`](category-theory.copresheaf-categories.md) | -| Cyclic rings | [`ring-theory.category-of-cyclic-rings`](ring-theory.category-of-cyclic-rings.md) | -| Functors between two categories | [`category-theory.category-of-functors`](category-theory.category-of-functors.md) [`category-theory.category-of-functors-from-small-to-large-categories`](category-theory.category-of-functors-from-small-to-large-categories.md) | -| Families of sets | [`foundation.category-of-families-of-sets`](foundation.category-of-families-of-sets.md) | -| Groups | [`group-theory.category-of-groups`](group-theory.category-of-groups.md) | -| `G`-sets | [`group-theory.category-of-group-actions`](group-theory.category-of-group-actions.md) | -| Maps between two categories | [`category-theory.category-of-maps-categories`](category-theory.category-of-maps-categories.md) [`category-theory.category-of-maps-from-small-to-large-categories`](category-theory.category-of-maps-from-small-to-large-categories.md) | -| Metric spaces and isometries | [`metric-spaces.category-of-metric-spaces-and-isometries`](metric-spaces.category-of-metric-spaces-and-isometries.md) | -| Metric spaces and short functions | [`metric-spaces.category-of-metric-spaces-and-short-functions`](metric-spaces.category-of-metric-spaces-and-short-functions.md) | -| Orbits of a group | [`group-theory.category-of-orbits-groups`](group-theory.category-of-orbits-groups.md) | -| Presheaves on a precategory | [`category-theory.presheaf-categories`](category-theory.presheaf-categories.md) | -| Representing arrow category | [`category-theory.representing-arrow-category`](category-theory.representing-arrow-category.md) | -| Rings | [`ring-theory.category-of-rings`](ring-theory.category-of-rings.md) | -| Semigroups | [`group-theory.category-of-semigroups`](group-theory.category-of-semigroups.md) | -| Sets | [`foundation.category-of-sets`](foundation.category-of-sets.md) | -| Simplicial sets | [`category-theory.category-of-simplicial-sets`](category-theory.category-of-simplicial-sets.md) | +| Category | File | +| ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Abelian groups | [`group-theory.category-of-abelian-groups`](group-theory.category-of-abelian-groups.md) | +| Algebras over an equational theory | [`universal-algebra.category-of-algebras-of-theories`](universal-algebra.category-of-algebras-of-theories.md) | +| Commutative rings | [`commutative-algebra.category-of-commutative-rings`](commutative-algebra.category-of-commutative-rings.md) | +| Connected set bundles over 𝕊¹ | [`synthetic-homotopy-theory.category-of-connected-set-bundles-circle`](synthetic-homotopy-theory.category-of-connected-set-bundles-circle.md) | +| Copresheaves on a precategory | [`category-theory.copresheaf-categories`](category-theory.copresheaf-categories.md) | +| Cyclic rings | [`ring-theory.category-of-cyclic-rings`](ring-theory.category-of-cyclic-rings.md) | +| Functors between two categories | [`category-theory.category-of-functors`](category-theory.category-of-functors.md) [`category-theory.category-of-functors-from-small-to-large-categories`](category-theory.category-of-functors-from-small-to-large-categories.md) | +| Families of sets | [`foundation.category-of-families-of-sets`](foundation.category-of-families-of-sets.md) | +| Groups | [`group-theory.category-of-groups`](group-theory.category-of-groups.md) | +| `G`-sets | [`group-theory.category-of-group-actions`](group-theory.category-of-group-actions.md) | +| Maps between two categories | [`category-theory.category-of-maps-categories`](category-theory.category-of-maps-categories.md) [`category-theory.category-of-maps-from-small-to-large-categories`](category-theory.category-of-maps-from-small-to-large-categories.md) | +| Metric spaces and isometries | [`metric-spaces.category-of-metric-spaces-and-isometries`](metric-spaces.category-of-metric-spaces-and-isometries.md) | +| Metric spaces and short functions | [`metric-spaces.category-of-metric-spaces-and-short-functions`](metric-spaces.category-of-metric-spaces-and-short-functions.md) | +| Orbits of a group | [`group-theory.category-of-orbits-groups`](group-theory.category-of-orbits-groups.md) | +| Presheaves on a precategory | [`category-theory.presheaf-categories`](category-theory.presheaf-categories.md) | +| Representing arrow category | [`category-theory.representing-arrow-category`](category-theory.representing-arrow-category.md) | +| Rings | [`ring-theory.category-of-rings`](ring-theory.category-of-rings.md) | +| Semigroups | [`group-theory.category-of-semigroups`](group-theory.category-of-semigroups.md) | +| Sets | [`foundation.category-of-sets`](foundation.category-of-sets.md) | +| Simplicial sets | [`category-theory.category-of-simplicial-sets`](category-theory.category-of-simplicial-sets.md) | diff --git a/src/foundation/subtype-identity-principle.lagda.md b/src/foundation/subtype-identity-principle.lagda.md index 4facf68cfd..ffbd6abc6d 100644 --- a/src/foundation/subtype-identity-principle.lagda.md +++ b/src/foundation/subtype-identity-principle.lagda.md @@ -107,4 +107,10 @@ module _ ( map-extensionality-type-subtype f) ( is-equiv-map-equiv ∘ f) ( z) + + map-inv-extensionality-type-subtype : + (f : (x : A) → (a = x) ≃ Eq-A x) → + (z : Σ A (type-Prop ∘ P)) → Eq-A (pr1 z) → (a , p) = z + map-inv-extensionality-type-subtype f z = + map-inv-equiv (extensionality-type-subtype f z) ``` diff --git a/src/lists/functoriality-tuples.lagda.md b/src/lists/functoriality-tuples.lagda.md index eeffd7dc96..8b6fd3545f 100644 --- a/src/lists/functoriality-tuples.lagda.md +++ b/src/lists/functoriality-tuples.lagda.md @@ -62,3 +62,40 @@ module _ binary-map-tuple f empty-tuple empty-tuple = empty-tuple binary-map-tuple f (x ∷ v) (y ∷ w) = f x y ∷ binary-map-tuple f v w ``` + +## Properties + +### The action on maps of tuples preserves identity maps + +```agda +preserves-id-map-tuple : + {l : Level} (n : ℕ) {A : UU l} (x : tuple A n) → x = map-tuple id x +preserves-id-map-tuple zero-ℕ empty-tuple = refl +preserves-id-map-tuple (succ-ℕ n) (x ∷ xs) = + eq-Eq-tuple + ( succ-ℕ n) + ( x ∷ xs) + ( map-tuple id (x ∷ xs)) + ( refl , + Eq-eq-tuple n xs (map-tuple id xs) (preserves-id-map-tuple n xs)) +``` + +### The action on maps of tuples preserves composition + +```agda +preserves-comp-map-tuple : + {l1 l2 l3 : Level} (n : ℕ) {A : UU l1} {B : UU l2} {C : UU l3} + (f : A → B) (g : B → C) (x : tuple A n) → + map-tuple g (map-tuple f x) = map-tuple (g ∘ f) x +preserves-comp-map-tuple zero-ℕ f g empty-tuple = refl +preserves-comp-map-tuple (succ-ℕ n) f g (x ∷ xs) = + eq-Eq-tuple + ( succ-ℕ n) + ( map-tuple g (map-tuple f (x ∷ xs))) + ( map-tuple (g ∘ f) (x ∷ xs)) + ( refl , + Eq-eq-tuple n + ( map-tuple g (map-tuple f xs)) + ( map-tuple (g ∘ f) xs) + ( preserves-comp-map-tuple n f g xs)) +``` diff --git a/src/universal-algebra.lagda.md b/src/universal-algebra.lagda.md index 183927520e..6026df16d3 100644 --- a/src/universal-algebra.lagda.md +++ b/src/universal-algebra.lagda.md @@ -9,10 +9,15 @@ open import universal-algebra.abstract-equations-over-signatures public open import universal-algebra.algebraic-theories public open import universal-algebra.algebraic-theory-of-groups public open import universal-algebra.algebras-of-theories public +open import universal-algebra.category-of-algebras-of-theories public open import universal-algebra.congruences public +open import universal-algebra.equivalences-of-models-of-signatures public open import universal-algebra.homomorphisms-of-algebras public +open import universal-algebra.isomorphisms-of-algebras public open import universal-algebra.kernels public open import universal-algebra.models-of-signatures public +open import universal-algebra.morphisms-of-models-of-signatures public +open import universal-algebra.precategory-of-algebras-of-theories public open import universal-algebra.quotient-algebras public open import universal-algebra.signatures public open import universal-algebra.terms-over-signatures public diff --git a/src/universal-algebra/abstract-equations-over-signatures.lagda.md b/src/universal-algebra/abstract-equations-over-signatures.lagda.md index 836403a525..d0781ba887 100644 --- a/src/universal-algebra/abstract-equations-over-signatures.lagda.md +++ b/src/universal-algebra/abstract-equations-over-signatures.lagda.md @@ -19,9 +19,9 @@ open import universal-algebra.terms-over-signatures ## Idea -An **abstract equation** over a signature `Sg` is a statement of a form "`x` -equals `y`", where `x` and `y` are terms over `Sg`. Thus, the data of an -abstract equation is simply two terms over a common signature. +An **abstract equation** over a signature `σ` is a statement of a form "`x` +equals `y`", where `x` and `y` are terms over `σ`. Thus, the data of an abstract +equation is simply two terms over a common signature. ## Definitions @@ -29,15 +29,15 @@ abstract equation is simply two terms over a common signature. ```agda module _ - {l1 : Level} (Sg : signature l1) + {l1 : Level} (σ : signature l1) where Abstract-Equation : UU l1 - Abstract-Equation = Term Sg × Term Sg + Abstract-Equation = Term σ × Term σ - lhs-Abstract-Equation : Abstract-Equation → Term Sg + lhs-Abstract-Equation : Abstract-Equation → Term σ lhs-Abstract-Equation = pr1 - rhs-Abstract-Equation : Abstract-Equation → Term Sg + rhs-Abstract-Equation : Abstract-Equation → Term σ rhs-Abstract-Equation = pr2 ``` diff --git a/src/universal-algebra/algebraic-theories.lagda.md b/src/universal-algebra/algebraic-theories.lagda.md index bff4ee1bee..53f42aca76 100644 --- a/src/universal-algebra/algebraic-theories.lagda.md +++ b/src/universal-algebra/algebraic-theories.lagda.md @@ -18,7 +18,7 @@ open import universal-algebra.signatures ## Idea -An algebraic theory is a collection of abstract equations over a signature `S` +An algebraic theory is a collection of abstract equations over a signature `σ` that we consider to 'hold' in the theory. It is algebraic in the sense that we only require equations involving function symbols from the signature, in contrast to, say, requiring additional types of relations. @@ -29,19 +29,16 @@ contrast to, say, requiring additional types of relations. ```agda module _ - {l1 : Level} (Sg : signature l1) + {l1 : Level} (σ : signature l1) where Theory : (l2 : Level) → UU (l1 ⊔ lsuc l2) - Theory l2 = Σ (UU l2) (λ B → (B → Abstract-Equation Sg)) + Theory l2 = Σ (UU l2) (λ B → (B → Abstract-Equation σ)) index-Theory : {l2 : Level} → Theory l2 → UU l2 index-Theory = pr1 index-Abstract-Equation-Theory : - { l2 : Level} - ( Th : Theory l2) → - ( index-Theory Th) → - Abstract-Equation Sg + {l2 : Level} (Th : Theory l2) → (index-Theory Th) → Abstract-Equation σ index-Abstract-Equation-Theory Th e = pr2 Th e ``` diff --git a/src/universal-algebra/algebras-of-theories.lagda.md b/src/universal-algebra/algebras-of-theories.lagda.md index 3ae5fa65d3..638f5718d6 100644 --- a/src/universal-algebra/algebras-of-theories.lagda.md +++ b/src/universal-algebra/algebras-of-theories.lagda.md @@ -1,6 +1,8 @@ # Algebras ```agda +{-# OPTIONS --lossy-unification #-} + module universal-algebra.algebras-of-theories where ``` @@ -8,13 +10,19 @@ module universal-algebra.algebras-of-theories where ```agda open import foundation.dependent-pair-types +open import foundation.fundamental-theorem-of-identity-types open import foundation.identity-types open import foundation.propositions open import foundation.sets +open import foundation.subtype-identity-principle +open import foundation.torsorial-type-families open import foundation.universe-levels +open import foundation-core.equivalences + open import universal-algebra.abstract-equations-over-signatures open import universal-algebra.algebraic-theories +open import universal-algebra.equivalences-of-models-of-signatures open import universal-algebra.models-of-signatures open import universal-algebra.signatures open import universal-algebra.terms-over-signatures @@ -33,59 +41,54 @@ equations in the theory. ```agda module _ - { l1 : Level} ( Sg : signature l1) - { l2 : Level} ( Th : Theory Sg l2) + {l1 l2 : Level} (σ : signature l1) (T : Theory σ l2) where - is-algebra : - { l3 : Level} → - ( X : Model-Signature Sg l3) → UU (l2 ⊔ l3) + is-algebra : {l3 : Level} → Model-Signature σ l3 → UU (l2 ⊔ l3) is-algebra M = - ( e : index-Theory Sg Th) → - ( assign : assignment Sg (type-Model-Signature Sg M)) → - eval-term Sg (is-model-set-Model-Signature Sg M) assign - ( lhs-Abstract-Equation Sg (index-Abstract-Equation-Theory Sg Th e)) = - eval-term Sg (is-model-set-Model-Signature Sg M) assign - ( rhs-Abstract-Equation Sg (index-Abstract-Equation-Theory Sg Th e)) - - Algebra : - ( l3 : Level) → - UU (l1 ⊔ l2 ⊔ lsuc l3) + (e : index-Theory σ T) → + (assign : assignment σ (type-Model-Signature σ M)) → + eval-term σ (is-model-set-Model-Signature σ M) assign + ( lhs-Abstract-Equation σ (index-Abstract-Equation-Theory σ T e)) = + eval-term σ (is-model-set-Model-Signature σ M) assign + ( rhs-Abstract-Equation σ (index-Abstract-Equation-Theory σ T e)) + + Algebra : (l3 : Level) → UU (l1 ⊔ l2 ⊔ lsuc l3) Algebra l3 = - Σ ( Model-Signature Sg l3) (is-algebra) + Σ ( Model-Signature σ l3) (is-algebra) model-Algebra : - { l3 : Level} → - Algebra l3 → Model-Signature Sg l3 - model-Algebra Alg = pr1 Alg + {l3 : Level} → + Algebra l3 → Model-Signature σ l3 + model-Algebra A = pr1 A set-Algebra : - { l3 : Level} → + {l3 : Level} → Algebra l3 → Set l3 - set-Algebra Alg = pr1 (pr1 Alg) + set-Algebra A = pr1 (pr1 A) is-model-set-Algebra : - { l3 : Level} → - ( Alg : Algebra l3) → - is-model-signature Sg (set-Algebra Alg) - is-model-set-Algebra Alg = pr2 (pr1 Alg) + {l3 : Level} → + (A : Algebra l3) → + is-model-signature σ (set-Algebra A) + is-model-set-Algebra A = pr2 (pr1 A) type-Algebra : - { l3 : Level} → + {l3 : Level} → Algebra l3 → UU l3 - type-Algebra Alg = - pr1 (pr1 (pr1 Alg)) + type-Algebra A = + pr1 (pr1 (pr1 A)) - is-set-Algebra : - { l3 : Level} → - (Alg : Algebra l3) → is-set (type-Algebra Alg) - is-set-Algebra Alg = pr2 (pr1 (pr1 Alg)) + is-set-type-Algebra : + {l3 : Level} → + (A : Algebra l3) → is-set (type-Algebra A) + is-set-type-Algebra A = pr2 (pr1 (pr1 A)) is-algebra-Algebra : - { l3 : Level} → - ( Alg : Algebra l3) → - is-algebra (model-Algebra Alg) - is-algebra-Algebra Alg = pr2 Alg + {l3 : Level} → + (A : Algebra l3) → + is-algebra (model-Algebra A) + is-algebra-Algebra A = pr2 A ``` ## Properties @@ -94,12 +97,63 @@ module _ ```agda is-prop-is-algebra : - { l3 : Level} → - ( X : Model-Signature Sg l3) → + {l3 : Level} → + (X : Model-Signature σ l3) → is-prop (is-algebra X) is-prop-is-algebra M = is-prop-Π ( λ e → ( is-prop-Π - ( λ assign → is-set-type-Model-Signature Sg M _ _))) + ( λ assign → is-set-type-Model-Signature σ M _ _))) + + is-algebra-Prop : + {l3 : Level} (X : Model-Signature σ l3) → Prop (l2 ⊔ l3) + pr1 (is-algebra-Prop X) = is-algebra X + pr2 (is-algebra-Prop X) = is-prop-is-algebra X +``` + +### Characterizing identifications of algebras + +```agda +module _ + {l1 l2 : Level} (σ : signature l1) (T : Theory σ l2) + where + + Eq-Algebra : {l3 : Level} (A B : Algebra σ T l3) → UU (l1 ⊔ l3) + Eq-Algebra A B = + Eq-Model-Signature σ (model-Algebra σ T A) (model-Algebra σ T B) + + Eq-eq-Algebra : + {l3 : Level} (A B : Algebra σ T l3) → A = B → Eq-Algebra A B + Eq-eq-Algebra A .A refl = refl-Eq-Model-Signature σ (model-Algebra σ T A) + + is-equiv-Eq-eq-Algebra : + {l3 : Level} (A B : Algebra σ T l3) → + is-equiv (Eq-eq-Algebra A B) + is-equiv-Eq-eq-Algebra (A , p) = + subtype-identity-principle + ( is-prop-is-algebra σ T) + ( p) + ( refl-Eq-Model-Signature σ A) + ( Eq-eq-Algebra (A , p)) + ( is-equiv-Eq-eq-Model-Signature σ A) + + equiv-Eq-eq-Algebra : + {l3 : Level} (A B : Algebra σ T l3) → + (A = B) ≃ Eq-Algebra A B + pr1 (equiv-Eq-eq-Algebra A B) = Eq-eq-Algebra A B + pr2 (equiv-Eq-eq-Algebra A B) = is-equiv-Eq-eq-Algebra A B + + eq-Eq-Algebra : + {l3 : Level} (A B : Algebra σ T l3) → + Eq-Algebra A B → A = B + eq-Eq-Algebra A B = map-inv-equiv (equiv-Eq-eq-Algebra A B) + + abstract + is-torsorial-Eq-Algebra : + {l3 : Level} (A : Algebra σ T l3) → is-torsorial (Eq-Algebra A) + is-torsorial-Eq-Algebra A = + fundamental-theorem-id' + ( Eq-eq-Algebra A) + ( λ B → is-equiv-Eq-eq-Algebra A B) ``` diff --git a/src/universal-algebra/category-of-algebras-of-theories.lagda.md b/src/universal-algebra/category-of-algebras-of-theories.lagda.md new file mode 100644 index 0000000000..e73970ca99 --- /dev/null +++ b/src/universal-algebra/category-of-algebras-of-theories.lagda.md @@ -0,0 +1,60 @@ +# The category of algebras of theories + +```agda +{-# OPTIONS --lossy-unification #-} + +module universal-algebra.category-of-algebras-of-theories where +``` + +
Imports + +```agda +open import category-theory.isomorphisms-in-large-precategories +open import category-theory.large-categories +open import category-theory.large-precategories + +open import foundation.dependent-pair-types +open import foundation.sets +open import foundation.subtype-identity-principle +open import foundation.universe-levels + +open import foundation-core.equality-dependent-pair-types +open import foundation-core.equivalences +open import foundation-core.function-types +open import foundation-core.identity-types + +open import universal-algebra.algebraic-theories +open import universal-algebra.algebras-of-theories +open import universal-algebra.homomorphisms-of-algebras +open import universal-algebra.isomorphisms-of-algebras +open import universal-algebra.models-of-signatures +open import universal-algebra.precategory-of-algebras-of-theories +open import universal-algebra.signatures +``` + +
+ +## Idea + +The +[precategory of algebras of a theory](universal-algebra.precategory-of-algebras-of-theories.md) +is a [category](category-theory.large-categories.md). + +## Definition + +```agda +module _ + {l1 l2 : Level} (σ : signature l1) (T : Theory σ l2) + where + + is-large-category-Algebra-Large-Precategory : + is-large-category-Large-Precategory (Algebra-Large-Precategory σ T) + is-large-category-Algebra-Large-Precategory = is-equiv-iso-eq-Algebra σ T + + Algebra-Large-Category : + Large-Category (λ l → l1 ⊔ l2 ⊔ lsuc l) (λ l3 → _⊔_ (l1 ⊔ l3)) + large-precategory-Large-Category Algebra-Large-Category = + Algebra-Large-Precategory σ T + is-large-category-Large-Category Algebra-Large-Category = + is-large-category-Algebra-Large-Precategory +``` diff --git a/src/universal-algebra/congruences.lagda.md b/src/universal-algebra/congruences.lagda.md index 0288eb62d0..62e9daf190 100644 --- a/src/universal-algebra/congruences.lagda.md +++ b/src/universal-algebra/congruences.lagda.md @@ -34,17 +34,15 @@ operations of the algebra. ```agda module _ - { l1 : Level} ( Sg : signature l1) - { l2 : Level} ( Th : Theory Sg l2) - { l3 : Level} ( Alg : Algebra Sg Th l3) + {l1 l2 l3 : Level} (σ : signature l1) (T : Theory σ l2) (A : Algebra σ T l3) where relation-holds-all-tuple : - { l4 : Level} → - ( R : equivalence-relation l4 (type-Algebra Sg Th Alg)) → - { n : ℕ} → - ( v : tuple (type-Algebra Sg Th Alg) n) → - ( v' : tuple (type-Algebra Sg Th Alg) n) → + {l4 : Level} → + (R : equivalence-relation l4 (type-Algebra σ T A)) → + {n : ℕ} → + (v : tuple (type-Algebra σ T A) n) → + (v' : tuple (type-Algebra σ T A) n) → UU l4 relation-holds-all-tuple {l4} R {.zero-ℕ} empty-tuple empty-tuple = raise-unit l4 @@ -53,36 +51,36 @@ module _ ( relation-holds-all-tuple R v v') preserves-operations : - { l4 : Level} → - ( R : equivalence-relation l4 (type-Algebra Sg Th Alg)) → + {l4 : Level} → + (R : equivalence-relation l4 (type-Algebra σ T A)) → UU (l1 ⊔ l3 ⊔ l4) preserves-operations R = - ( op : operation-signature Sg) → - ( v : tuple (type-Algebra Sg Th Alg) - ( arity-operation-signature Sg op)) → - ( v' : tuple (type-Algebra Sg Th Alg) - ( arity-operation-signature Sg op)) → + ( op : operation-signature σ) → + ( v : tuple (type-Algebra σ T A) + ( arity-operation-signature σ op)) → + ( v' : tuple (type-Algebra σ T A) + ( arity-operation-signature σ op)) → ( relation-holds-all-tuple R v v' → ( type-Prop ( prop-equivalence-relation R - ( is-model-set-Algebra Sg Th Alg op v) - ( is-model-set-Algebra Sg Th Alg op v')))) + ( is-model-set-Algebra σ T A op v) + ( is-model-set-Algebra σ T A op v')))) congruence-Algebra : - ( l4 : Level) → + (l4 : Level) → UU (l1 ⊔ l3 ⊔ lsuc l4) congruence-Algebra l4 = - Σ ( equivalence-relation l4 (type-Algebra Sg Th Alg)) + Σ ( equivalence-relation l4 (type-Algebra σ T A)) ( preserves-operations) equivalence-relation-congruence-Algebra : - { l4 : Level} → - congruence-Algebra l4 → ( equivalence-relation l4 (type-Algebra Sg Th Alg)) + {l4 : Level} → + congruence-Algebra l4 → ( equivalence-relation l4 (type-Algebra σ T A)) equivalence-relation-congruence-Algebra = pr1 preserves-operations-congruence-Algebra : - { l4 : Level} → - ( R : congruence-Algebra l4) → - ( preserves-operations (equivalence-relation-congruence-Algebra R)) + {l4 : Level} → + (R : congruence-Algebra l4) → + (preserves-operations (equivalence-relation-congruence-Algebra R)) preserves-operations-congruence-Algebra = pr2 ``` diff --git a/src/universal-algebra/equivalences-of-models-of-signatures.lagda.md b/src/universal-algebra/equivalences-of-models-of-signatures.lagda.md new file mode 100644 index 0000000000..ecc14d2d33 --- /dev/null +++ b/src/universal-algebra/equivalences-of-models-of-signatures.lagda.md @@ -0,0 +1,188 @@ +# Equivalences of models of signatures + +```agda +module universal-algebra.equivalences-of-models-of-signatures where +``` + +
Imports + +```agda +open import foundation.action-on-identifications-functions +open import foundation.binary-homotopies +open import foundation.dependent-pair-types +open import foundation.function-extensionality +open import foundation.functoriality-dependent-pair-types +open import foundation.fundamental-theorem-of-identity-types +open import foundation.homotopy-induction +open import foundation.identity-types +open import foundation.logical-equivalences +open import foundation.sets +open import foundation.structure-identity-principle +open import foundation.torsorial-type-families +open import foundation.type-arithmetic-dependent-pair-types +open import foundation.universe-levels + +open import foundation-core.cartesian-product-types +open import foundation-core.contractible-types +open import foundation-core.equivalences +open import foundation-core.function-types +open import foundation-core.functoriality-dependent-function-types +open import foundation-core.homotopies +open import foundation-core.propositions + +open import lists.functoriality-tuples +open import lists.tuples + +open import universal-algebra.models-of-signatures +open import universal-algebra.morphisms-of-models-of-signatures +open import universal-algebra.signatures +``` + +
+ +## Idea + +We characterize [equivalences](foundation-core.equivalences.md) of +[models](universal-algebra.models-of-signatures.md) of +[signatures](universal-algebra.signatures.md). + +## Properties + +### Characterizing the identity type of model structures over a fixed set + +```agda +module _ + {l1 l2 : Level} (σ : signature l1) (X : Set l2) + where + + htpy-is-model-signature : + (f g : is-model-signature σ X) → UU (l1 ⊔ l2) + htpy-is-model-signature f g = + preserves-operations-Model-Signature σ (X , f) (X , g) id + + is-prop-htpy-is-model-signature : + (f g : is-model-signature σ X) → is-prop (htpy-is-model-signature f g) + is-prop-htpy-is-model-signature f g = + is-prop-Π + ( λ op → is-prop-Π + ( λ v → is-set-type-Set X (f op v) (g op (map-tuple id v)))) + + htpy-prop-is-Model-Signature : + (f g : is-model-signature σ X) → Prop (l1 ⊔ l2) + pr1 (htpy-prop-is-Model-Signature f g) = htpy-is-model-signature f g + pr2 (htpy-prop-is-Model-Signature f g) = is-prop-htpy-is-model-signature f g + + htpy-is-model-signature' : + (f g : is-model-signature σ X) → UU (l1 ⊔ l2) + htpy-is-model-signature' f g = (op : operation-signature σ) → f op ~ g op + + is-prop-htpy-is-model-signature' : + (f g : is-model-signature σ X) → is-prop (htpy-is-model-signature' f g) + is-prop-htpy-is-model-signature' f g = + is-prop-Π (λ op → is-prop-Π (λ v → is-set-type-Set X (f op v) (g op v))) + + htpy-prop-is-Model-Signature' : + (f g : is-model-signature σ X) → Prop (l1 ⊔ l2) + pr1 (htpy-prop-is-Model-Signature' f g) = htpy-is-model-signature' f g + pr2 (htpy-prop-is-Model-Signature' f g) = is-prop-htpy-is-model-signature' f g + + equiv-htpy-htpy'-is-Model-Signature : + (f g : is-model-signature σ X) → + htpy-is-model-signature' f g ≃ htpy-is-model-signature f g + equiv-htpy-htpy'-is-Model-Signature f g = + equiv-Π-equiv-family + ( λ op → + equiv-Π-equiv-family + ( λ v → + equiv-concat' + ( f op v) + ( ap + ( g op) + ( preserves-id-map-tuple (arity-operation-signature σ op) v)))) + + refl-htpy-is-model-signature : + (f : is-model-signature σ X) → + htpy-is-model-signature f f + refl-htpy-is-model-signature f op v = + ap (f op) (preserves-id-map-tuple (arity-operation-signature σ op) v) + + htpy-eq-is-Model-Signature : + (f g : is-model-signature σ X) → + f = g → htpy-is-model-signature f g + htpy-eq-is-Model-Signature f .f refl op v = + ap (f op) (preserves-id-map-tuple (arity-operation-signature σ op) v) + + is-torsorial-htpy-is-model-signature' : + (f : is-model-signature σ X) → is-torsorial (htpy-is-model-signature' f) + is-torsorial-htpy-is-model-signature' f = is-torsorial-binary-htpy f + + is-torsorial-htpy-is-model-signature : + (f : is-model-signature σ X) → is-torsorial (htpy-is-model-signature f) + is-torsorial-htpy-is-model-signature f = + is-contr-equiv' + ( Σ (is-model-signature σ X) (htpy-is-model-signature' f)) + ( equiv-tot (equiv-htpy-htpy'-is-Model-Signature f)) + ( is-torsorial-htpy-is-model-signature' f) + + is-equiv-htpy-eq-is-Model-Signature : + (f g : is-model-signature σ X) → + is-equiv (htpy-eq-is-Model-Signature f g) + is-equiv-htpy-eq-is-Model-Signature f = + fundamental-theorem-id + ( is-torsorial-htpy-is-model-signature f) + ( htpy-eq-is-Model-Signature f) +``` + +### The characterization of identities of models + +```agda +module _ + {l1 : Level} (σ : signature l1) + where + + Eq-Model-Signature : {l2 : Level} (X Y : Model-Signature σ l2) → UU (l1 ⊔ l2) + Eq-Model-Signature (X , X-assign) (Y , Y-assign) = + Σ ( equiv-Set X Y) + ( λ (f , _) → + preserves-operations-Model-Signature σ (X , X-assign) (Y , Y-assign) f) + + equiv-Eq-Model-Signature' : + {l2 : Level} (X Y : Model-Signature σ l2) → + Eq-Model-Signature X Y ≃ + Σ ( hom-Set (set-Model-Signature σ X) (set-Model-Signature σ Y)) + ( λ f → is-equiv f × preserves-operations-Model-Signature σ X Y f) + equiv-Eq-Model-Signature' X Y = associative-Σ _ _ _ + + refl-Eq-Model-Signature : + {l2 : Level} (X : Model-Signature σ l2) → Eq-Model-Signature X X + pr1 (refl-Eq-Model-Signature X) = id-equiv + pr2 (refl-Eq-Model-Signature X) = + preserves-operations-id-Model-Signature σ X + + Eq-eq-Model-Signature : + {l2 : Level} (X Y : Model-Signature σ l2) → X = Y → Eq-Model-Signature X Y + Eq-eq-Model-Signature X .X refl = refl-Eq-Model-Signature X + + is-equiv-Eq-eq-Model-Signature : + {l2 : Level} (X Y : Model-Signature σ l2) → + is-equiv (Eq-eq-Model-Signature X Y) + is-equiv-Eq-eq-Model-Signature (X , X-assign) = + structure-identity-principle + ( λ {Y} f (eq , _) → + preserves-operations-Model-Signature σ (X , X-assign) (Y , f) eq) + ( id-equiv) + ( preserves-operations-id-Model-Signature σ (X , X-assign)) + ( Eq-eq-Model-Signature (X , X-assign)) + ( is-equiv-equiv-eq-Set X) + ( is-equiv-htpy-eq-is-Model-Signature σ X (λ f z → id (X-assign f z))) + + equiv-Eq-eq-Model-Signature : + {l2 : Level} (X Y : Model-Signature σ l2) → + (X = Y) ≃ Eq-Model-Signature X Y + pr1 (equiv-Eq-eq-Model-Signature X Y) = Eq-eq-Model-Signature X Y + pr2 (equiv-Eq-eq-Model-Signature X Y) = is-equiv-Eq-eq-Model-Signature X Y + + eq-Eq-Model-Signature : + {l2 : Level} (X Y : Model-Signature σ l2) → Eq-Model-Signature X Y → X = Y + eq-Eq-Model-Signature X Y = map-inv-equiv (equiv-Eq-eq-Model-Signature X Y) +``` diff --git a/src/universal-algebra/homomorphisms-of-algebras.lagda.md b/src/universal-algebra/homomorphisms-of-algebras.lagda.md index 7be75f550a..152af74996 100644 --- a/src/universal-algebra/homomorphisms-of-algebras.lagda.md +++ b/src/universal-algebra/homomorphisms-of-algebras.lagda.md @@ -1,21 +1,39 @@ # Homomorphisms of algebras ```agda +{-# OPTIONS --lossy-unification #-} + module universal-algebra.homomorphisms-of-algebras where ```
Imports ```agda +open import elementary-number-theory.natural-numbers + +open import foundation.action-on-identifications-functions open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.function-extensionality open import foundation.identity-types +open import foundation.raising-universe-levels +open import foundation.sets +open import foundation.subtype-identity-principle +open import foundation.unit-type open import foundation.universe-levels +open import foundation-core.cartesian-product-types +open import foundation-core.function-types +open import foundation-core.homotopies +open import foundation-core.propositions +open import foundation-core.subtypes + open import lists.functoriality-tuples open import lists.tuples open import universal-algebra.algebraic-theories open import universal-algebra.algebras-of-theories +open import universal-algebra.models-of-signatures open import universal-algebra.signatures ``` @@ -30,32 +48,48 @@ underlying types such that all the structure is preserved. ```agda module _ - { l1 : Level} ( Sg : signature l1) - { l2 : Level} ( Th : Theory Sg l2) - { l3 l4 : Level} - ( Alg1 : Algebra Sg Th l3) - ( Alg2 : Algebra Sg Th l4) + {l1 l2 l3 l4 : Level} + (σ : signature l1) + (T : Theory σ l2) + (A : Algebra σ T l3) + (B : Algebra σ T l4) where preserves-operations-Algebra : - (type-Algebra Sg Th Alg1 → type-Algebra Sg Th Alg2) → + (type-Algebra σ T A → type-Algebra σ T B) → UU (l1 ⊔ l3 ⊔ l4) preserves-operations-Algebra f = - ( op : operation-signature Sg) → - ( v : tuple (type-Algebra Sg Th Alg1) - ( arity-operation-signature Sg op)) → - ( f (is-model-set-Algebra Sg Th Alg1 op v) = - ( is-model-set-Algebra Sg Th Alg2 op (map-tuple f v))) + ( op : operation-signature σ) → + ( v : tuple (type-Algebra σ T A) (arity-operation-signature σ op)) → + f (is-model-set-Algebra σ T A op v) = + is-model-set-Algebra σ T B op (map-tuple f v) + + is-prop-preserves-operations-Algebra : + (f : type-Algebra σ T A → type-Algebra σ T B) → + is-prop (preserves-operations-Algebra f) + is-prop-preserves-operations-Algebra f = + is-prop-Π + ( λ x → + is-prop-Π + ( λ y → + is-set-type-Algebra σ T B + ( f (is-model-set-Algebra σ T A x y)) + ( is-model-set-Algebra σ T B x (map-tuple f y)))) + + preserves-operations-prop-Algebra : + (type-Algebra σ T A → type-Algebra σ T B) → Prop (l1 ⊔ l3 ⊔ l4) + preserves-operations-prop-Algebra f = + ( preserves-operations-Algebra f , is-prop-preserves-operations-Algebra f) hom-Algebra : UU (l1 ⊔ l3 ⊔ l4) hom-Algebra = - Σ ( type-Algebra Sg Th Alg1 → type-Algebra Sg Th Alg2) + Σ ( type-Algebra σ T A → type-Algebra σ T B) ( preserves-operations-Algebra) map-hom-Algebra : hom-Algebra → - type-Algebra Sg Th Alg1 → - type-Algebra Sg Th Alg2 + type-Algebra σ T A → + type-Algebra σ T B map-hom-Algebra = pr1 preserves-operations-hom-Algebra : @@ -63,3 +97,169 @@ module _ preserves-operations-Algebra (map-hom-Algebra f) preserves-operations-hom-Algebra = pr2 ``` + +### Composition of algebra homomorphisms + +```agda +module _ + {l1 l2 l3 l4 l5 : Level} + (σ : signature l1) + (T : Theory σ l2) + (A : Algebra σ T l3) + (B : Algebra σ T l4) + (C : Algebra σ T l5) + where + + preserves-operations-map-comp-hom-Algebra : + (g : hom-Algebra σ T B C) (f : hom-Algebra σ T A B) → + preserves-operations-Algebra σ T A C + ( map-hom-Algebra σ T B C g ∘ map-hom-Algebra σ T A B f) + preserves-operations-map-comp-hom-Algebra (g , q) (f , p) op v = + equational-reasoning + (g ∘ f) (is-model-set-Algebra σ T A op v) + = g (is-model-set-Algebra σ T B op (map-tuple f v)) + by ap g (p op v) + = is-model-set-Algebra σ T C op (map-tuple g (map-tuple f v)) + by q op (map-tuple f v) + = is-model-set-Algebra σ T C op + (map-tuple (g ∘ f) v) + by + ap + ( is-model-set-Algebra σ T C op) + ( preserves-comp-map-tuple (arity-operation-signature σ op) f g v) + + comp-hom-Algebra : + (g : hom-Algebra σ T B C) (f : hom-Algebra σ T A B) → + hom-Algebra σ T A C + pr1 (comp-hom-Algebra (g , _) (f , _)) = g ∘ f + pr2 (comp-hom-Algebra g f) op v = + preserves-operations-map-comp-hom-Algebra g f op v +``` + +## Properties + +### The type of algebra homomorphisms for any theory is a set + +```agda +module _ + {l1 l2 l3 l4 : Level} + (σ : signature l1) + (T : Theory σ l2) + (A : Algebra σ T l3) + (B : Algebra σ T l4) + where + + is-set-hom-Algebra : is-set (hom-Algebra σ T A B) + is-set-hom-Algebra = + is-set-type-subtype + ( preserves-operations-prop-Algebra σ T A B) + ( is-set-hom-Set (set-Algebra σ T A) (set-Algebra σ T B)) + + set-hom-Algebra : Set (l1 ⊔ l3 ⊔ l4) + set-hom-Algebra = (hom-Algebra σ T A B , is-set-hom-Algebra) + + htpy-hom-Algebra : (f g : hom-Algebra σ T A B) → UU (l3 ⊔ l4) + htpy-hom-Algebra (f , _) (g , _) = f ~ g + + htpy-eq-hom-Algebra : + (f g : hom-Algebra σ T A B) → f = g → htpy-hom-Algebra f g + htpy-eq-hom-Algebra f .f refl x = refl + + is-equiv-htpy-eq-hom-Algebra : + (f g : hom-Algebra σ T A B) → is-equiv (htpy-eq-hom-Algebra f g) + is-equiv-htpy-eq-hom-Algebra (f , p) = + subtype-identity-principle + ( is-prop-preserves-operations-Algebra σ T A B) + ( p) + ( refl-htpy) + ( htpy-eq-hom-Algebra (f , p)) + ( funext f) + + equiv-htpy-eq-hom-Algebra : + (f g : hom-Algebra σ T A B) → (f = g) ≃ (htpy-hom-Algebra f g) + equiv-htpy-eq-hom-Algebra f g = + ( htpy-eq-hom-Algebra f g , is-equiv-htpy-eq-hom-Algebra f g) + + eq-htpy-hom-Algebra : + (f g : hom-Algebra σ T A B) → htpy-hom-Algebra f g → f = g + eq-htpy-hom-Algebra f g = map-inv-equiv (equiv-htpy-eq-hom-Algebra f g) + + refl-htpy-hom-Algebra : + (f : hom-Algebra σ T A B) → htpy-hom-Algebra f f + refl-htpy-hom-Algebra f = refl-htpy +``` + +### The identity map is an algebra homomorphism + +```agda +module _ + {l1 l2 l3 : Level} (σ : signature l1) (T : Theory σ l2) (A : Algebra σ T l3) + where + + preserves-operations-id-Algebra : preserves-operations-Algebra σ T A A id + preserves-operations-id-Algebra op v = + ap + ( is-model-set-Algebra σ T A op) + ( preserves-id-map-tuple (arity-operation-signature σ op) v) + + id-hom-Algebra : hom-Algebra σ T A A + id-hom-Algebra = (id , preserves-operations-id-Algebra) +``` + +### Composition of algebra homomorphisms is associative + +```agda +module _ + {l1 l2 l3 l4 l5 l6 : Level} + (σ : signature l1) + (T : Theory σ l2) + (A : Algebra σ T l3) + (B : Algebra σ T l4) + (C : Algebra σ T l5) + (D : Algebra σ T l6) + where + + associative-comp-hom-Algebra : + (h : hom-Algebra σ T C D) + (g : hom-Algebra σ T B C) + (f : hom-Algebra σ T A B) → + comp-hom-Algebra σ T A B D + ( comp-hom-Algebra σ T B C D h g) f = + comp-hom-Algebra σ T A C D h + ( comp-hom-Algebra σ T A B C g f) + associative-comp-hom-Algebra h g f = + eq-htpy-hom-Algebra σ T A D + ( comp-hom-Algebra σ T A B D + ( comp-hom-Algebra σ T B C D h g) f) + ( comp-hom-Algebra σ T A C D h + ( comp-hom-Algebra σ T A B C g f)) + ( refl-htpy) +``` + +### Left and right unit laws for homomorphism composition + +```agda +module _ + {l1 l2 l3 l4 : Level} + (σ : signature l1) + (T : Theory σ l2) + (A : Algebra σ T l3) + (B : Algebra σ T l4) + where + + left-unit-law-comp-hom-Algebra : + (f : hom-Algebra σ T A B) → + comp-hom-Algebra σ T A B B (id-hom-Algebra σ T B) f = f + left-unit-law-comp-hom-Algebra f = + eq-htpy-hom-Algebra σ T A B + ( comp-hom-Algebra σ T A B B (id-hom-Algebra σ T B) f) f + ( refl-htpy) + + right-unit-law-comp-hom-Algebra : + (f : hom-Algebra σ T A B) → + comp-hom-Algebra σ T A A B f (id-hom-Algebra σ T A) = f + right-unit-law-comp-hom-Algebra f = + eq-htpy-hom-Algebra σ T A B + ( comp-hom-Algebra σ T A A B f (id-hom-Algebra σ T A)) f + ( refl-htpy) +``` diff --git a/src/universal-algebra/isomorphisms-of-algebras.lagda.md b/src/universal-algebra/isomorphisms-of-algebras.lagda.md new file mode 100644 index 0000000000..0082b34592 --- /dev/null +++ b/src/universal-algebra/isomorphisms-of-algebras.lagda.md @@ -0,0 +1,272 @@ +# Isomorphisms of algebras of theories + +```agda +{-# OPTIONS --lossy-unification #-} + +module universal-algebra.isomorphisms-of-algebras where +``` + +
Imports + +```agda +open import category-theory.isomorphisms-in-large-precategories +open import category-theory.large-precategories + +open import elementary-number-theory.natural-numbers + +open import foundation.action-on-identifications-functions +open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.functoriality-dependent-pair-types +open import foundation.fundamental-theorem-of-identity-types +open import foundation.injective-maps +open import foundation.raising-universe-levels +open import foundation.sets +open import foundation.subtypes +open import foundation.torsorial-type-families +open import foundation.type-arithmetic-dependent-pair-types +open import foundation.unit-type +open import foundation.universe-levels + +open import foundation-core.cartesian-product-types +open import foundation-core.contractible-types +open import foundation-core.function-types +open import foundation-core.homotopies +open import foundation-core.identity-types +open import foundation-core.propositions + +open import lists.functoriality-tuples +open import lists.tuples + +open import universal-algebra.algebraic-theories +open import universal-algebra.algebras-of-theories +open import universal-algebra.equivalences-of-models-of-signatures +open import universal-algebra.homomorphisms-of-algebras +open import universal-algebra.models-of-signatures +open import universal-algebra.precategory-of-algebras-of-theories +open import universal-algebra.signatures +``` + +
+ +## Idea + +We characterize +[isomorphisms](category-theory.isomorphisms-in-large-precategories.md) of +[algebras of theories](universal-algebra.precategory-of-algebras-of-theories.md). + +## Definition + +### The property that a homomorphism of algebras is an equivalence + +```agda +module _ + {l1 l2 l3 l4 : Level} + (σ : signature l1) + (T : Theory σ l2) + (A : Algebra σ T l3) + (B : Algebra σ T l4) + where + + is-equiv-hom-Algebra : (f : hom-Algebra σ T A B) → UU (l3 ⊔ l4) + is-equiv-hom-Algebra f = is-equiv (map-hom-Algebra σ T A B f) + + is-prop-is-equiv-hom-Algebra : + (f : hom-Algebra σ T A B) → is-prop (is-equiv-hom-Algebra f) + is-prop-is-equiv-hom-Algebra f = is-property-is-equiv (pr1 f) + + is-equiv-hom-prop-Algebra : (f : hom-Algebra σ T A B) → Prop (l3 ⊔ l4) + pr1 (is-equiv-hom-prop-Algebra f) = is-equiv-hom-Algebra f + pr2 (is-equiv-hom-prop-Algebra f) = is-prop-is-equiv-hom-Algebra f + + equiv-hom-Algebra : UU (l1 ⊔ l3 ⊔ l4) + equiv-hom-Algebra = Σ (hom-Algebra σ T A B) is-equiv-hom-Algebra +``` + +### The inverse of an equivalence of algebras + +```agda +module _ + {l1 l2 l3 l4 : Level} + (σ : signature l1) + (T : Theory σ l2) + (A : Algebra σ T l3) + (B : Algebra σ T l4) + (f : hom-Algebra σ T A B) + (eq : is-equiv (map-hom-Algebra σ T A B f)) + where + + preserves-operations-map-hom-inv-is-equiv-hom-Algebra : + preserves-operations-Algebra σ T B A + (map-inv-equiv ((map-hom-Algebra σ T A B f) , eq)) + preserves-operations-map-hom-inv-is-equiv-hom-Algebra op v = + is-injective-is-equiv eq + ( is-section-map-inv-is-equiv eq + ( is-model-set-Algebra σ T B op v) ∙ + ( ap + ( is-model-set-Algebra σ T B op) + ( eq-Eq-tuple + ( arity-operation-signature σ op) + ( v) + ( map-tuple + ( map-hom-Algebra σ T A B f) + ( map-tuple (map-inv-is-equiv eq) v)) + ( eq2 (arity-operation-signature σ op) v)) ∙ + ( inv + ( preserves-operations-hom-Algebra σ T A B f op + ( map-tuple (map-inv-is-equiv eq) v))))) + where + eq2 : (n : ℕ) (w : tuple (type-Algebra σ T B) n) → + Eq-tuple n w + ( map-tuple + ( map-hom-Algebra σ T A B f) + ( map-tuple (map-inv-is-equiv eq) w)) + eq2 zero-ℕ empty-tuple = map-raise star + pr1 (eq2 (succ-ℕ n) (x ∷ w)) = inv (is-section-map-section-is-equiv eq x) + pr2 (eq2 (succ-ℕ n) (x ∷ w)) = eq2 n w + + hom-inv-is-equiv-hom-Algebra : hom-Algebra σ T B A + pr1 hom-inv-is-equiv-hom-Algebra = + map-inv-is-equiv eq + pr2 hom-inv-is-equiv-hom-Algebra = + preserves-operations-map-hom-inv-is-equiv-hom-Algebra +``` + +## Proof + +### A useful factorization for characterizing isomorphisms of algebras + +```agda +module _ + {l1 l2 l3 : Level} (σ : signature l1) (T : Theory σ l2) (A : Algebra σ T l3) + where + + equiv-equiv-hom-Algebra' : + {l4 : Level} + (B : Algebra σ T l4) → + equiv-hom-Algebra σ T A B ≃ + Σ ( hom-Set (set-Algebra σ T A) (set-Algebra σ T B)) + ( λ f → (is-equiv f) × preserves-operations-Algebra σ T A B f) + pr1 (equiv-equiv-hom-Algebra' B) ((f , p) , eq) = (f , eq , p) + pr1 (pr1 (pr2 (equiv-equiv-hom-Algebra' B))) (f , eq , p) = ((f , p) , eq) + pr2 (pr1 (pr2 (equiv-equiv-hom-Algebra' B))) _ = refl + pr1 (pr2 (pr2 (equiv-equiv-hom-Algebra' B))) (f , eq , p) = ((f , p) , eq) + pr2 (pr2 (pr2 (equiv-equiv-hom-Algebra' B))) _ = refl +``` + +### Characterizing isomorphisms of algebras + +```agda +module _ + {l1 l2 l3 : Level} (σ : signature l1) (T : Theory σ l2) (A B : Algebra σ T l3) + where + + is-iso-Algebra : (f : hom-Algebra σ T A B) → UU (l1 ⊔ l3) + is-iso-Algebra f = + is-iso-Large-Precategory (Algebra-Large-Precategory σ T) {X = A} {Y = B} f + + iso-Algebra : UU (l1 ⊔ l3) + iso-Algebra = iso-Large-Precategory (Algebra-Large-Precategory σ T) A B + + is-prop-is-iso-Algebra : + (f : hom-Algebra σ T A B) → is-prop (is-iso-Algebra f) + is-prop-is-iso-Algebra = + is-prop-is-iso-Large-Precategory (Algebra-Large-Precategory σ T) + + is-equiv-hom-is-iso-Algebra : + (f : hom-Algebra σ T A B) → + is-iso-Algebra f → + is-equiv-hom-Algebra σ T A B f + is-equiv-hom-is-iso-Algebra f (g , (p , q)) = + is-equiv-is-invertible + ( map-hom-Algebra σ T B A g) + ( htpy-eq-hom-Algebra σ T B B + ( comp-hom-Algebra σ T B A B f g) + ( id-hom-Algebra σ T B) + ( p)) + ( htpy-eq-hom-Algebra σ T A A + ( comp-hom-Algebra σ T A B A g f) + ( id-hom-Algebra σ T A) + ( q)) + + is-split-epi-is-equiv-hom-Algebra : + (f : hom-Algebra σ T A B) (eq : is-equiv-hom-Algebra σ T A B f) → + comp-hom-Algebra σ T A B A (hom-inv-is-equiv-hom-Algebra σ T A B f eq) f = + id-hom-Algebra σ T A + is-split-epi-is-equiv-hom-Algebra f eq = + eq-htpy-hom-Algebra σ T A A + ( comp-hom-Algebra σ T A B A + ( hom-inv-is-equiv-hom-Algebra σ T A B f eq) + ( f)) + ( id-hom-Algebra σ T A) + ( htpy ∙h + is-retraction-map-retraction-map-equiv (map-hom-Algebra σ T A B f , eq)) + where + htpy : + map-inv-is-equiv eq ∘ + map-hom-Algebra σ T A B f ~ + map-retraction-map-equiv ((map-hom-Algebra σ T A B f) , eq) ∘ + map-equiv ((map-hom-Algebra σ T A B f) , eq) + htpy x = + htpy-map-inv-equiv-retraction + ( map-hom-Algebra σ T A B f , eq) + ( retraction-is-equiv eq) + ( map-hom-Algebra σ T A B f x) + + is-split-mono-is-equiv-hom-Algebra : + (f : hom-Algebra σ T A B) (eq : is-equiv-hom-Algebra σ T A B f) → + comp-hom-Algebra σ T B A B f (hom-inv-is-equiv-hom-Algebra σ T A B f eq) = + id-hom-Algebra σ T B + is-split-mono-is-equiv-hom-Algebra f eq = + eq-htpy-hom-Algebra σ T B B + ( comp-hom-Algebra σ T B A B f + ( hom-inv-is-equiv-hom-Algebra σ T A B f eq)) + ( id-hom-Algebra σ T B) + ( is-section-map-section-map-equiv ((map-hom-Algebra σ T A B f) , eq)) + + is-iso-is-equiv-hom-Algebra : + (f : hom-Algebra σ T A B) → + is-equiv-hom-Algebra σ T A B f → + is-iso-Algebra f + pr1 (is-iso-is-equiv-hom-Algebra f eq) = + hom-inv-is-equiv-hom-Algebra σ T A B f eq + pr1 (pr2 (is-iso-is-equiv-hom-Algebra f eq)) = + is-split-mono-is-equiv-hom-Algebra f eq + pr2 (pr2 (is-iso-is-equiv-hom-Algebra f eq)) = + is-split-epi-is-equiv-hom-Algebra f eq + + equiv-iso-Eq-Algebra : Eq-Algebra σ T A B ≃ iso-Algebra + equiv-iso-Eq-Algebra = + ( equiv-type-subtype + ( is-prop-is-equiv-hom-Algebra σ T A B) + ( is-prop-is-iso-Algebra) + ( is-iso-is-equiv-hom-Algebra) + ( is-equiv-hom-is-iso-Algebra)) ∘e + ( inv-equiv (equiv-equiv-hom-Algebra' σ T A B)) ∘e + ( equiv-Eq-Model-Signature' σ (model-Algebra σ T A) (model-Algebra σ T B)) + + iso-Eq-Algebra : Eq-Algebra σ T A B → iso-Algebra + iso-Eq-Algebra = map-equiv equiv-iso-Eq-Algebra + + is-equiv-iso-Eq-Algebra : is-equiv iso-Eq-Algebra + is-equiv-iso-Eq-Algebra = is-equiv-map-equiv equiv-iso-Eq-Algebra + +module _ + {l1 l2 l3 : Level} (σ : signature l1) (T : Theory σ l2) (A : Algebra σ T l3) + where + + is-torsorial-iso-Algebra : is-torsorial (iso-Algebra σ T A) + is-torsorial-iso-Algebra = + is-contr-equiv' + ( Σ (Algebra σ T l3) (Eq-Algebra σ T A)) + ( equiv-tot (equiv-iso-Eq-Algebra σ T A)) + ( is-torsorial-Eq-Algebra σ T A) + + is-equiv-iso-eq-Algebra : + (B : Algebra σ T l3) → + is-equiv (iso-eq-Large-Precategory (Algebra-Large-Precategory σ T) A B) + is-equiv-iso-eq-Algebra = + fundamental-theorem-id + ( is-torsorial-iso-Algebra) + ( iso-eq-Large-Precategory (Algebra-Large-Precategory σ T) A) +``` diff --git a/src/universal-algebra/kernels.lagda.md b/src/universal-algebra/kernels.lagda.md index 0f945b73b5..a320104b4e 100644 --- a/src/universal-algebra/kernels.lagda.md +++ b/src/universal-algebra/kernels.lagda.md @@ -38,24 +38,24 @@ The kernel of a homomorphism `f` of algebras is the congruence relation given by ```agda module _ - { l1 : Level} ( Sg : signature l1) - { l2 : Level} ( Th : Theory Sg l2) - { l3 l4 : Level} - ( Alg1 : Algebra Sg Th l3) - ( Alg2 : Algebra Sg Th l4) - ( F : hom-Algebra Sg Th Alg1 Alg2) + {l1 l2 l3 l4 : Level} + (σ : signature l1) + (T : Theory σ l2) + (A : Algebra σ T l3) + (B : Algebra σ T l4) + (F : hom-Algebra σ T A B) where rel-prop-kernel-hom-Algebra : - Relation-Prop l4 (type-Algebra Sg Th Alg1) + Relation-Prop l4 (type-Algebra σ T A) pr1 (rel-prop-kernel-hom-Algebra x y) = - map-hom-Algebra Sg Th Alg1 Alg2 F x = - map-hom-Algebra Sg Th Alg1 Alg2 F y + map-hom-Algebra σ T A B F x = + map-hom-Algebra σ T A B F y pr2 (rel-prop-kernel-hom-Algebra x y) = - is-set-Algebra Sg Th Alg2 _ _ + is-set-type-Algebra σ T B _ _ equivalence-relation-kernel-hom-Algebra : - equivalence-relation l4 (type-Algebra Sg Th Alg1) + equivalence-relation l4 (type-Algebra σ T A) pr1 equivalence-relation-kernel-hom-Algebra = rel-prop-kernel-hom-Algebra pr1 (pr2 equivalence-relation-kernel-hom-Algebra) _ = refl @@ -63,26 +63,26 @@ module _ pr2 (pr2 (pr2 equivalence-relation-kernel-hom-Algebra)) _ _ _ f g = g ∙ f kernel-hom-Algebra : - congruence-Algebra Sg Th Alg1 l4 + congruence-Algebra σ T A l4 pr1 kernel-hom-Algebra = equivalence-relation-kernel-hom-Algebra pr2 kernel-hom-Algebra op v v' p = equational-reasoning - f (is-model-set-Algebra Sg Th Alg1 op v) - = is-model-set-Algebra Sg Th Alg2 op (map-tuple f v) - by preserves-operations-hom-Algebra Sg Th Alg1 Alg2 F op v - = is-model-set-Algebra Sg Th Alg2 op (map-tuple f v') + f (is-model-set-Algebra σ T A op v) + = is-model-set-Algebra σ T B op (map-tuple f v) + by preserves-operations-hom-Algebra σ T A B F op v + = is-model-set-Algebra σ T B op (map-tuple f v') by ap - ( is-model-set-Algebra Sg Th Alg2 op) - ( map-hom-Algebra-lemma (pr2 Sg op) v v' p) - = f (is-model-set-Algebra Sg Th Alg1 op v') - by inv (preserves-operations-hom-Algebra Sg Th Alg1 Alg2 F op v') + ( is-model-set-Algebra σ T B op) + ( map-hom-Algebra-lemma (pr2 σ op) v v' p) + = f (is-model-set-Algebra σ T A op v') + by inv (preserves-operations-hom-Algebra σ T A B F op v') where - f = map-hom-Algebra Sg Th Alg1 Alg2 F + f = map-hom-Algebra σ T A B F map-hom-Algebra-lemma : ( n : ℕ) → - ( v v' : tuple (type-Algebra Sg Th Alg1) n) → - ( relation-holds-all-tuple Sg Th Alg1 + ( v v' : tuple (type-Algebra σ T A) n) → + ( relation-holds-all-tuple σ T A equivalence-relation-kernel-hom-Algebra v v') → (map-tuple f v) = (map-tuple f v') map-hom-Algebra-lemma zero-ℕ empty-tuple empty-tuple p = refl diff --git a/src/universal-algebra/models-of-signatures.lagda.md b/src/universal-algebra/models-of-signatures.lagda.md index 2c2a430037..cfe60406be 100644 --- a/src/universal-algebra/models-of-signatures.lagda.md +++ b/src/universal-algebra/models-of-signatures.lagda.md @@ -1,16 +1,32 @@ # Models of signatures ```agda +{-# OPTIONS --lossy-unification #-} + module universal-algebra.models-of-signatures where ```
Imports ```agda +open import foundation.action-on-identifications-functions open import foundation.dependent-pair-types +open import foundation.function-extensionality open import foundation.sets +open import foundation.structure-identity-principle open import foundation.universe-levels +open import foundation-core.cartesian-product-types +open import foundation-core.dependent-identifications +open import foundation-core.equality-dependent-pair-types +open import foundation-core.equivalences +open import foundation-core.function-types +open import foundation-core.homotopies +open import foundation-core.identity-types +open import foundation-core.propositions +open import foundation-core.torsorial-type-families + +open import lists.functoriality-tuples open import lists.tuples open import universal-algebra.signatures @@ -30,13 +46,13 @@ element of `A`. ```agda module _ - {l1 : Level} (Sg : signature l1) + {l1 : Level} (σ : signature l1) where is-model : {l2 : Level} → UU l2 → UU (l1 ⊔ l2) is-model X = - ( f : operation-signature Sg) → - ( tuple X (arity-operation-signature Sg f) → X) + ( f : operation-signature σ) → + ( tuple X (arity-operation-signature σ f) → X) is-model-signature : {l2 : Level} → (Set l2) → UU (l1 ⊔ l2) is-model-signature X = is-model (type-Set X) @@ -48,8 +64,8 @@ module _ set-Model-Signature M = pr1 M is-model-set-Model-Signature : - { l2 : Level} → - ( M : Model-Signature l2) → + {l2 : Level} → + (M : Model-Signature l2) → is-model-signature (set-Model-Signature M) is-model-set-Model-Signature M = pr2 M @@ -57,8 +73,8 @@ module _ type-Model-Signature M = pr1 (set-Model-Signature M) is-set-type-Model-Signature : - { l2 : Level} → - ( M : Model-Signature l2) → + {l2 : Level} → + (M : Model-Signature l2) → is-set (type-Model-Signature M) is-set-type-Model-Signature M = pr2 (set-Model-Signature M) ``` diff --git a/src/universal-algebra/morphisms-of-models-of-signatures.lagda.md b/src/universal-algebra/morphisms-of-models-of-signatures.lagda.md new file mode 100644 index 0000000000..6d6bbc6a15 --- /dev/null +++ b/src/universal-algebra/morphisms-of-models-of-signatures.lagda.md @@ -0,0 +1,160 @@ +# Morphisms of models of signatures + +```agda +module universal-algebra.morphisms-of-models-of-signatures where +``` + +
Imports + +```agda +open import foundation.action-on-identifications-functions +open import foundation.dependent-pair-types +open import foundation.function-extensionality +open import foundation.fundamental-theorem-of-identity-types +open import foundation.sets +open import foundation.subtype-identity-principle +open import foundation.torsorial-type-families +open import foundation.universe-levels + +open import foundation-core.equivalences +open import foundation-core.function-types +open import foundation-core.homotopies +open import foundation-core.identity-types +open import foundation-core.propositions + +open import lists.functoriality-tuples +open import lists.tuples + +open import universal-algebra.models-of-signatures +open import universal-algebra.signatures +``` + +
+ +## Idea + +A +{{#concept "morphism" Disambiguation="of models over a signature" Agda=hom-Model-Signature}} +of [`σ`-models](universal-algebra.models-of-signatures.md) `A` and `B` is a +function `f : A → B` between their underlying sets that preserves the operations +of `σ`, in the sense that for `op ∈ σ` an abstract operation with arity `n ∈ ℕ`, +and `assign-A` and `assign-B` the semantics of `σ` in `A` and `B` respectively, +and for a `v ∈ tuple A n`, we have + +```text + f (assign-A op v) = assign-B op (f v). +``` + +## Definitions + +### The predicate on maps of models of preserving operations + +```agda +module _ + {l1 : Level} (σ : signature l1) + where + + preserves-operations-Model-Signature : + {l2 l3 : Level} (X : Model-Signature σ l2) (Y : Model-Signature σ l3) + (f : hom-Set (set-Model-Signature σ X) (set-Model-Signature σ Y)) → + UU (l1 ⊔ l2 ⊔ l3) + preserves-operations-Model-Signature ((X , _) , assign-X) (Y , assign-Y) f = + ( op : operation-signature σ) + ( v : tuple X (arity-operation-signature σ op)) → + f (assign-X op v) = assign-Y op (map-tuple f v) + + is-prop-preserves-operations-Model-Signature : + {l2 l3 : Level} (X : Model-Signature σ l2) (Y : Model-Signature σ l3) + (f : hom-Set (set-Model-Signature σ X) (set-Model-Signature σ Y)) → + is-prop (preserves-operations-Model-Signature X Y f) + is-prop-preserves-operations-Model-Signature + (X , assign-X) ((Y , set-Y) , assign-Y) f = + is-prop-Π + ( λ op → + is-prop-Π + ( λ v → + set-Y + ( f (assign-X op v)) + ( assign-Y op (map-tuple f v)))) + + prop-preserves-operations-Model-Signature : + {l2 l3 : Level} (X : Model-Signature σ l2) (Y : Model-Signature σ l3) + (f : hom-Set (set-Model-Signature σ X) (set-Model-Signature σ Y)) → + Prop (l1 ⊔ l2 ⊔ l3) + pr1 (prop-preserves-operations-Model-Signature X Y f) = + preserves-operations-Model-Signature X Y f + pr2 (prop-preserves-operations-Model-Signature X Y f) = + is-prop-preserves-operations-Model-Signature X Y f +``` + +### The type of morphisms of models of a signature + +```agda + hom-Model-Signature : + {l2 l3 : Level} (X : Model-Signature σ l2) (Y : Model-Signature σ l3) → + UU (l1 ⊔ l2 ⊔ l3) + hom-Model-Signature X Y = + Σ ( hom-Set (set-Model-Signature σ X) (set-Model-Signature σ Y)) + ( preserves-operations-Model-Signature X Y) + + map-hom-Model-Signature : + {l2 l3 : Level} (X : Model-Signature σ l2) (Y : Model-Signature σ l3) → + hom-Model-Signature X Y → + hom-Set (set-Model-Signature σ X) (set-Model-Signature σ Y) + map-hom-Model-Signature X Y (f , _) = f + + preserves-operations-hom-Model-Signature : + {l2 l3 : Level} {X : Model-Signature σ l2} {Y : Model-Signature σ l3} → + (f : hom-Model-Signature X Y) → + preserves-operations-Model-Signature X Y (map-hom-Model-Signature X Y f) + preserves-operations-hom-Model-Signature (f , p) = p +``` + +## Properties + +### The identity morphism of a model + +```agda +preserves-operations-id-Model-Signature : + {l1 l2 : Level} (σ : signature l1) (X : Model-Signature σ l2) → + preserves-operations-Model-Signature σ X X id +preserves-operations-id-Model-Signature σ ((X , _) , assign-X) op v = + ap + ( assign-X op) + ( preserves-id-map-tuple (arity-operation-signature σ op) v) + +id-hom-Model-Signature : + {l1 l2 : Level} (σ : signature l1) (X : Model-Signature σ l2) → + hom-Model-Signature σ X X +pr1 (id-hom-Model-Signature σ X) = id +pr2 (id-hom-Model-Signature σ X) = preserves-operations-id-Model-Signature σ X +``` + +### Characterizing the identity type of morphisms of models + +```agda +module _ + {l1 l2 l3 : Level} (σ : signature l1) + (X : Model-Signature σ l2) (Y : Model-Signature σ l3) + where + + htpy-hom-Model-Signature : (f g : hom-Model-Signature σ X Y) → UU (l2 ⊔ l3) + htpy-hom-Model-Signature (f , _) (g , _) = + ( x : type-Model-Signature σ X) → f x = g x + + htpy-eq-hom-Model-Signature : + ( f g : hom-Model-Signature σ X Y) → + f = g → htpy-hom-Model-Signature f g + htpy-eq-hom-Model-Signature f .f refl = refl-htpy + + is-equiv-htpy-eq-hom-Model-Signature : + (f g : hom-Model-Signature σ X Y) → + is-equiv (htpy-eq-hom-Model-Signature f g) + is-equiv-htpy-eq-hom-Model-Signature (f , hom-f) = + subtype-identity-principle + ( is-prop-preserves-operations-Model-Signature σ X Y) + ( hom-f) + ( refl-htpy) + ( htpy-eq-hom-Model-Signature (f , hom-f)) + ( funext f) +``` diff --git a/src/universal-algebra/precategory-of-algebras-of-theories.lagda.md b/src/universal-algebra/precategory-of-algebras-of-theories.lagda.md new file mode 100644 index 0000000000..02d4addcef --- /dev/null +++ b/src/universal-algebra/precategory-of-algebras-of-theories.lagda.md @@ -0,0 +1,53 @@ +# The precategory of algebras of an equational theory + +```agda +module universal-algebra.precategory-of-algebras-of-theories where +``` + +
Imports + +```agda +open import category-theory.large-precategories + +open import foundation.dependent-pair-types +open import foundation.sets +open import foundation.universe-levels + +open import foundation-core.identity-types + +open import universal-algebra.algebraic-theories +open import universal-algebra.algebras-of-theories +open import universal-algebra.homomorphisms-of-algebras +open import universal-algebra.models-of-signatures +open import universal-algebra.signatures +``` + +
+ +## Idea + +For any [signature](universal-algebra.signatures.md) `σ` and +`σ`-[theory](universal-algebra.algebraic-theories.md) `T`, there is a +[large precategory](category-theory.large-precategories.md) of +`T`-[algebras](universal-algebra.algebras-of-theories.md) and `T`-algebra +[homomorphisms](universal-algebra.homomorphisms-of-algebras.md). + +## Definition + +```agda +module _ + {l1 l2 : Level} (σ : signature l1) (T : Theory σ l2) + where + + Algebra-Large-Precategory : + Large-Precategory (λ l → l1 ⊔ l2 ⊔ lsuc l) (λ l3 l4 → l1 ⊔ l3 ⊔ l4) + Algebra-Large-Precategory = make-Large-Precategory + ( Algebra σ T) + ( set-hom-Algebra σ T) + ( λ {l3} {l4} {l5} {X} {Y} {Z} → comp-hom-Algebra σ T X Y Z) + ( λ {l} {X} → id-hom-Algebra σ T X) + ( λ {l3} {l4} {l5} {l6} {X} {Y} {Z} {W} → + associative-comp-hom-Algebra σ T X Y Z W) + ( λ {l3} {l4} {X} {Y} → left-unit-law-comp-hom-Algebra σ T X Y) + ( λ {l3} {l4} {X} {Y} → right-unit-law-comp-hom-Algebra σ T X Y) +``` diff --git a/src/universal-algebra/quotient-algebras.lagda.md b/src/universal-algebra/quotient-algebras.lagda.md index c08ef15c02..b4fc594a26 100644 --- a/src/universal-algebra/quotient-algebras.lagda.md +++ b/src/universal-algebra/quotient-algebras.lagda.md @@ -45,15 +45,16 @@ original one. ```agda module _ - { l1 : Level} ( Sg : signature l1) - { l2 : Level} ( Th : Theory Sg l2) - { l3 : Level} ( Alg : Algebra Sg Th l3) - { l4 : Level} ( R : congruence-Algebra Sg Th Alg l4) + {l1 l2 l3 l4 : Level} + (σ : signature l1) + (T : Theory σ l2) + (A : Algebra σ T l3) + (R : congruence-Algebra σ T A l4) where set-quotient-Algebra : Set (l3 ⊔ l4) set-quotient-Algebra = - quotient-Set ( equivalence-relation-congruence-Algebra Sg Th Alg R) + quotient-Set (equivalence-relation-congruence-Algebra σ T A R) type-quotient-Algebra : UU (l3 ⊔ l4) type-quotient-Algebra = pr1 set-quotient-Algebra @@ -63,15 +64,15 @@ module _ compute-quotient-Algebra : equivalence-class - ( equivalence-relation-congruence-Algebra Sg Th Alg R) ≃ - ( type-quotient-Algebra) + (equivalence-relation-congruence-Algebra σ T A R) ≃ + (type-quotient-Algebra) compute-quotient-Algebra = compute-set-quotient - ( equivalence-relation-congruence-Algebra Sg Th Alg R) + ( equivalence-relation-congruence-Algebra σ T A R) set-quotient-equivalence-class-Algebra : equivalence-class - ( equivalence-relation-congruence-Algebra Sg Th Alg R) → + (equivalence-relation-congruence-Algebra σ T A R) → type-quotient-Algebra set-quotient-equivalence-class-Algebra = map-equiv compute-quotient-Algebra @@ -79,14 +80,14 @@ module _ equivalence-class-set-quotient-Algebra : type-quotient-Algebra → equivalence-class - ( equivalence-relation-congruence-Algebra Sg Th Alg R) + (equivalence-relation-congruence-Algebra σ T A R) equivalence-class-set-quotient-Algebra = map-inv-equiv compute-quotient-Algebra tuple-type-quotient-tuple-type-Algebra : - { n : ℕ} → + {n : ℕ} → tuple type-quotient-Algebra n → - type-trunc-Prop (tuple (type-Algebra Sg Th Alg) n) + type-trunc-Prop (tuple (type-Algebra σ T A) n) tuple-type-quotient-tuple-type-Algebra empty-tuple = unit-trunc-Prop empty-tuple tuple-type-quotient-tuple-type-Algebra (x ∷ v) = @@ -99,17 +100,17 @@ module _ ( pr2 (equivalence-class-set-quotient-Algebra x)) relation-holds-all-tuple-all-sim-equivalence-relation : - { n : ℕ} - ( v v' : multivariable-input n ( λ _ → type-Algebra Sg Th Alg)) → - ( type-Prop - ( prop-equivalence-relation - ( all-sim-equivalence-relation n - ( λ _ → type-Algebra Sg Th Alg) - ( λ _ → equivalence-relation-congruence-Algebra Sg Th Alg R)) v v')) → - relation-holds-all-tuple Sg Th Alg - ( equivalence-relation-congruence-Algebra Sg Th Alg R) - ( tuple-multivariable-input n (type-Algebra Sg Th Alg) v) - ( tuple-multivariable-input n (type-Algebra Sg Th Alg) v') + {n : ℕ} + (v v' : multivariable-input n ( λ _ → type-Algebra σ T A)) → + (type-Prop + (prop-equivalence-relation + (all-sim-equivalence-relation n + (λ _ → type-Algebra σ T A) + (λ _ → equivalence-relation-congruence-Algebra σ T A R)) v v')) → + relation-holds-all-tuple σ T A + (equivalence-relation-congruence-Algebra σ T A R) + (tuple-multivariable-input n (type-Algebra σ T A) v) + (tuple-multivariable-input n (type-Algebra σ T A) v') relation-holds-all-tuple-all-sim-equivalence-relation {zero-ℕ} v v' p = raise-star relation-holds-all-tuple-all-sim-equivalence-relation @@ -117,33 +118,33 @@ module _ p , (relation-holds-all-tuple-all-sim-equivalence-relation v v' p') is-model-set-quotient-Algebra : - is-model-signature Sg set-quotient-Algebra + is-model-signature σ set-quotient-Algebra is-model-set-quotient-Algebra op v = multivariable-map-set-quotient - ( arity-operation-signature Sg op) - ( λ _ → type-Algebra Sg Th Alg) - ( λ _ → equivalence-relation-congruence-Algebra Sg Th Alg R) - ( equivalence-relation-congruence-Algebra Sg Th Alg R) + ( arity-operation-signature σ op) + ( λ _ → type-Algebra σ T A) + ( λ _ → equivalence-relation-congruence-Algebra σ T A R) + ( equivalence-relation-congruence-Algebra σ T A R) ( pair ( λ v → - is-model-set-Algebra Sg Th Alg op + is-model-set-Algebra σ T A op ( tuple-multivariable-input - ( arity-operation-signature Sg op) - ( type-Algebra Sg Th Alg) + ( arity-operation-signature σ op) + ( type-Algebra σ T A) ( v))) ( λ {v} {v'} p → - preserves-operations-congruence-Algebra Sg Th Alg R op + preserves-operations-congruence-Algebra σ T A R op ( tuple-multivariable-input - ( arity-operation-signature Sg op) - ( type-Algebra Sg Th Alg) + ( arity-operation-signature σ op) + ( type-Algebra σ T A) ( v)) ( tuple-multivariable-input - ( arity-operation-signature Sg op) - ( type-Algebra Sg Th Alg) + ( arity-operation-signature σ op) + ( type-Algebra σ T A) ( v')) (relation-holds-all-tuple-all-sim-equivalence-relation v v' p))) ( multivariable-input-tuple - ( arity-operation-signature Sg op) + ( arity-operation-signature σ op) ( type-quotient-Algebra) ( v)) ``` diff --git a/src/universal-algebra/signatures.lagda.md b/src/universal-algebra/signatures.lagda.md index e5b118ac6b..dbbedaeeb8 100644 --- a/src/universal-algebra/signatures.lagda.md +++ b/src/universal-algebra/signatures.lagda.md @@ -31,52 +31,52 @@ signature : (l : Level) → UU (lsuc l) signature (l) = Σ (UU l) (λ operations → (operations → ℕ)) operation-signature : {l : Level} → signature l → UU l -operation-signature Sg = pr1 Sg +operation-signature σ = pr1 σ arity-operation-signature : - { l : Level} → - ( Sg : signature l) → - ( operation-signature Sg → ℕ) -arity-operation-signature Sg = pr2 Sg + {l : Level} → + (σ : signature l) → + (operation-signature σ → ℕ) +arity-operation-signature σ = pr2 σ ``` ### Extension of signatures ```agda is-extension-signature : - { l1 l2 : Level} → + {l1 l2 : Level} → signature l1 → signature l2 → UU (l1 ⊔ l2) -is-extension-signature Sg1 Sg2 = - Σ ( operation-signature Sg2 → operation-signature Sg1) +is-extension-signature σ τ = + Σ ( operation-signature τ → operation-signature σ) ( λ f → is-emb f × - ( ( op : operation-signature Sg2) → - arity-operation-signature Sg2 op = - arity-operation-signature Sg1 (f op))) + ( ( op : operation-signature τ) → + arity-operation-signature τ op = + arity-operation-signature σ (f op))) emb-extension-signature : - { l1 l2 : Level} → - ( Sg1 : signature l1) → - ( Sg2 : signature l2) → - is-extension-signature Sg1 Sg2 → - ( operation-signature Sg2 → operation-signature Sg1) -emb-extension-signature Sg1 Sg2 ext = pr1 ext + {l1 l2 : Level} → + (σ : signature l1) → + (τ : signature l2) → + is-extension-signature σ τ → + (operation-signature τ → operation-signature σ) +emb-extension-signature σ τ ext = pr1 ext is-emb-extension-signature : - { l1 l2 : Level} → - ( Sg1 : signature l1) → - ( Sg2 : signature l2) → - ( ext : is-extension-signature Sg1 Sg2) → - is-emb (emb-extension-signature Sg1 Sg2 ext) -is-emb-extension-signature Sg1 Sg2 ext = pr1 (pr2 ext) + {l1 l2 : Level} → + (σ : signature l1) → + (τ : signature l2) → + (ext : is-extension-signature σ τ) → + is-emb (emb-extension-signature σ τ ext) +is-emb-extension-signature σ τ ext = pr1 (pr2 ext) arity-preserved-extension-signature : - { l1 l2 : Level} → - ( Sg1 : signature l1) → - ( Sg2 : signature l2) → - ( ext : is-extension-signature Sg1 Sg2) → - ( op : operation-signature Sg2) → - arity-operation-signature Sg2 op = - arity-operation-signature Sg1 - ( emb-extension-signature Sg1 Sg2 ext op) -arity-preserved-extension-signature Sg1 Sg2 ext = pr2 (pr2 ext) + {l1 l2 : Level} → + (σ : signature l1) → + (τ : signature l2) → + (ext : is-extension-signature σ τ) → + (op : operation-signature τ) → + arity-operation-signature τ op = + arity-operation-signature σ + (emb-extension-signature σ τ ext op) +arity-preserved-extension-signature σ τ ext = pr2 (pr2 ext) ``` diff --git a/src/universal-algebra/terms-over-signatures.lagda.md b/src/universal-algebra/terms-over-signatures.lagda.md index a2bce10a7f..7f8c3b170e 100644 --- a/src/universal-algebra/terms-over-signatures.lagda.md +++ b/src/universal-algebra/terms-over-signatures.lagda.md @@ -41,12 +41,12 @@ formalization, we are using de Bruijn variables. ```agda module _ - {l1 : Level} (Sg : signature l1) + {l1 : Level} (σ : signature l1) where data Term : UU l1 where var-Term : ℕ → Term - op-Term : is-model Sg Term + op-Term : is-model σ Term de-bruijn-variables-term : Term → list ℕ @@ -84,11 +84,11 @@ evaluated to a concrete element of the type `A`. ```agda eval-term : {l2 : Level} → {A : UU l2} → - is-model Sg A → assignment A → Term → A + is-model σ A → assignment A → Term → A eval-tuple : - { l2 : Level} → {A : UU l2} {n : ℕ} → - is-model Sg A → assignment A → tuple Term n → tuple A n + {l2 : Level} → {A : UU l2} {n : ℕ} → + is-model σ A → assignment A → tuple Term n → tuple A n eval-term m assign (var-Term n) = assign n eval-term m assign (op-Term f x) = m f (eval-tuple m assign x) @@ -98,8 +98,8 @@ evaluated to a concrete element of the type `A`. eval-term m assign x ∷ (eval-tuple m assign v) eval-tuple-map-tuple-eval-term : - { l2 : Level} {A : UU l2} {n : ℕ} → - (m : is-model Sg A) → (assign : assignment A) → (v : tuple Term n) → + {l2 : Level} {A : UU l2} {n : ℕ} → + (m : is-model σ A) → (assign : assignment A) → (v : tuple Term n) → eval-tuple m assign v = map-tuple (eval-term m assign) v eval-tuple-map-tuple-eval-term m assign empty-tuple = refl eval-tuple-map-tuple-eval-term m assign (x ∷ v) = @@ -113,17 +113,17 @@ element of `A`. ```agda eval-constant-term : - { l2 : Level} {A : UU l2} → - ( is-model Sg A) → - ( t : Term) → + {l2 : Level} {A : UU l2} → + (is-model σ A) → + (t : Term) → (de-bruijn-variables-term t = nil) → A eval-constant-term-tuple : - { l2 : Level} {A : UU l2} {n : ℕ} → - ( is-model Sg A) → - ( v : tuple Term n) → - ( all-tuple (λ t → is-nil-list (de-bruijn-variables-term t)) v) → + {l2 : Level} {A : UU l2} {n : ℕ} → + (is-model σ A) → + (v : tuple Term n) → + (all-tuple (λ t → is-nil-list (de-bruijn-variables-term t)) v) → tuple A n eval-constant-term m (op-Term f x) p = @@ -167,7 +167,7 @@ element of `A`. induced-function-term : {l2 : Level} → {A : UU l2} → - is-model Sg A → (t : Term) → + is-model σ A → (t : Term) → tuple A (arity-term t) → A induced-function-term {l2} {A} m t v with ( has-decidable-equality-list @@ -198,29 +198,29 @@ element of `A`. ```agda translation-term : - { l1 l2 : Level} → - ( Sg1 : signature l1) → - ( Sg2 : signature l2) → - is-extension-signature Sg1 Sg2 → - Term Sg2 → Term Sg1 + {l1 l2 : Level} → + (σ : signature l1) → + (τ : signature l2) → + is-extension-signature σ τ → + Term τ → Term σ translation-tuple : - { l1 l2 : Level} → - ( Sg1 : signature l1) → - ( Sg2 : signature l2) → - { n : ℕ} → - is-extension-signature Sg1 Sg2 → - tuple (Term Sg2) n → tuple (Term Sg1) n - -translation-term Sg1 Sg2 ext (var-Term x) = var-Term x -translation-term Sg1 Sg2 ext (op-Term f v) = - op-Term (emb-extension-signature Sg1 Sg2 ext f) - ( tr (tuple (Term Sg1)) - ( arity-preserved-extension-signature Sg1 Sg2 ext f) - ( translation-tuple Sg1 Sg2 ext v)) - -translation-tuple Sg1 Sg2 ext empty-tuple = empty-tuple -translation-tuple Sg1 Sg2 ext (x ∷ v) = - ( translation-term Sg1 Sg2 ext x) ∷ - ( translation-tuple Sg1 Sg2 ext v) + {l1 l2 : Level} → + (σ : signature l1) → + (τ : signature l2) → + {n : ℕ} → + is-extension-signature σ τ → + tuple (Term τ) n → tuple (Term σ) n + +translation-term σ τ ext (var-Term x) = var-Term x +translation-term σ τ ext (op-Term f v) = + op-Term (emb-extension-signature σ τ ext f) + ( tr (tuple (Term σ)) + ( arity-preserved-extension-signature σ τ ext f) + ( translation-tuple σ τ ext v)) + +translation-tuple σ τ ext empty-tuple = empty-tuple +translation-tuple σ τ ext (x ∷ v) = + ( translation-term σ τ ext x) ∷ + ( translation-tuple σ τ ext v) ``` From 61ea3d6c597f57e364712bd9389c4fd5d52787b3 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Sat, 6 Sep 2025 00:38:44 -0700 Subject: [PATCH 51/97] Supremum of a coproduct of families of real numbers (#1535) --- .../suprema-families-real-numbers.lagda.md | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/src/real-numbers/suprema-families-real-numbers.lagda.md b/src/real-numbers/suprema-families-real-numbers.lagda.md index 216204ba53..96a3faeb63 100644 --- a/src/real-numbers/suprema-families-real-numbers.lagda.md +++ b/src/real-numbers/suprema-families-real-numbers.lagda.md @@ -11,22 +11,31 @@ module real-numbers.suprema-families-real-numbers where ```agda open import elementary-number-theory.positive-rational-numbers +open import foundation.action-on-identifications-functions open import foundation.conjunction +open import foundation.coproduct-types open import foundation.dependent-pair-types +open import foundation.disjunction open import foundation.empty-types open import foundation.existential-quantification +open import foundation.identity-types open import foundation.logical-equivalences open import foundation.propositional-truncations open import foundation.propositions open import foundation.subtypes +open import foundation.transport-along-identifications +open import foundation.unit-type open import foundation.universe-levels open import order-theory.least-upper-bounds-large-posets open import order-theory.upper-bounds-large-posets +open import real-numbers.addition-real-numbers +open import real-numbers.binary-maximum-real-numbers open import real-numbers.dedekind-real-numbers open import real-numbers.difference-real-numbers open import real-numbers.inequality-real-numbers +open import real-numbers.negation-real-numbers open import real-numbers.positive-real-numbers open import real-numbers.rational-real-numbers open import real-numbers.similarity-real-numbers @@ -240,6 +249,109 @@ module _ elim-exists (le-prop-ℝ z x) (le-supremum-le-element-family-ℝ z) ``` +### If the families of real numbers `f` and `g` have suprema, so does `rec-coproduct f g` + +```agda +module _ + {l1 l2 l3 l4 l5 : Level} {I : UU l1} {J : UU l2} (f : I → ℝ l3) (g : J → ℝ l3) + where + + sup-rec-coproduct-max-supremum-family-ℝ : + (has-supremum-family-ℝ f l4) → (has-supremum-family-ℝ g l5) → + ℝ (l4 ⊔ l5) + sup-rec-coproduct-max-supremum-family-ℝ (x , _) (y , _) = + max-ℝ x y + + abstract + is-upper-bound-rec-coproduct-max-supremum-family-ℝ : + (H : has-supremum-family-ℝ f l4) → (K : has-supremum-family-ℝ g l5) → + is-upper-bound-family-of-elements-Large-Poset + ( ℝ-Large-Poset) + ( rec-coproduct f g) + ( sup-rec-coproduct-max-supremum-family-ℝ H K) + is-upper-bound-rec-coproduct-max-supremum-family-ℝ + (x , is-sup-f-x) (y , is-sup-g-y) (inl i) + = + transitive-leq-ℝ _ _ _ + ( leq-left-max-ℝ _ _) + ( is-upper-bound-is-supremum-family-ℝ f x is-sup-f-x i) + is-upper-bound-rec-coproduct-max-supremum-family-ℝ + (x , is-sup-f-x) (y , is-sup-g-y) (inr j) + = + transitive-leq-ℝ _ _ _ + ( leq-right-max-ℝ _ _) + ( is-upper-bound-is-supremum-family-ℝ g y is-sup-g-y j) + + is-approximated-below-rec-coproduct-max-supremum-family-ℝ : + (H : has-supremum-family-ℝ f l4) → (K : has-supremum-family-ℝ g l5) → + is-approximated-below-family-ℝ + ( rec-coproduct f g) + ( sup-rec-coproduct-max-supremum-family-ℝ H K) + is-approximated-below-rec-coproduct-max-supremum-family-ℝ + (x , is-sup-f-x) (y , is-sup-g-y) ε = + let + (ε₁ , ε₂ , ε₁+ε₂=ε) = split-ℚ⁺ ε + open do-syntax-trunc-Prop (∃ (I + J) _) + case : + {l : Level} → (k : I + J) → (w : ℝ l) → + le-ℝ (w -ℝ real-ℚ⁺ ε₂) (rec-coproduct f g k) → + le-ℝ (max-ℝ x y -ℝ real-ℚ⁺ ε₁) w → + le-ℝ (max-ℝ x y -ℝ real-ℚ⁺ ε) (rec-coproduct f g k) + case k w w-ε₂ Date: Sat, 6 Sep 2025 01:04:15 -0700 Subject: [PATCH 52/97] Metrics of metric spaces (#1532) Define the notion of a metric _of_ a metric space. --- src/metric-spaces.lagda.md | 1 + .../metrics-of-metric-spaces.lagda.md | 226 ++++++++++++++++++ src/metric-spaces/metrics.lagda.md | 17 ++ .../distance-real-numbers.lagda.md | 18 ++ .../inequality-real-numbers.lagda.md | 78 ++++++ .../nonnegative-real-numbers.lagda.md | 134 +++++++++++ .../similarity-real-numbers.lagda.md | 1 + .../strict-inequality-real-numbers.lagda.md | 66 +++++ 8 files changed, 541 insertions(+) create mode 100644 src/metric-spaces/metrics-of-metric-spaces.lagda.md diff --git a/src/metric-spaces.lagda.md b/src/metric-spaces.lagda.md index cf0307b7d6..4700b85087 100644 --- a/src/metric-spaces.lagda.md +++ b/src/metric-spaces.lagda.md @@ -100,6 +100,7 @@ open import metric-spaces.metric-space-of-rational-numbers public open import metric-spaces.metric-space-of-short-functions-metric-spaces public open import metric-spaces.metric-spaces public open import metric-spaces.metrics public +open import metric-spaces.metrics-of-metric-spaces public open import metric-spaces.monotonic-rational-neighborhood-relations public open import metric-spaces.nets-located-metric-spaces public open import metric-spaces.nets-metric-spaces public diff --git a/src/metric-spaces/metrics-of-metric-spaces.lagda.md b/src/metric-spaces/metrics-of-metric-spaces.lagda.md new file mode 100644 index 0000000000..7b15b986cc --- /dev/null +++ b/src/metric-spaces/metrics-of-metric-spaces.lagda.md @@ -0,0 +1,226 @@ +# Metrics of metric spaces + +```agda +module metric-spaces.metrics-of-metric-spaces where +``` + +
Imports + +```agda +open import elementary-number-theory.positive-rational-numbers + +open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.identity-types +open import foundation.logical-equivalences +open import foundation.propositional-truncations +open import foundation.propositions +open import foundation.sets +open import foundation.transport-along-identifications +open import foundation.universe-levels + +open import metric-spaces.equality-of-metric-spaces +open import metric-spaces.metric-spaces +open import metric-spaces.metrics + +open import real-numbers.nonnegative-real-numbers +open import real-numbers.strict-inequality-real-numbers +``` + +
+ +## Idea + +A function `ρ` from two elements of a +[metric space](metric-spaces.metric-spaces.md) `M` to the +[nonnegative real numbers](real-numbers.nonnegative-real-numbers.md) is a +{{#concept "metric" disambiguation="of a metric space" WD="metric function" WDID=Q865746 Agda=is-metric-Metric-Space}} +of `M` if for all +[positive rational numbers](elementary-number-theory.positive-rational-numbers.md) +`d` and all `x y : M`, `x` and `y` are in a `d`-neighborhood of each other in +`M` [if and only if](foundation.logical-equivalences.md) `ρ x y ≤ real-ℚ⁺ d`. + +It follows that `ρ` is a [metric](metric-spaces.metrics.md) on the +[set](foundation.sets.md) of elements of `M`, and that `M` is +[isometrically equivalent](metric-spaces.equality-of-metric-spaces.md) to the +metric space induced by `ρ`. + +## Definition + +```agda +module _ + {l1 l2 l3 : Level} (M : Metric-Space l1 l2) + (ρ : distance-function l3 (set-Metric-Space M)) + where + + is-metric-prop-Metric-Space : Prop (l1 ⊔ l2 ⊔ l3) + is-metric-prop-Metric-Space = + Π-Prop ℚ⁺ + ( λ d → + Π-Prop + ( type-Metric-Space M) + ( λ x → + Π-Prop + ( type-Metric-Space M) + ( λ y → + neighborhood-prop-Metric-Space M d x y ⇔ + leq-prop-ℝ⁰⁺ (ρ x y) (nonnegative-real-ℚ⁺ d)))) + + is-metric-of-Metric-Space : UU (l1 ⊔ l2 ⊔ l3) + is-metric-of-Metric-Space = type-Prop is-metric-prop-Metric-Space +``` + +## Properties + +### A metric is a metric of the metric space it induces + +```agda +module _ + {l1 l2 : Level} (X : Set l1) (ρ : Metric l2 X) + where + + is-metric-metric-space-Metric : + is-metric-of-Metric-Space + ( metric-space-Metric X ρ) + ( dist-Metric X ρ) + is-metric-metric-space-Metric _ _ _ = id-iff +``` + +### If `ρ` is a metric for a metric space, it is a metric + +```agda +module _ + {l1 l2 l3 : Level} (M : Metric-Space l1 l2) + (ρ : distance-function l3 (set-Metric-Space M)) + (is-metric-M-ρ : is-metric-of-Metric-Space M ρ) + where + + abstract + is-reflexive-is-metric-of-Metric-Space : + is-reflexive-distance-function (set-Metric-Space M) ρ + is-reflexive-is-metric-of-Metric-Space x = + sim-zero-le-positive-rational-ℝ⁰⁺ + ( ρ x x) + ( λ ε → + forward-implication + ( is-metric-M-ρ ε x x) + ( refl-neighborhood-Metric-Space M ε x)) + + is-symmetric-is-metric-of-Metric-Space : + is-symmetric-distance-function (set-Metric-Space M) ρ + is-symmetric-is-metric-of-Metric-Space x y = + eq-sim-ℝ⁰⁺ (ρ x y) (ρ y x) + ( sim-leq-same-positive-rational-ℝ⁰⁺ (ρ x y) (ρ y x) + ( λ d → + is-metric-M-ρ d y x ∘iff + ( symmetric-neighborhood-Metric-Space M d x y , + symmetric-neighborhood-Metric-Space M d y x) ∘iff + inv-iff (is-metric-M-ρ d x y))) + + is-triangular-is-metric-of-Metric-Space : + is-triangular-distance-function (set-Metric-Space M) ρ + is-triangular-is-metric-of-Metric-Space x y z = + leq-le-positive-rational-ℝ⁰⁺ (ρ x z) (ρ x y +ℝ⁰⁺ ρ y z) + ( λ d ρxy+ρyzImports ```agda +open import elementary-number-theory.inequality-rational-numbers open import elementary-number-theory.nonnegative-rational-numbers open import elementary-number-theory.positive-rational-numbers open import elementary-number-theory.rational-numbers +open import elementary-number-theory.strict-inequality-rational-numbers +open import foundation.coproduct-types open import foundation.dependent-pair-types +open import foundation.empty-types open import foundation.existential-quantification +open import foundation.function-types open import foundation.identity-types +open import foundation.logical-equivalences +open import foundation.negation open import foundation.propositional-truncations open import foundation.propositions open import foundation.sets @@ -397,3 +404,130 @@ abstract add-nonnegative-real-ℚ⁺ p q = eq-ℝ⁰⁺ _ _ (add-real-ℚ (rational-ℚ⁺ p) (rational-ℚ⁺ q)) ``` + +### Nonpositive rational numbers are not less than or equal to nonnegative real numbers + +```agda +module _ + {l : Level} (x : ℝ⁰⁺ l) (q : ℚ) + where + + abstract + not-le-leq-zero-rational-ℝ⁰⁺ : + leq-ℚ q zero-ℚ → ¬ (le-ℝ (real-ℝ⁰⁺ x) (real-ℚ q)) + not-le-leq-zero-rational-ℝ⁰⁺ q≤0 x Date: Sat, 6 Sep 2025 01:08:33 -0700 Subject: [PATCH 53/97] Inhabited finitely enumerable subtypes (#1530) The previously mentioned follow up from #1523 . --- src/metric-spaces/nets-metric-spaces.lagda.md | 11 +- src/real-numbers.lagda.md | 5 +- ...y-enumerable-subsets-real-numbers.lagda.md | 9 -- ...y-enumerable-subsets-real-numbers.lagda.md | 90 +++++++++++++ ...-enumerable-subsets-real-numbers.lagda.md} | 75 ++++++----- ...-enumerable-subsets-real-numbers.lagda.md} | 83 ++++++------ ...ally-bounded-subsets-real-numbers.lagda.md | 44 ++----- src/univalent-combinatorics.lagda.md | 2 + .../finitely-enumerable-subtypes.lagda.md | 18 +-- ...ited-finitely-enumerable-subtypes.lagda.md | 118 ++++++++++++++++++ ...habited-finitely-enumerable-types.lagda.md | 94 ++++++++++++++ 11 files changed, 410 insertions(+), 139 deletions(-) create mode 100644 src/real-numbers/inhabited-finitely-enumerable-subsets-real-numbers.lagda.md rename src/real-numbers/{maximum-finitely-enumerable-subsets-real-numbers.lagda.md => maximum-inhabited-finitely-enumerable-subsets-real-numbers.lagda.md} (77%) rename src/real-numbers/{minimum-finitely-enumerable-subsets-real-numbers.lagda.md => minimum-inhabited-finitely-enumerable-subsets-real-numbers.lagda.md} (51%) create mode 100644 src/univalent-combinatorics/inhabited-finitely-enumerable-subtypes.lagda.md create mode 100644 src/univalent-combinatorics/inhabited-finitely-enumerable-types.lagda.md diff --git a/src/metric-spaces/nets-metric-spaces.lagda.md b/src/metric-spaces/nets-metric-spaces.lagda.md index a313ff780e..16b79aa421 100644 --- a/src/metric-spaces/nets-metric-spaces.lagda.md +++ b/src/metric-spaces/nets-metric-spaces.lagda.md @@ -30,6 +30,7 @@ open import metric-spaces.uniformly-continuous-functions-metric-spaces open import univalent-combinatorics.finitely-enumerable-subtypes open import univalent-combinatorics.finitely-enumerable-types +open import univalent-combinatorics.inhabited-finitely-enumerable-subtypes ```
@@ -103,6 +104,12 @@ module _ is-inhabited-is-approximation-inhabited-Metric-Space X |X| ε ( subset-net-Metric-Space X ε S) ( is-approximation-subset-net-Metric-Space X ε S) + + inhabited-finitely-enumerable-subtype-net-Metric-Space : + inhabited-finitely-enumerable-subtype l3 (type-Metric-Space X) + inhabited-finitely-enumerable-subtype-net-Metric-Space = + ( finitely-enumerable-subset-net-Metric-Space X ε S , + is-inhabited-net-inhabited-Metric-Space) ``` ## Properties @@ -121,7 +128,7 @@ module _ net-im-uniformly-continuous-function-net-Metric-Space : net-Metric-Space (l1 ⊔ l3 ⊔ l5) (im-Metric-Space X Y f) ε net-im-uniformly-continuous-function-net-Metric-Space = - ( finitely-enumerable-subtype-im-finitely-enumerable-subtype + ( im-finitely-enumerable-subtype ( map-unit-im f) ( finitely-enumerable-subset-net-Metric-Space X (μ ε) N) , is-approximation-im-uniformly-continuous-function-approximation-Metric-Space @@ -193,7 +200,7 @@ module _ net-im-isometric-equiv-net-Metric-Space : net-Metric-Space (l1 ⊔ l3 ⊔ l5) Y ε net-im-isometric-equiv-net-Metric-Space = - ( finitely-enumerable-subtype-im-finitely-enumerable-subtype + ( im-finitely-enumerable-subtype ( map-isometric-equiv-Metric-Space X Y f) ( finitely-enumerable-subset-net-Metric-Space X ε N) , is-approximation-im-isometric-equiv-approximation-Metric-Space X Y f ε diff --git a/src/real-numbers.lagda.md b/src/real-numbers.lagda.md index 419a418c0c..1ddc758600 100644 --- a/src/real-numbers.lagda.md +++ b/src/real-numbers.lagda.md @@ -22,16 +22,17 @@ open import real-numbers.inequality-lower-dedekind-real-numbers public open import real-numbers.inequality-real-numbers public open import real-numbers.inequality-upper-dedekind-real-numbers public open import real-numbers.infima-families-real-numbers public +open import real-numbers.inhabited-finitely-enumerable-subsets-real-numbers public open import real-numbers.isometry-addition-real-numbers public open import real-numbers.isometry-negation-real-numbers public open import real-numbers.lower-dedekind-real-numbers public open import real-numbers.maximum-finite-families-real-numbers public -open import real-numbers.maximum-finitely-enumerable-subsets-real-numbers public +open import real-numbers.maximum-inhabited-finitely-enumerable-subsets-real-numbers public open import real-numbers.maximum-lower-dedekind-real-numbers public open import real-numbers.maximum-upper-dedekind-real-numbers public open import real-numbers.metric-space-of-real-numbers public open import real-numbers.minimum-finite-families-real-numbers public -open import real-numbers.minimum-finitely-enumerable-subsets-real-numbers public +open import real-numbers.minimum-inhabited-finitely-enumerable-subsets-real-numbers public open import real-numbers.minimum-lower-dedekind-real-numbers public open import real-numbers.minimum-upper-dedekind-real-numbers public open import real-numbers.negation-lower-upper-dedekind-real-numbers public diff --git a/src/real-numbers/finitely-enumerable-subsets-real-numbers.lagda.md b/src/real-numbers/finitely-enumerable-subsets-real-numbers.lagda.md index bda23e1af7..09800cc68a 100644 --- a/src/real-numbers/finitely-enumerable-subsets-real-numbers.lagda.md +++ b/src/real-numbers/finitely-enumerable-subsets-real-numbers.lagda.md @@ -61,15 +61,6 @@ module _ ## Properties -### The property of being inhabited - -```agda -is-inhabited-finitely-enumerable-subset-ℝ : - {l1 l2 : Level} → finitely-enumerable-subset-ℝ l1 l2 → UU (l1 ⊔ lsuc l2) -is-inhabited-finitely-enumerable-subset-ℝ = - is-inhabited-finitely-enumerable-subtype -``` - ### The elementwise negation of a finitely enumerable subset of real numbers ```agda diff --git a/src/real-numbers/inhabited-finitely-enumerable-subsets-real-numbers.lagda.md b/src/real-numbers/inhabited-finitely-enumerable-subsets-real-numbers.lagda.md new file mode 100644 index 0000000000..25a57c6ed1 --- /dev/null +++ b/src/real-numbers/inhabited-finitely-enumerable-subsets-real-numbers.lagda.md @@ -0,0 +1,90 @@ +# Inhabited finitely enumerable subsets of the real numbers + +```agda +module real-numbers.inhabited-finitely-enumerable-subsets-real-numbers where +``` + +
Imports + +```agda +open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.inhabited-types +open import foundation.involutions +open import foundation.subtypes +open import foundation.universe-levels + +open import real-numbers.dedekind-real-numbers +open import real-numbers.finitely-enumerable-subsets-real-numbers +open import real-numbers.negation-real-numbers +open import real-numbers.subsets-real-numbers + +open import univalent-combinatorics.finitely-enumerable-subtypes +open import univalent-combinatorics.finitely-enumerable-types +open import univalent-combinatorics.inhabited-finitely-enumerable-subtypes +``` + +
+ +## Idea + +An +{{#concept "inhabited finitely enumerable subset" Agda=inhabited-finitely-enumerable-subtype}} +of the [real numbers](real-numbers.dedekind-real-numbers.md) is a +[subtype](foundation.subtypes.md) of `ℝ` that is +[inhabited and finitely enumerable](univalent-combinatorics.inhabited-finitely-enumerable-subtypes.md). + +## Definition + +```agda +inhabited-finitely-enumerable-subset-ℝ : + (l1 l2 : Level) → UU (lsuc l1 ⊔ lsuc l2) +inhabited-finitely-enumerable-subset-ℝ l1 l2 = + inhabited-finitely-enumerable-subtype l1 (ℝ l2) + +module _ + {l1 l2 : Level} (S : inhabited-finitely-enumerable-subset-ℝ l1 l2) + where + + subset-inhabited-finitely-enumerable-subset-ℝ : subset-ℝ l1 l2 + subset-inhabited-finitely-enumerable-subset-ℝ = + subtype-inhabited-finitely-enumerable-subtype S + + type-inhabited-finitely-enumerable-subset-ℝ : UU (l1 ⊔ lsuc l2) + type-inhabited-finitely-enumerable-subset-ℝ = + type-inhabited-finitely-enumerable-subtype S + + is-finitely-enumerable-inhabited-finitely-enumerable-subset-ℝ : + is-finitely-enumerable-subtype subset-inhabited-finitely-enumerable-subset-ℝ + is-finitely-enumerable-inhabited-finitely-enumerable-subset-ℝ = + is-finitely-enumerable-type-inhabited-finitely-enumerable-subtype S + + inclusion-inhabited-finitely-enumerable-subset-ℝ : + type-inhabited-finitely-enumerable-subset-ℝ → ℝ l2 + inclusion-inhabited-finitely-enumerable-subset-ℝ = + inclusion-subtype subset-inhabited-finitely-enumerable-subset-ℝ + + is-inhabited-inhabited-finitely-enumerable-subset-ℝ : + is-inhabited type-inhabited-finitely-enumerable-subset-ℝ + is-inhabited-inhabited-finitely-enumerable-subset-ℝ = + is-inhabited-type-inhabited-finitely-enumerable-subtype S +``` + +## Properties + +### The elementwise negation of an inhabited finitely enumerable subset of real numbers + +```agda +neg-inhabited-finitely-enumerable-subset-ℝ : + {l1 l2 : Level} → + inhabited-finitely-enumerable-subset-ℝ l1 l2 → + inhabited-finitely-enumerable-subset-ℝ l1 l2 +neg-inhabited-finitely-enumerable-subset-ℝ (S , |S|) = + ( neg-finitely-enumerable-subset-ℝ S , + map-is-inhabited + ( map-equiv + ( equiv-precomp-equiv-type-subtype + ( equiv-is-involution neg-neg-ℝ) + ( subset-finitely-enumerable-subset-ℝ S))) + ( |S|)) +``` diff --git a/src/real-numbers/maximum-finitely-enumerable-subsets-real-numbers.lagda.md b/src/real-numbers/maximum-inhabited-finitely-enumerable-subsets-real-numbers.lagda.md similarity index 77% rename from src/real-numbers/maximum-finitely-enumerable-subsets-real-numbers.lagda.md rename to src/real-numbers/maximum-inhabited-finitely-enumerable-subsets-real-numbers.lagda.md index c05c9a7ad1..285d793c41 100644 --- a/src/real-numbers/maximum-finitely-enumerable-subsets-real-numbers.lagda.md +++ b/src/real-numbers/maximum-inhabited-finitely-enumerable-subsets-real-numbers.lagda.md @@ -1,9 +1,9 @@ -# The maximum of finitely enumerable subsets of real numbers +# The maximum of inhabited, finitely enumerable subsets of real numbers ```agda {-# OPTIONS --lossy-unification #-} -module real-numbers.maximum-finitely-enumerable-subsets-real-numbers where +module real-numbers.maximum-inhabited-finitely-enumerable-subsets-real-numbers where ```
Imports @@ -27,8 +27,8 @@ open import order-theory.least-upper-bounds-large-posets open import order-theory.upper-bounds-large-posets open import real-numbers.dedekind-real-numbers -open import real-numbers.finitely-enumerable-subsets-real-numbers open import real-numbers.inequality-real-numbers +open import real-numbers.inhabited-finitely-enumerable-subsets-real-numbers open import real-numbers.maximum-finite-families-real-numbers open import real-numbers.subsets-real-numbers open import real-numbers.suprema-families-real-numbers @@ -42,9 +42,9 @@ open import univalent-combinatorics.finitely-enumerable-types ## Idea The -{{#concept "maximum" Disambiguation="finitely enumerable subset of Dedekind real numbers" Agda=max-inhabited-finitely-enumerable-subset-ℝ WD="maximum" WDID=Q10578722}} -of a -[finitely enumerable subset of the real numbers](real-numbers.finitely-enumerable-subsets-real-numbers.md) +{{#concept "maximum" Disambiguation="inhabited, finitely enumerable subset of Dedekind real numbers" Agda=max-inhabited-finitely-enumerable-subset-ℝ WD="maximum" WDID=Q10578722}} +of an +[inhabited, finitely enumerable subset of the real numbers](real-numbers.inhabited-finitely-enumerable-subsets-real-numbers.md) is their [supremum](real-numbers.suprema-families-real-numbers.md). ## Subsets with finite enumerations @@ -181,22 +181,23 @@ has-supremum-is-inhabited-finite-enumeration-subset-ℝ S eS |S| = ```agda module _ - {l1 l2 : Level} (S : finitely-enumerable-subset-ℝ l1 l2) - (|S| : is-inhabited-finitely-enumerable-subset-ℝ S) + {l1 l2 : Level} (S : inhabited-finitely-enumerable-subset-ℝ l1 l2) where abstract has-supremum-inhabited-finitely-enumerable-subset-ℝ : - has-supremum-subset-ℝ (subset-finitely-enumerable-subset-ℝ S) l2 + has-supremum-subset-ℝ (subset-inhabited-finitely-enumerable-subset-ℝ S) l2 has-supremum-inhabited-finitely-enumerable-subset-ℝ = rec-trunc-Prop - ( has-supremum-prop-subset-ℝ (subset-finitely-enumerable-subset-ℝ S) l2) + ( has-supremum-prop-subset-ℝ + ( subset-inhabited-finitely-enumerable-subset-ℝ S) + ( l2)) ( λ eS → has-supremum-is-inhabited-finite-enumeration-subset-ℝ - ( subset-finitely-enumerable-subset-ℝ S) + ( subset-inhabited-finitely-enumerable-subset-ℝ S) ( eS) - ( |S|)) - ( is-finitely-enumerable-finitely-enumerable-subset-ℝ S) + ( is-inhabited-inhabited-finitely-enumerable-subset-ℝ S)) + ( is-finitely-enumerable-inhabited-finitely-enumerable-subset-ℝ S) opaque max-inhabited-finitely-enumerable-subset-ℝ : ℝ l2 @@ -210,8 +211,7 @@ module _ ```agda module _ - {l1 l2 : Level} (S : finitely-enumerable-subset-ℝ l1 l2) - (|S| : is-inhabited-finitely-enumerable-subset-ℝ S) + {l1 l2 : Level} (S : inhabited-finitely-enumerable-subset-ℝ l1 l2) where opaque @@ -219,70 +219,67 @@ module _ is-supremum-max-inhabited-finitely-enumerable-subset-ℝ : is-supremum-subset-ℝ - ( subset-finitely-enumerable-subset-ℝ S) - ( max-inhabited-finitely-enumerable-subset-ℝ S |S|) + ( subset-inhabited-finitely-enumerable-subset-ℝ S) + ( max-inhabited-finitely-enumerable-subset-ℝ S) is-supremum-max-inhabited-finitely-enumerable-subset-ℝ = - pr2 (has-supremum-inhabited-finitely-enumerable-subset-ℝ S |S|) + pr2 (has-supremum-inhabited-finitely-enumerable-subset-ℝ S) ``` #### The maximum is a least upper bound ```agda module _ - {l1 l2 : Level} (S : finitely-enumerable-subset-ℝ l1 l2) - (|S| : is-inhabited-finitely-enumerable-subset-ℝ S) + {l1 l2 : Level} (S : inhabited-finitely-enumerable-subset-ℝ l1 l2) where abstract is-least-upper-bound-max-inhabited-finitely-enumerable-subset-ℝ : is-least-upper-bound-family-of-elements-Large-Poset ( ℝ-Large-Poset) - ( inclusion-finitely-enumerable-subset-ℝ S) - ( max-inhabited-finitely-enumerable-subset-ℝ S |S|) + ( inclusion-inhabited-finitely-enumerable-subset-ℝ S) + ( max-inhabited-finitely-enumerable-subset-ℝ S) is-least-upper-bound-max-inhabited-finitely-enumerable-subset-ℝ = is-least-upper-bound-is-supremum-family-ℝ - ( inclusion-finitely-enumerable-subset-ℝ S) - ( max-inhabited-finitely-enumerable-subset-ℝ S |S|) - ( is-supremum-max-inhabited-finitely-enumerable-subset-ℝ S |S|) + ( inclusion-inhabited-finitely-enumerable-subset-ℝ S) + ( max-inhabited-finitely-enumerable-subset-ℝ S) + ( is-supremum-max-inhabited-finitely-enumerable-subset-ℝ S) ``` #### The maximum is approximated below ```agda module _ - {l1 l2 : Level} (S : finitely-enumerable-subset-ℝ l1 l2) - (|S| : is-inhabited-finitely-enumerable-subset-ℝ S) + {l1 l2 : Level} (S : inhabited-finitely-enumerable-subset-ℝ l1 l2) where abstract is-approximated-below-max-inhabited-finitely-enumerable-subset-ℝ : is-approximated-below-family-ℝ - ( inclusion-finitely-enumerable-subset-ℝ S) - ( max-inhabited-finitely-enumerable-subset-ℝ S |S|) + ( inclusion-inhabited-finitely-enumerable-subset-ℝ S) + ( max-inhabited-finitely-enumerable-subset-ℝ S) is-approximated-below-max-inhabited-finitely-enumerable-subset-ℝ = is-approximated-below-is-supremum-family-ℝ - ( inclusion-finitely-enumerable-subset-ℝ S) - ( max-inhabited-finitely-enumerable-subset-ℝ S |S|) - ( is-supremum-max-inhabited-finitely-enumerable-subset-ℝ S |S|) + ( inclusion-inhabited-finitely-enumerable-subset-ℝ S) + ( max-inhabited-finitely-enumerable-subset-ℝ S) + ( is-supremum-max-inhabited-finitely-enumerable-subset-ℝ S) ``` #### The maximum is an upper bound ```agda module _ - {l1 l2 : Level} (S : finitely-enumerable-subset-ℝ l1 l2) - (|S| : is-inhabited-finitely-enumerable-subset-ℝ S) + {l1 l2 : Level} (S : inhabited-finitely-enumerable-subset-ℝ l1 l2) where abstract is-upper-bound-max-inhabited-finitely-enumerable-subset-ℝ : is-upper-bound-family-of-elements-Large-Poset ( ℝ-Large-Poset) - ( inclusion-finitely-enumerable-subset-ℝ S) - ( max-inhabited-finitely-enumerable-subset-ℝ S |S|) + ( inclusion-inhabited-finitely-enumerable-subset-ℝ S) + ( max-inhabited-finitely-enumerable-subset-ℝ S) is-upper-bound-max-inhabited-finitely-enumerable-subset-ℝ = is-upper-bound-is-supremum-family-ℝ - ( inclusion-finitely-enumerable-subset-ℝ S) - ( max-inhabited-finitely-enumerable-subset-ℝ S |S|) - ( is-supremum-max-inhabited-finitely-enumerable-subset-ℝ S |S|) + ( inclusion-inhabited-finitely-enumerable-subset-ℝ S) + ( max-inhabited-finitely-enumerable-subset-ℝ S) + ( is-supremum-max-inhabited-finitely-enumerable-subset-ℝ S) ``` diff --git a/src/real-numbers/minimum-finitely-enumerable-subsets-real-numbers.lagda.md b/src/real-numbers/minimum-inhabited-finitely-enumerable-subsets-real-numbers.lagda.md similarity index 51% rename from src/real-numbers/minimum-finitely-enumerable-subsets-real-numbers.lagda.md rename to src/real-numbers/minimum-inhabited-finitely-enumerable-subsets-real-numbers.lagda.md index 7bd34bca18..5909da62ca 100644 --- a/src/real-numbers/minimum-finitely-enumerable-subsets-real-numbers.lagda.md +++ b/src/real-numbers/minimum-inhabited-finitely-enumerable-subsets-real-numbers.lagda.md @@ -1,9 +1,9 @@ -# The minimum of finitely enumerable subsets of real numbers +# The minimum of inhabited, finitely enumerable subsets of real numbers ```agda {-# OPTIONS --lossy-unification #-} -module real-numbers.minimum-finitely-enumerable-subsets-real-numbers where +module real-numbers.minimum-inhabited-finitely-enumerable-subsets-real-numbers where ```
Imports @@ -16,10 +16,10 @@ open import order-theory.greatest-lower-bounds-large-posets open import order-theory.lower-bounds-large-posets open import real-numbers.dedekind-real-numbers -open import real-numbers.finitely-enumerable-subsets-real-numbers open import real-numbers.inequality-real-numbers open import real-numbers.infima-families-real-numbers -open import real-numbers.maximum-finitely-enumerable-subsets-real-numbers +open import real-numbers.inhabited-finitely-enumerable-subsets-real-numbers +open import real-numbers.maximum-inhabited-finitely-enumerable-subsets-real-numbers open import real-numbers.negation-real-numbers open import real-numbers.subsets-real-numbers @@ -31,17 +31,16 @@ open import univalent-combinatorics.finitely-enumerable-subtypes ## Idea The -{{#concept "minimum" Disambiguation="finitely enumerable subset of Dedekind real numbers" Agda=min-inhabited-finitely-enumerable-subset-ℝ WD="minimum" WDID=Q10585806}} -of a -[finitely enumerable subset of the real numbers](real-numbers.finitely-enumerable-subsets-real-numbers.md) +{{#concept "minimum" Disambiguation="inhabited finitely enumerable subset of Dedekind real numbers" Agda=min-inhabited-finitely-enumerable-subset-ℝ WD="minimum" WDID=Q10585806}} +of an +[inhabited, finitely enumerable subset of the real numbers](real-numbers.inhabited-finitely-enumerable-subsets-real-numbers.md) is their [infimum](real-numbers.infima-families-real-numbers.md). ## Definition ```agda module _ - {l1 l2 : Level} (S : finitely-enumerable-subset-ℝ l1 l2) - (|S| : is-inhabited-finitely-enumerable-subset-ℝ S) + {l1 l2 : Level} (S : inhabited-finitely-enumerable-subset-ℝ l1 l2) where opaque @@ -49,10 +48,7 @@ module _ min-inhabited-finitely-enumerable-subset-ℝ = neg-ℝ ( max-inhabited-finitely-enumerable-subset-ℝ - ( neg-finitely-enumerable-subset-ℝ S) - ( neg-is-inhabited-subset-ℝ - ( subset-finitely-enumerable-subset-ℝ S) - ( |S|))) + ( neg-inhabited-finitely-enumerable-subset-ℝ S)) ``` ## Properties @@ -61,8 +57,7 @@ module _ ```agda module _ - {l1 l2 : Level} (S : finitely-enumerable-subset-ℝ l1 l2) - (|S| : is-inhabited-finitely-enumerable-subset-ℝ S) + {l1 l2 : Level} (S : inhabited-finitely-enumerable-subset-ℝ l1 l2) where opaque @@ -70,88 +65,84 @@ module _ is-infimum-min-inhabited-finitely-enumerable-subset-ℝ : is-infimum-subset-ℝ - ( subset-finitely-enumerable-subset-ℝ S) - ( min-inhabited-finitely-enumerable-subset-ℝ S |S|) + ( subset-inhabited-finitely-enumerable-subset-ℝ S) + ( min-inhabited-finitely-enumerable-subset-ℝ S) is-infimum-min-inhabited-finitely-enumerable-subset-ℝ = is-infimum-neg-supremum-neg-subset-ℝ - ( subset-finitely-enumerable-subset-ℝ S) - ( max-inhabited-finitely-enumerable-subset-ℝ _ _) - ( is-supremum-max-inhabited-finitely-enumerable-subset-ℝ _ _) + ( subset-inhabited-finitely-enumerable-subset-ℝ S) + ( max-inhabited-finitely-enumerable-subset-ℝ _) + ( is-supremum-max-inhabited-finitely-enumerable-subset-ℝ _) ``` ### Finitely enumerable subsets of the real numbers have an infimum ```agda module _ - {l1 l2 : Level} (S : finitely-enumerable-subset-ℝ l1 l2) - (|S| : is-inhabited-finitely-enumerable-subset-ℝ S) + {l1 l2 : Level} (S : inhabited-finitely-enumerable-subset-ℝ l1 l2) where has-infimum-inhabited-finitely-enumerable-subset-ℝ : - has-infimum-subset-ℝ (subset-finitely-enumerable-subset-ℝ S) l2 + has-infimum-subset-ℝ (subset-inhabited-finitely-enumerable-subset-ℝ S) l2 has-infimum-inhabited-finitely-enumerable-subset-ℝ = - ( min-inhabited-finitely-enumerable-subset-ℝ S |S| , - is-infimum-min-inhabited-finitely-enumerable-subset-ℝ S |S|) + ( min-inhabited-finitely-enumerable-subset-ℝ S , + is-infimum-min-inhabited-finitely-enumerable-subset-ℝ S) ``` ### The minimum is the greatest lower bound ```agda module _ - {l1 l2 : Level} (S : finitely-enumerable-subset-ℝ l1 l2) - (|S| : is-inhabited-finitely-enumerable-subset-ℝ S) + {l1 l2 : Level} (S : inhabited-finitely-enumerable-subset-ℝ l1 l2) where abstract is-greatest-lower-bound-min-inhabited-finitely-enumerable-subset-ℝ : is-greatest-lower-bound-family-of-elements-Large-Poset ( ℝ-Large-Poset) - ( inclusion-finitely-enumerable-subset-ℝ S) - ( min-inhabited-finitely-enumerable-subset-ℝ S |S|) + ( inclusion-inhabited-finitely-enumerable-subset-ℝ S) + ( min-inhabited-finitely-enumerable-subset-ℝ S) is-greatest-lower-bound-min-inhabited-finitely-enumerable-subset-ℝ = is-greatest-lower-bound-is-infimum-family-ℝ - ( inclusion-finitely-enumerable-subset-ℝ S) - ( min-inhabited-finitely-enumerable-subset-ℝ S |S|) - ( is-infimum-min-inhabited-finitely-enumerable-subset-ℝ S |S|) + ( inclusion-inhabited-finitely-enumerable-subset-ℝ S) + ( min-inhabited-finitely-enumerable-subset-ℝ S) + ( is-infimum-min-inhabited-finitely-enumerable-subset-ℝ S) ``` ### The minimum is a lower bound ```agda module _ - {l1 l2 : Level} (S : finitely-enumerable-subset-ℝ l1 l2) - (|S| : is-inhabited-finitely-enumerable-subset-ℝ S) + {l1 l2 : Level} (S : inhabited-finitely-enumerable-subset-ℝ l1 l2) where abstract is-lower-bound-min-inhabited-finitely-enumerable-subset-ℝ : is-lower-bound-family-of-elements-Large-Poset ( ℝ-Large-Poset) - ( inclusion-finitely-enumerable-subset-ℝ S) - ( min-inhabited-finitely-enumerable-subset-ℝ S |S|) + ( inclusion-inhabited-finitely-enumerable-subset-ℝ S) + ( min-inhabited-finitely-enumerable-subset-ℝ S) is-lower-bound-min-inhabited-finitely-enumerable-subset-ℝ = is-lower-bound-is-infimum-family-ℝ - ( inclusion-finitely-enumerable-subset-ℝ S) - ( min-inhabited-finitely-enumerable-subset-ℝ S |S|) - ( is-infimum-min-inhabited-finitely-enumerable-subset-ℝ S |S|) + ( inclusion-inhabited-finitely-enumerable-subset-ℝ S) + ( min-inhabited-finitely-enumerable-subset-ℝ S) + ( is-infimum-min-inhabited-finitely-enumerable-subset-ℝ S) ``` ### The minimum is approximated above ```agda module _ - {l1 l2 : Level} (S : finitely-enumerable-subset-ℝ l1 l2) - (|S| : is-inhabited-finitely-enumerable-subset-ℝ S) + {l1 l2 : Level} (S : inhabited-finitely-enumerable-subset-ℝ l1 l2) where abstract is-approximated-above-min-inhabited-finitely-enumerable-subset-ℝ : is-approximated-above-family-ℝ - ( inclusion-finitely-enumerable-subset-ℝ S) - ( min-inhabited-finitely-enumerable-subset-ℝ S |S|) + ( inclusion-inhabited-finitely-enumerable-subset-ℝ S) + ( min-inhabited-finitely-enumerable-subset-ℝ S) is-approximated-above-min-inhabited-finitely-enumerable-subset-ℝ = is-approximated-above-is-infimum-family-ℝ - ( inclusion-finitely-enumerable-subset-ℝ S) - ( min-inhabited-finitely-enumerable-subset-ℝ S |S|) - ( is-infimum-min-inhabited-finitely-enumerable-subset-ℝ S |S|) + ( inclusion-inhabited-finitely-enumerable-subset-ℝ S) + ( min-inhabited-finitely-enumerable-subset-ℝ S) + ( is-infimum-min-inhabited-finitely-enumerable-subset-ℝ S) ``` diff --git a/src/real-numbers/totally-bounded-subsets-real-numbers.lagda.md b/src/real-numbers/totally-bounded-subsets-real-numbers.lagda.md index f642ceb39b..6d54fb7ffe 100644 --- a/src/real-numbers/totally-bounded-subsets-real-numbers.lagda.md +++ b/src/real-numbers/totally-bounded-subsets-real-numbers.lagda.md @@ -39,11 +39,11 @@ open import real-numbers.addition-real-numbers open import real-numbers.cauchy-completeness-dedekind-real-numbers open import real-numbers.dedekind-real-numbers open import real-numbers.difference-real-numbers -open import real-numbers.finitely-enumerable-subsets-real-numbers open import real-numbers.inequality-real-numbers open import real-numbers.infima-families-real-numbers +open import real-numbers.inhabited-finitely-enumerable-subsets-real-numbers open import real-numbers.isometry-negation-real-numbers -open import real-numbers.maximum-finitely-enumerable-subsets-real-numbers +open import real-numbers.maximum-inhabited-finitely-enumerable-subsets-real-numbers open import real-numbers.metric-space-of-real-numbers open import real-numbers.negation-real-numbers open import real-numbers.positive-real-numbers @@ -52,7 +52,7 @@ open import real-numbers.strict-inequality-real-numbers open import real-numbers.subsets-real-numbers open import real-numbers.suprema-families-real-numbers -open import univalent-combinatorics.finitely-enumerable-subtypes +open import univalent-combinatorics.inhabited-finitely-enumerable-subtypes ```
@@ -156,47 +156,30 @@ module _ where private - net : ℚ⁺ → finitely-enumerable-subset-ℝ (l1 ⊔ lsuc l2 ⊔ l3) l2 + net : ℚ⁺ → inhabited-finitely-enumerable-subset-ℝ (l1 ⊔ lsuc l2 ⊔ l3) l2 net δ = - finitely-enumerable-subtype-im-finitely-enumerable-subtype + im-inhabited-finitely-enumerable-subtype ( inclusion-subset-ℝ S) - ( finitely-enumerable-subset-net-Metric-Space - ( metric-space-subset-ℝ S) - ( δ) - ( M δ)) + ( inhabited-finitely-enumerable-subtype-net-Metric-Space + ( metric-space-subset-ℝ S) |S| δ (M δ)) is-net : (δ : ℚ⁺) → is-approximation-Metric-Space ( metric-space-subset-ℝ S) ( δ) - ( subtype-finitely-enumerable-subtype (pr1 (M δ))) + ( subset-net-Metric-Space (metric-space-subset-ℝ S) δ (M δ)) is-net δ = pr2 (M δ) net⊆S : - (δ : ℚ⁺) → (subset-finitely-enumerable-subset-ℝ (net δ)) ⊆ S + (δ : ℚ⁺) → (subset-inhabited-finitely-enumerable-subset-ℝ (net δ)) ⊆ S net⊆S δ n = rec-trunc-Prop ( S n) ( λ z → tr (type-Prop ∘ S) (pr2 z) (pr2 (pr1 (pr1 z)))) - is-inhabited-net : - (δ : ℚ⁺) → - is-inhabited-finitely-enumerable-subset-ℝ (net δ) - is-inhabited-net δ = - map-is-inhabited - ( map-unit-im (pr1 ∘ pr1)) - ( is-inhabited-net-inhabited-Metric-Space - ( metric-space-subset-ℝ S) - ( |S|) - ( δ) - ( M δ)) - max-net : ℚ⁺ → ℝ l2 - max-net δ = - max-inhabited-finitely-enumerable-subset-ℝ - ( net δ) - ( is-inhabited-net δ) + max-net δ = max-inhabited-finitely-enumerable-subset-ℝ (net δ) abstract cauchy-approximation-sup-modulated-totally-bounded-subset-ℝ : @@ -208,7 +191,6 @@ module _ forward-implication ( is-least-upper-bound-max-inhabited-finitely-enumerable-subset-ℝ ( net ε) - ( is-inhabited-net ε) ( max-net η +ℝ real-ℚ⁺ η)) ( λ (z , z∈net-ε) → let @@ -228,8 +210,7 @@ module _ ( max-net η) ( is-upper-bound-max-inhabited-finitely-enumerable-subset-ℝ ( net η) - ( is-inhabited-net η) - ( map-unit-im (pr1 ∘ pr1) ((y , y∈S) , y∈net-η)))) + ( map-unit-im (pr1 ∘ pr1) (((y , y∈S) , y∈net-η))))) ( right-leq-real-bound-neighborhood-ℝ η _ _ Nηyz)) in ( max-net , @@ -297,7 +278,6 @@ module _ ( ε'))) ( is-upper-bound-max-inhabited-finitely-enumerable-subset-ℝ ( net ε') - ( is-inhabited-net ε') ( map-unit-im ( pr1 ∘ pr1) ( (y , y∈S) , y∈net-ε')))))) @@ -324,7 +304,7 @@ module _ ((x , x∈net-ε') , max-net-ε'-ε'Imports + +```agda +open import elementary-number-theory.natural-numbers + +open import foundation.dependent-pair-types +open import foundation.function-types +open import foundation.images +open import foundation.inhabited-subtypes +open import foundation.inhabited-types +open import foundation.subtypes +open import foundation.surjective-maps +open import foundation.universe-levels + +open import univalent-combinatorics.finitely-enumerable-subtypes +open import univalent-combinatorics.finitely-enumerable-types +open import univalent-combinatorics.inhabited-finitely-enumerable-types +open import univalent-combinatorics.standard-finite-types +``` + +
+ +## Idea + +An +{{#concept "inhabited finitely enumerable subtype" Agda=inhabited-finitely-enumerable-subtype}} +is a [subtype](foundation.subtypes.md) that is +[inhabited](foundation.inhabited-subtypes.md) and +[finitely enumerable](univalent-combinatorics.finitely-enumerable-subtypes.md). + +## Definition + +```agda +inhabited-finitely-enumerable-subtype : + {l1 : Level} (l2 : Level) (X : UU l1) → UU (l1 ⊔ lsuc l2) +inhabited-finitely-enumerable-subtype {l1} l2 X = + type-subtype + ( is-inhabited-subtype-Prop {l2 = l2} ∘ + subtype-finitely-enumerable-subtype {X = X}) + +module _ + {l1 l2 : Level} {X : UU l1} (S : inhabited-finitely-enumerable-subtype l2 X) + where + + finitely-enumerable-subtype-inhabited-finitely-enumerable-subtype : + finitely-enumerable-subtype l2 X + finitely-enumerable-subtype-inhabited-finitely-enumerable-subtype = pr1 S + + subtype-inhabited-finitely-enumerable-subtype : subtype l2 X + subtype-inhabited-finitely-enumerable-subtype = + subtype-finitely-enumerable-subtype + ( finitely-enumerable-subtype-inhabited-finitely-enumerable-subtype) + + type-inhabited-finitely-enumerable-subtype : UU (l1 ⊔ l2) + type-inhabited-finitely-enumerable-subtype = + type-subtype subtype-inhabited-finitely-enumerable-subtype + + is-inhabited-type-inhabited-finitely-enumerable-subtype : + is-inhabited type-inhabited-finitely-enumerable-subtype + is-inhabited-type-inhabited-finitely-enumerable-subtype = pr2 S + + is-finitely-enumerable-type-inhabited-finitely-enumerable-subtype : + is-finitely-enumerable type-inhabited-finitely-enumerable-subtype + is-finitely-enumerable-type-inhabited-finitely-enumerable-subtype = + is-finitely-enumerable-subtype-finitely-enumerable-subtype + ( finitely-enumerable-subtype-inhabited-finitely-enumerable-subtype) + + finitely-enumerable-type-inhabited-finitely-enumerable-subtype : + Finitely-Enumerable-Type (l1 ⊔ l2) + finitely-enumerable-type-inhabited-finitely-enumerable-subtype = + finitely-enumerable-type-finitely-enumerable-subtype + ( finitely-enumerable-subtype-inhabited-finitely-enumerable-subtype) + + inhabited-finitely-enumerable-type-inhabited-finitely-enumerable-subtype : + Inhabited-Finitely-Enumerable-Type (l1 ⊔ l2) + inhabited-finitely-enumerable-type-inhabited-finitely-enumerable-subtype = + ( finitely-enumerable-type-inhabited-finitely-enumerable-subtype , + is-inhabited-type-inhabited-finitely-enumerable-subtype) +``` + +## Properties + +### The image of an inhabited finitely enumerable subtype under a map is inhabited finitely enumerable + +```agda +im-inhabited-finitely-enumerable-subtype : + {l1 l2 l3 : Level} {X : UU l1} {Y : UU l2} → (X → Y) → + inhabited-finitely-enumerable-subtype l3 X → + inhabited-finitely-enumerable-subtype (l1 ⊔ l2 ⊔ l3) Y +im-inhabited-finitely-enumerable-subtype f (S , |S|) = + ( im-finitely-enumerable-subtype f S , + map-is-inhabited + ( map-unit-im (f ∘ inclusion-finitely-enumerable-subtype S)) + ( |S|)) +``` + +### For an inhabited finitely enumerable subtype `S ⊆ X`, there exists `n : ℕ` such that `Fin (succ-ℕ n)` surjects onto `S` + +```agda +abstract + exists-enumeration-inhabited-finitely-enumerable-subtype : + {l1 l2 : Level} {X : UU l1} → + (S : inhabited-finitely-enumerable-subtype l2 X) → + is-inhabited + ( Σ + ( ℕ) + ( λ n → Fin (succ-ℕ n) ↠ type-inhabited-finitely-enumerable-subtype S)) + exists-enumeration-inhabited-finitely-enumerable-subtype S = + exists-enumeration-Inhabited-Finitely-Enumerable-Type + ( inhabited-finitely-enumerable-type-inhabited-finitely-enumerable-subtype + ( S)) +``` diff --git a/src/univalent-combinatorics/inhabited-finitely-enumerable-types.lagda.md b/src/univalent-combinatorics/inhabited-finitely-enumerable-types.lagda.md new file mode 100644 index 0000000000..d4508201a3 --- /dev/null +++ b/src/univalent-combinatorics/inhabited-finitely-enumerable-types.lagda.md @@ -0,0 +1,94 @@ +# Inhabited finitely enumerable types + +```agda +module univalent-combinatorics.inhabited-finitely-enumerable-types where +``` + +
Imports + +```agda +open import elementary-number-theory.natural-numbers + +open import foundation.dependent-pair-types +open import foundation.empty-types +open import foundation.existential-quantification +open import foundation.function-types +open import foundation.functoriality-propositional-truncation +open import foundation.identity-types +open import foundation.images +open import foundation.inhabited-types +open import foundation.propositional-truncations +open import foundation.propositions +open import foundation.subtypes +open import foundation.surjective-maps +open import foundation.universe-levels + +open import univalent-combinatorics.finitely-enumerable-types +open import univalent-combinatorics.standard-finite-types +``` + +
+ +## Idea + +An +{{#concept "inhabited finitely enumerable type" Agda=Inhabited-Finitely-Enumerable-Type}} +is a +[finitely enumerable type](univalent-combinatorics.finitely-enumerable-types.md) +that is [inhabited](foundation.inhabited-types.md). + +## Definition + +```agda +Inhabited-Finitely-Enumerable-Type : (l : Level) → UU (lsuc l) +Inhabited-Finitely-Enumerable-Type l = + type-subtype + ( is-inhabited-Prop ∘ type-Finitely-Enumerable-Type {l}) + +module _ + {l : Level} (X : Inhabited-Finitely-Enumerable-Type l) + where + + finitely-enumerable-type-Inhabited-Finitely-Enumerable-Type : + Finitely-Enumerable-Type l + finitely-enumerable-type-Inhabited-Finitely-Enumerable-Type = pr1 X + + type-Inhabited-Finitely-Enumerable-Type : UU l + type-Inhabited-Finitely-Enumerable-Type = + type-Finitely-Enumerable-Type + ( finitely-enumerable-type-Inhabited-Finitely-Enumerable-Type) +``` + +## Properties + +### The image of an inhabited finitely enumerable type under a map is inhabited finitely enumerable + +```agda +im-Inhabited-Finitely-Enumerable-Type : + {l1 l2 : Level} (X : Inhabited-Finitely-Enumerable-Type l1) → + {Y : UU l2} → (f : type-Inhabited-Finitely-Enumerable-Type X → Y) → + Inhabited-Finitely-Enumerable-Type (l1 ⊔ l2) +im-Inhabited-Finitely-Enumerable-Type (X , |X|) f = + ( im-Finitely-Enumerable-Type X f , + map-is-inhabited (map-unit-im f) |X|) +``` + +### For an inhabited finitely enumerable type `X`, there exists `n : ℕ` such that `Fin (succ-ℕ n)` surjects onto `X` + +```agda +abstract + exists-enumeration-Inhabited-Finitely-Enumerable-Type : + {l : Level} (X : Inhabited-Finitely-Enumerable-Type l) → + is-inhabited + ( Σ ℕ (λ n → Fin (succ-ℕ n) ↠ type-Inhabited-Finitely-Enumerable-Type X)) + exists-enumeration-Inhabited-Finitely-Enumerable-Type ((X , ∃eX) , |X|) = + map-trunc-Prop + ( λ where + eX@(zero-ℕ , _) → + ex-falso + ( is-nonempty-is-inhabited + ( |X|) + ( is-empty-is-zero-finite-enumeration eX refl)) + (succ-ℕ n , Fin-sn↠X) → (n , Fin-sn↠X)) + ( ∃eX) +``` From b7e27aea366fda3f431a765781bd4411daf1d64f Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Mon, 8 Sep 2025 03:31:05 -0700 Subject: [PATCH 54/97] Simplify inequality reasoning syntax in posets (#1533) Pulled from #1353 . --- src/order-theory/join-semilattices.lagda.md | 32 +++++++-------- src/order-theory/meet-semilattices.lagda.md | 32 +++++++-------- src/order-theory/posets.lagda.md | 45 +++++++++++++-------- 3 files changed, 61 insertions(+), 48 deletions(-) diff --git a/src/order-theory/join-semilattices.lagda.md b/src/order-theory/join-semilattices.lagda.md index 20a7bafde1..224872621b 100644 --- a/src/order-theory/join-semilattices.lagda.md +++ b/src/order-theory/join-semilattices.lagda.md @@ -497,28 +497,28 @@ module _ leq-left-triple-join-Order-Theoretic-Join-Semilattice : x ≤ ((x ∨ y) ∨ z) leq-left-triple-join-Order-Theoretic-Join-Semilattice = - calculate-in-Poset - ( poset-Order-Theoretic-Join-Semilattice A) + let + open + inequality-reasoning-Poset (poset-Order-Theoretic-Join-Semilattice A) + in chain-of-inequalities x ≤ x ∨ y by leq-left-join-Order-Theoretic-Join-Semilattice A x y - in-Poset poset-Order-Theoretic-Join-Semilattice A ≤ (x ∨ y) ∨ z by leq-left-join-Order-Theoretic-Join-Semilattice A (x ∨ y) z - in-Poset poset-Order-Theoretic-Join-Semilattice A leq-center-triple-join-Order-Theoretic-Join-Semilattice : y ≤ ((x ∨ y) ∨ z) leq-center-triple-join-Order-Theoretic-Join-Semilattice = - calculate-in-Poset - ( poset-Order-Theoretic-Join-Semilattice A) + let + open + inequality-reasoning-Poset (poset-Order-Theoretic-Join-Semilattice A) + in chain-of-inequalities y ≤ x ∨ y by leq-right-join-Order-Theoretic-Join-Semilattice A x y - in-Poset poset-Order-Theoretic-Join-Semilattice A ≤ (x ∨ y) ∨ z by leq-left-join-Order-Theoretic-Join-Semilattice A (x ∨ y) z - in-Poset poset-Order-Theoretic-Join-Semilattice A leq-right-triple-join-Order-Theoretic-Join-Semilattice : z ≤ ((x ∨ y) ∨ z) @@ -533,28 +533,28 @@ module _ leq-center-triple-join-Order-Theoretic-Join-Semilattice' : y ≤ (x ∨ (y ∨ z)) leq-center-triple-join-Order-Theoretic-Join-Semilattice' = - calculate-in-Poset - ( poset-Order-Theoretic-Join-Semilattice A) + let + open + inequality-reasoning-Poset (poset-Order-Theoretic-Join-Semilattice A) + in chain-of-inequalities y ≤ y ∨ z by leq-left-join-Order-Theoretic-Join-Semilattice A y z - in-Poset poset-Order-Theoretic-Join-Semilattice A ≤ x ∨ (y ∨ z) by leq-right-join-Order-Theoretic-Join-Semilattice A x (y ∨ z) - in-Poset poset-Order-Theoretic-Join-Semilattice A leq-right-triple-join-Order-Theoretic-Join-Semilattice' : z ≤ (x ∨ (y ∨ z)) leq-right-triple-join-Order-Theoretic-Join-Semilattice' = - calculate-in-Poset - ( poset-Order-Theoretic-Join-Semilattice A) + let + open + inequality-reasoning-Poset (poset-Order-Theoretic-Join-Semilattice A) + in chain-of-inequalities z ≤ y ∨ z by leq-right-join-Order-Theoretic-Join-Semilattice A y z - in-Poset poset-Order-Theoretic-Join-Semilattice A ≤ x ∨ (y ∨ z) by leq-right-join-Order-Theoretic-Join-Semilattice A x (y ∨ z) - in-Poset poset-Order-Theoretic-Join-Semilattice A leq-associative-join-Order-Theoretic-Join-Semilattice : ((x ∨ y) ∨ z) ≤ (x ∨ (y ∨ z)) diff --git a/src/order-theory/meet-semilattices.lagda.md b/src/order-theory/meet-semilattices.lagda.md index 42b54390a0..ca481d1320 100644 --- a/src/order-theory/meet-semilattices.lagda.md +++ b/src/order-theory/meet-semilattices.lagda.md @@ -503,30 +503,30 @@ module _ leq-left-triple-meet-Order-Theoretic-Meet-Semilattice : ((x ∧ y) ∧ z) ≤ x leq-left-triple-meet-Order-Theoretic-Meet-Semilattice = - calculate-in-Poset - ( poset-Order-Theoretic-Meet-Semilattice A) + let + open + inequality-reasoning-Poset (poset-Order-Theoretic-Meet-Semilattice A) + in chain-of-inequalities (x ∧ y) ∧ z ≤ x ∧ y by leq-left-meet-Order-Theoretic-Meet-Semilattice A (x ∧ y) z - in-Poset poset-Order-Theoretic-Meet-Semilattice A ≤ x by leq-left-meet-Order-Theoretic-Meet-Semilattice A x y - in-Poset poset-Order-Theoretic-Meet-Semilattice A leq-center-triple-meet-Order-Theoretic-Meet-Semilattice : ((x ∧ y) ∧ z) ≤ y leq-center-triple-meet-Order-Theoretic-Meet-Semilattice = - calculate-in-Poset - ( poset-Order-Theoretic-Meet-Semilattice A) + let + open + inequality-reasoning-Poset (poset-Order-Theoretic-Meet-Semilattice A) + in chain-of-inequalities (x ∧ y) ∧ z ≤ x ∧ y by leq-left-meet-Order-Theoretic-Meet-Semilattice A (x ∧ y) z - in-Poset poset-Order-Theoretic-Meet-Semilattice A ≤ y by leq-right-meet-Order-Theoretic-Meet-Semilattice A x y - in-Poset poset-Order-Theoretic-Meet-Semilattice A leq-right-triple-meet-Order-Theoretic-Meet-Semilattice : ((x ∧ y) ∧ z) ≤ z @@ -541,30 +541,30 @@ module _ leq-center-triple-meet-Order-Theoretic-Meet-Semilattice' : (x ∧ (y ∧ z)) ≤ y leq-center-triple-meet-Order-Theoretic-Meet-Semilattice' = - calculate-in-Poset - ( poset-Order-Theoretic-Meet-Semilattice A) + let + open + inequality-reasoning-Poset (poset-Order-Theoretic-Meet-Semilattice A) + in chain-of-inequalities x ∧ (y ∧ z) ≤ y ∧ z by leq-right-meet-Order-Theoretic-Meet-Semilattice A x (y ∧ z) - in-Poset poset-Order-Theoretic-Meet-Semilattice A ≤ y by leq-left-meet-Order-Theoretic-Meet-Semilattice A y z - in-Poset poset-Order-Theoretic-Meet-Semilattice A leq-right-triple-meet-Order-Theoretic-Meet-Semilattice' : (x ∧ (y ∧ z)) ≤ z leq-right-triple-meet-Order-Theoretic-Meet-Semilattice' = - calculate-in-Poset - ( poset-Order-Theoretic-Meet-Semilattice A) + let + open + inequality-reasoning-Poset (poset-Order-Theoretic-Meet-Semilattice A) + in chain-of-inequalities x ∧ (y ∧ z) ≤ y ∧ z by leq-right-meet-Order-Theoretic-Meet-Semilattice A x (y ∧ z) - in-Poset poset-Order-Theoretic-Meet-Semilattice A ≤ z by leq-right-meet-Order-Theoretic-Meet-Semilattice A y z - in-Poset poset-Order-Theoretic-Meet-Semilattice A leq-associative-meet-Order-Theoretic-Meet-Semilattice : ((x ∧ y) ∧ z) ≤ (x ∧ (y ∧ z)) diff --git a/src/order-theory/posets.lagda.md b/src/order-theory/posets.lagda.md index 53ad6172c4..9afa67ec96 100644 --- a/src/order-theory/posets.lagda.md +++ b/src/order-theory/posets.lagda.md @@ -121,38 +121,37 @@ module _ Inequalities in preorders can be constructed by equational reasoning as follows: ```text -calculate-in-Poset X +let open inequality-reasoning-Poset X +in chain-of-inequalities x ≤ y by ineq-1 - in-Poset X ≤ z by ineq-2 - in-Poset X ≤ v by ineq-3 - in-Poset X ``` Note, however, that in our setup of equational reasoning with inequalities it is not possible to mix inequalities with equalities or strict inequalities. ```agda -infixl 1 calculate-in-Poset_chain-of-inequalities_ -infixl 0 step-calculate-in-Poset - -calculate-in-Poset_chain-of-inequalities_ : +module inequality-reasoning-Poset {l1 l2 : Level} (X : Poset l1 l2) - (x : type-Poset X) → leq-Poset X x x -calculate-in-Poset_chain-of-inequalities_ = refl-leq-Poset + where -step-calculate-in-Poset : - {l1 l2 : Level} (X : Poset l1 l2) - {x y : type-Poset X} → leq-Poset X x y → - (z : type-Poset X) → leq-Poset X y z → leq-Poset X x z -step-calculate-in-Poset X {x} {y} u z v = transitive-leq-Poset X x y z v u + infixl 1 chain-of-inequalities_ + infixl 0 step-calculate-in-Poset + + chain-of-inequalities_ : (x : type-Poset X) → leq-Poset X x x + chain-of-inequalities_ = refl-leq-Poset X + + step-calculate-in-Poset : + {x y : type-Poset X} → leq-Poset X x y → + (z : type-Poset X) → leq-Poset X y z → leq-Poset X x z + step-calculate-in-Poset {x} {y} u z v = transitive-leq-Poset X x y z v u -syntax step-calculate-in-Poset X u z v = u ≤ z by v in-Poset X + syntax step-calculate-in-Poset u z v = u ≤ z by v ``` ## Properties @@ -201,3 +200,17 @@ module _ ``` It remains to show that these constructions form inverses to each other. + +### 3-cycles in poset inequalities + +```agda +abstract + three-cycle-leq-Poset : + {l1 l2 : Level} → (P : Poset l1 l2) → {a b c : type-Poset P} → + leq-Poset P a b → leq-Poset P b c → leq-Poset P c a → + (a = b) × (a = c) × (b = c) + three-cycle-leq-Poset P {a} {b} {c} a≤b b≤c c≤a = + ( antisymmetric-leq-Poset P a b a≤b (transitive-leq-Poset P _ c _ c≤a b≤c) , + antisymmetric-leq-Poset P a c (transitive-leq-Poset P _ b _ b≤c a≤b) c≤a , + antisymmetric-leq-Poset P b c b≤c (transitive-leq-Poset P _ a _ a≤b c≤a)) +``` From 680851367821fc0155dcfef343d7fdfb07a60d2b Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Tue, 9 Sep 2025 02:46:35 -0700 Subject: [PATCH 55/97] Polynomials on commutative semirings (#1531) This is fairly sparse so far in the sense that there's lots more to do, both for rings (so polynomials can be a left module etc over their ring), and for polynomial multiplication (I have some ideas on how to keep it simple), but this seems like enough to start out with and stabilize to ensure the design looks good. Addresses #1357 . --- src/commutative-algebra.lagda.md | 2 + .../commutative-semirings.lagda.md | 10 + ...ower-series-commutative-semirings.lagda.md | 492 +++++++++++++ ...polynomials-commutative-semirings.lagda.md | 660 ++++++++++++++++++ src/ring-theory/semirings.lagda.md | 4 +- 5 files changed, 1166 insertions(+), 2 deletions(-) create mode 100644 src/commutative-algebra/formal-power-series-commutative-semirings.lagda.md create mode 100644 src/commutative-algebra/polynomials-commutative-semirings.lagda.md diff --git a/src/commutative-algebra.lagda.md b/src/commutative-algebra.lagda.md index f51b7f78d1..dd213bb5da 100644 --- a/src/commutative-algebra.lagda.md +++ b/src/commutative-algebra.lagda.md @@ -18,6 +18,7 @@ open import commutative-algebra.dependent-products-commutative-semirings public open import commutative-algebra.discrete-fields public open import commutative-algebra.eisenstein-integers public open import commutative-algebra.euclidean-domains public +open import commutative-algebra.formal-power-series-commutative-semirings public open import commutative-algebra.full-ideals-commutative-rings public open import commutative-algebra.function-commutative-rings public open import commutative-algebra.function-commutative-semirings public @@ -41,6 +42,7 @@ open import commutative-algebra.maximal-ideals-commutative-rings public open import commutative-algebra.multiples-of-elements-commutative-rings public open import commutative-algebra.nilradical-commutative-rings public open import commutative-algebra.nilradicals-commutative-semirings public +open import commutative-algebra.polynomials-commutative-semirings public open import commutative-algebra.poset-of-ideals-commutative-rings public open import commutative-algebra.poset-of-radical-ideals-commutative-rings public open import commutative-algebra.powers-of-elements-commutative-rings public diff --git a/src/commutative-algebra/commutative-semirings.lagda.md b/src/commutative-algebra/commutative-semirings.lagda.md index 78e21f5b30..32fbcac41c 100644 --- a/src/commutative-algebra/commutative-semirings.lagda.md +++ b/src/commutative-algebra/commutative-semirings.lagda.md @@ -98,6 +98,10 @@ module _ is-zero-Commutative-Semiring : type-Commutative-Semiring → UU l is-zero-Commutative-Semiring = is-zero-Semiring semiring-Commutative-Semiring + is-zero-prop-Commutative-Semiring : type-Commutative-Semiring → Prop l + is-zero-prop-Commutative-Semiring = + is-zero-prop-Semiring semiring-Commutative-Semiring + is-nonzero-Commutative-Semiring : type-Commutative-Semiring → UU l is-nonzero-Commutative-Semiring = is-nonzero-Semiring semiring-Commutative-Semiring @@ -176,6 +180,12 @@ module _ (x y : type-Commutative-Semiring) → type-Commutative-Semiring mul-Commutative-Semiring' = mul-Semiring' semiring-Commutative-Semiring + ap-mul-Commutative-Semiring : + {x x' y y' : type-Commutative-Semiring} → + (x = x') → (y = y') → + mul-Commutative-Semiring x y = mul-Commutative-Semiring x' y' + ap-mul-Commutative-Semiring = ap-mul-Semiring semiring-Commutative-Semiring + one-Commutative-Semiring : type-Commutative-Semiring one-Commutative-Semiring = one-Semiring semiring-Commutative-Semiring diff --git a/src/commutative-algebra/formal-power-series-commutative-semirings.lagda.md b/src/commutative-algebra/formal-power-series-commutative-semirings.lagda.md new file mode 100644 index 0000000000..3f059ae8f2 --- /dev/null +++ b/src/commutative-algebra/formal-power-series-commutative-semirings.lagda.md @@ -0,0 +1,492 @@ +# Formal power series in commutative semirings + +```agda +module commutative-algebra.formal-power-series-commutative-semirings where +``` + +
Imports + +```agda +open import commutative-algebra.commutative-semirings +open import commutative-algebra.convolution-sequences-commutative-semirings +open import commutative-algebra.function-commutative-semirings +open import commutative-algebra.powers-of-elements-commutative-semirings + +open import elementary-number-theory.natural-numbers + +open import foundation.action-on-identifications-functions +open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.identity-types +open import foundation.sets +open import foundation.universe-levels + +open import group-theory.commutative-monoids +open import group-theory.monoids +open import group-theory.semigroups + +open import lists.sequences + +open import ring-theory.semirings +``` + +
+ +## Idea + +A +{{#concept "formal power series" WD="formal power series" WDID=Q1003025 disambiguation="in a commutative semiring" Agda=formal-power-series-Commutative-Semiring}} +is a formal sum of the form `Σₙ aₙxⁿ`, without any notion of convergence. + +## Definition + +Formal power series are defined with a record to make them intensionally +distinct from the sequence of their coefficients. + +```agda +record + formal-power-series-Commutative-Semiring + {l : Level} (R : Commutative-Semiring l) : UU l + where + + constructor formal-power-series-coefficients-Commutative-Semiring + + field + coefficient-formal-power-series-Commutative-Semiring : + sequence (type-Commutative-Semiring R) + +open formal-power-series-Commutative-Semiring public +``` + +## Properties + +### The terms in the infinite sum of evaluating a formal power series at an argument + +```agda +module _ + {l : Level} {R : Commutative-Semiring l} + where + + term-ev-formal-power-series-Commutative-Semiring : + (f : formal-power-series-Commutative-Semiring R) → + (x : type-Commutative-Semiring R) → + sequence (type-Commutative-Semiring R) + term-ev-formal-power-series-Commutative-Semiring + ( formal-power-series-coefficients-Commutative-Semiring a) + ( x) + ( n) = + mul-Commutative-Semiring R (a n) (power-Commutative-Semiring R n x) +``` + +### Equivalence to sequences in the commutative semiring + +```agda +module _ + {l : Level} (R : Commutative-Semiring l) + where + + equiv-formal-power-series-sequence-Commutative-Semiring : + sequence (type-Commutative-Semiring R) ≃ + formal-power-series-Commutative-Semiring R + equiv-formal-power-series-sequence-Commutative-Semiring = + ( formal-power-series-coefficients-Commutative-Semiring , + is-equiv-is-invertible + ( coefficient-formal-power-series-Commutative-Semiring) + ( λ _ → refl) + ( λ _ → refl)) +``` + +### The set of formal power series + +```agda +module _ + {l : Level} (R : Commutative-Semiring l) + where + + abstract + is-set-formal-power-series-Commutative-Semiring : + is-set (formal-power-series-Commutative-Semiring R) + is-set-formal-power-series-Commutative-Semiring = + is-set-equiv + ( _) + ( inv-equiv (equiv-formal-power-series-sequence-Commutative-Semiring R)) + ( is-set-type-Π-Set' _ (λ _ → set-Commutative-Semiring R)) + + set-formal-power-series-Commutative-Semiring : Set l + set-formal-power-series-Commutative-Semiring = + ( formal-power-series-Commutative-Semiring R , + is-set-formal-power-series-Commutative-Semiring) +``` + +### The constant zero formal power series + +```agda +module _ + {l : Level} (R : Commutative-Semiring l) + where + + zero-formal-power-series-Commutative-Semiring : + formal-power-series-Commutative-Semiring R + zero-formal-power-series-Commutative-Semiring = + formal-power-series-coefficients-Commutative-Semiring + ( zero-Commutative-Semiring + ( commutative-semiring-convolution-sequence-Commutative-Semiring R)) +``` + +### The constant one formal power series + +```agda +module _ + {l : Level} (R : Commutative-Semiring l) + where + + one-formal-power-series-Commutative-Semiring : + formal-power-series-Commutative-Semiring R + one-formal-power-series-Commutative-Semiring = + formal-power-series-coefficients-Commutative-Semiring + ( one-Commutative-Semiring + ( commutative-semiring-convolution-sequence-Commutative-Semiring R)) +``` + +### The identity formal power series + +```agda +module _ + {l : Level} (R : Commutative-Semiring l) + where + + id-formal-power-series-Commutative-Semiring : + formal-power-series-Commutative-Semiring R + id-formal-power-series-Commutative-Semiring = + formal-power-series-coefficients-Commutative-Semiring + ( λ where + zero-ℕ → zero-Commutative-Semiring R + (succ-ℕ zero-ℕ) → one-Commutative-Semiring R + (succ-ℕ (succ-ℕ _)) → zero-Commutative-Semiring R) +``` + +### Addition + +```agda +module _ + {l : Level} {R : Commutative-Semiring l} + where + + add-formal-power-series-Commutative-Semiring : + formal-power-series-Commutative-Semiring R → + formal-power-series-Commutative-Semiring R → + formal-power-series-Commutative-Semiring R + add-formal-power-series-Commutative-Semiring x y = + formal-power-series-coefficients-Commutative-Semiring + ( add-Commutative-Semiring + ( commutative-semiring-convolution-sequence-Commutative-Semiring R) + ( coefficient-formal-power-series-Commutative-Semiring x) + ( coefficient-formal-power-series-Commutative-Semiring y)) +``` + +#### Associativity + +```agda +module _ + {l : Level} {R : Commutative-Semiring l} + where + + abstract + associative-add-formal-power-series-Commutative-Semiring : + (x y z : formal-power-series-Commutative-Semiring R) → + add-formal-power-series-Commutative-Semiring + ( add-formal-power-series-Commutative-Semiring x y) + ( z) = + add-formal-power-series-Commutative-Semiring + ( x) + ( add-formal-power-series-Commutative-Semiring y z) + associative-add-formal-power-series-Commutative-Semiring x y z = + ap + ( formal-power-series-coefficients-Commutative-Semiring) + ( associative-add-Commutative-Semiring + ( commutative-semiring-convolution-sequence-Commutative-Semiring R) + ( coefficient-formal-power-series-Commutative-Semiring x) + ( coefficient-formal-power-series-Commutative-Semiring y) + ( coefficient-formal-power-series-Commutative-Semiring z)) +``` + +#### Commutativity + +```agda +module _ + {l : Level} {R : Commutative-Semiring l} + where + + abstract + commutative-add-formal-power-series-Commutative-Semiring : + (x y : formal-power-series-Commutative-Semiring R) → + add-formal-power-series-Commutative-Semiring x y = + add-formal-power-series-Commutative-Semiring y x + commutative-add-formal-power-series-Commutative-Semiring x y = + ap + ( formal-power-series-coefficients-Commutative-Semiring) + ( commutative-add-Commutative-Semiring + ( commutative-semiring-convolution-sequence-Commutative-Semiring R) + ( coefficient-formal-power-series-Commutative-Semiring x) + ( coefficient-formal-power-series-Commutative-Semiring y)) +``` + +#### Unit laws + +```agda +module _ + {l : Level} {R : Commutative-Semiring l} + where + + abstract + left-unit-law-add-formal-power-series-Commutative-Semiring : + (x : formal-power-series-Commutative-Semiring R) → + add-formal-power-series-Commutative-Semiring + ( zero-formal-power-series-Commutative-Semiring R) + ( x) = + x + left-unit-law-add-formal-power-series-Commutative-Semiring x = + ap + ( formal-power-series-coefficients-Commutative-Semiring) + ( left-unit-law-add-Commutative-Semiring + ( commutative-semiring-convolution-sequence-Commutative-Semiring R) + ( coefficient-formal-power-series-Commutative-Semiring x)) + + right-unit-law-add-formal-power-series-Commutative-Semiring : + (x : formal-power-series-Commutative-Semiring R) → + add-formal-power-series-Commutative-Semiring + ( x) + ( zero-formal-power-series-Commutative-Semiring R) = + x + right-unit-law-add-formal-power-series-Commutative-Semiring x = + ap + ( formal-power-series-coefficients-Commutative-Semiring) + ( right-unit-law-add-Commutative-Semiring + ( commutative-semiring-convolution-sequence-Commutative-Semiring R) + ( coefficient-formal-power-series-Commutative-Semiring x)) +``` + +### Multiplication + +```agda +module _ + {l : Level} {R : Commutative-Semiring l} + where + + mul-formal-power-series-Commutative-Semiring : + formal-power-series-Commutative-Semiring R → + formal-power-series-Commutative-Semiring R → + formal-power-series-Commutative-Semiring R + mul-formal-power-series-Commutative-Semiring x y = + formal-power-series-coefficients-Commutative-Semiring + ( mul-Commutative-Semiring + ( commutative-semiring-convolution-sequence-Commutative-Semiring R) + ( coefficient-formal-power-series-Commutative-Semiring x) + ( coefficient-formal-power-series-Commutative-Semiring y)) +``` + +#### Associativity + +```agda +module _ + {l : Level} {R : Commutative-Semiring l} + where + + abstract + associative-mul-formal-power-series-Commutative-Semiring : + (x y z : formal-power-series-Commutative-Semiring R) → + mul-formal-power-series-Commutative-Semiring + ( mul-formal-power-series-Commutative-Semiring x y) + ( z) = + mul-formal-power-series-Commutative-Semiring + ( x) + ( mul-formal-power-series-Commutative-Semiring y z) + associative-mul-formal-power-series-Commutative-Semiring x y z = + ap + ( formal-power-series-coefficients-Commutative-Semiring) + ( associative-mul-Commutative-Semiring + ( commutative-semiring-convolution-sequence-Commutative-Semiring R) + ( coefficient-formal-power-series-Commutative-Semiring x) + ( coefficient-formal-power-series-Commutative-Semiring y) + ( coefficient-formal-power-series-Commutative-Semiring z)) +``` + +#### Commutativity + +```agda +module _ + {l : Level} {R : Commutative-Semiring l} + where + + abstract + commutative-mul-formal-power-series-Commutative-Semiring : + (x y : formal-power-series-Commutative-Semiring R) → + mul-formal-power-series-Commutative-Semiring x y = + mul-formal-power-series-Commutative-Semiring y x + commutative-mul-formal-power-series-Commutative-Semiring x y = + ap + ( formal-power-series-coefficients-Commutative-Semiring) + ( commutative-mul-Commutative-Semiring + ( commutative-semiring-convolution-sequence-Commutative-Semiring R) + ( coefficient-formal-power-series-Commutative-Semiring x) + ( coefficient-formal-power-series-Commutative-Semiring y)) +``` + +#### Unit laws + +```agda +module _ + {l : Level} {R : Commutative-Semiring l} + where + + abstract + left-unit-law-mul-formal-power-series-Commutative-Semiring : + (x : formal-power-series-Commutative-Semiring R) → + mul-formal-power-series-Commutative-Semiring + ( one-formal-power-series-Commutative-Semiring R) + ( x) = + x + left-unit-law-mul-formal-power-series-Commutative-Semiring x = + ap + ( formal-power-series-coefficients-Commutative-Semiring) + ( left-unit-law-mul-Commutative-Semiring + ( commutative-semiring-convolution-sequence-Commutative-Semiring R) + ( coefficient-formal-power-series-Commutative-Semiring x)) + + right-unit-law-mul-formal-power-series-Commutative-Semiring : + (x : formal-power-series-Commutative-Semiring R) → + mul-formal-power-series-Commutative-Semiring + ( x) + ( one-formal-power-series-Commutative-Semiring R) = + x + right-unit-law-mul-formal-power-series-Commutative-Semiring x = + ap + ( formal-power-series-coefficients-Commutative-Semiring) + ( right-unit-law-mul-Commutative-Semiring + ( commutative-semiring-convolution-sequence-Commutative-Semiring R) + ( coefficient-formal-power-series-Commutative-Semiring x)) +``` + +#### Zero laws + +```agda +module _ + {l : Level} {R : Commutative-Semiring l} + where + + abstract + left-zero-law-mul-formal-power-series-Commutative-Semiring : + (x : formal-power-series-Commutative-Semiring R) → + mul-formal-power-series-Commutative-Semiring + ( zero-formal-power-series-Commutative-Semiring R) + ( x) = + zero-formal-power-series-Commutative-Semiring R + left-zero-law-mul-formal-power-series-Commutative-Semiring x = + ap + ( formal-power-series-coefficients-Commutative-Semiring) + ( left-zero-law-mul-Commutative-Semiring + ( commutative-semiring-convolution-sequence-Commutative-Semiring R) + ( coefficient-formal-power-series-Commutative-Semiring x)) + + right-zero-law-mul-formal-power-series-Commutative-Semiring : + (x : formal-power-series-Commutative-Semiring R) → + mul-formal-power-series-Commutative-Semiring + ( x) + ( zero-formal-power-series-Commutative-Semiring R) = + zero-formal-power-series-Commutative-Semiring R + right-zero-law-mul-formal-power-series-Commutative-Semiring x = + ap + ( formal-power-series-coefficients-Commutative-Semiring) + ( right-zero-law-mul-Commutative-Semiring + ( commutative-semiring-convolution-sequence-Commutative-Semiring R) + ( coefficient-formal-power-series-Commutative-Semiring x)) +``` + +### Distributive laws + +```agda +module _ + {l : Level} {R : Commutative-Semiring l} + where + + abstract + left-distributive-mul-add-formal-power-series-Commutative-Semiring : + (x y z : formal-power-series-Commutative-Semiring R) → + mul-formal-power-series-Commutative-Semiring + ( x) + ( add-formal-power-series-Commutative-Semiring y z) = + add-formal-power-series-Commutative-Semiring + ( mul-formal-power-series-Commutative-Semiring x y) + ( mul-formal-power-series-Commutative-Semiring x z) + left-distributive-mul-add-formal-power-series-Commutative-Semiring x y z = + ap + ( formal-power-series-coefficients-Commutative-Semiring) + ( left-distributive-mul-add-Commutative-Semiring + ( commutative-semiring-convolution-sequence-Commutative-Semiring R) + ( coefficient-formal-power-series-Commutative-Semiring x) + ( coefficient-formal-power-series-Commutative-Semiring y) + ( coefficient-formal-power-series-Commutative-Semiring z)) + + right-distributive-mul-add-formal-power-series-Commutative-Semiring : + (x y z : formal-power-series-Commutative-Semiring R) → + mul-formal-power-series-Commutative-Semiring + ( add-formal-power-series-Commutative-Semiring x y) + ( z) = + add-formal-power-series-Commutative-Semiring + ( mul-formal-power-series-Commutative-Semiring x z) + ( mul-formal-power-series-Commutative-Semiring y z) + right-distributive-mul-add-formal-power-series-Commutative-Semiring x y z = + ap + ( formal-power-series-coefficients-Commutative-Semiring) + ( right-distributive-mul-add-Commutative-Semiring + ( commutative-semiring-convolution-sequence-Commutative-Semiring R) + ( coefficient-formal-power-series-Commutative-Semiring x) + ( coefficient-formal-power-series-Commutative-Semiring y) + ( coefficient-formal-power-series-Commutative-Semiring z)) +``` + +### The commutative semiring of formal power series + +```agda +module _ + {l : Level} (R : Commutative-Semiring l) + where + + additive-semigroup-formal-power-series-Commutative-Semiring : Semigroup l + additive-semigroup-formal-power-series-Commutative-Semiring = + ( set-formal-power-series-Commutative-Semiring R , + add-formal-power-series-Commutative-Semiring , + associative-add-formal-power-series-Commutative-Semiring) + + additive-monoid-formal-power-series-Commutative-Semiring : Monoid l + additive-monoid-formal-power-series-Commutative-Semiring = + ( additive-semigroup-formal-power-series-Commutative-Semiring , + zero-formal-power-series-Commutative-Semiring R , + left-unit-law-add-formal-power-series-Commutative-Semiring , + right-unit-law-add-formal-power-series-Commutative-Semiring) + + additive-commutative-monoid-formal-power-series-Commutative-Semiring : + Commutative-Monoid l + additive-commutative-monoid-formal-power-series-Commutative-Semiring = + ( additive-monoid-formal-power-series-Commutative-Semiring , + commutative-add-formal-power-series-Commutative-Semiring) + + semiring-formal-power-series-Commutative-Semiring : Semiring l + semiring-formal-power-series-Commutative-Semiring = + ( additive-commutative-monoid-formal-power-series-Commutative-Semiring , + ( ( mul-formal-power-series-Commutative-Semiring , + associative-mul-formal-power-series-Commutative-Semiring) , + ( one-formal-power-series-Commutative-Semiring R , + left-unit-law-mul-formal-power-series-Commutative-Semiring , + right-unit-law-mul-formal-power-series-Commutative-Semiring) , + left-distributive-mul-add-formal-power-series-Commutative-Semiring , + right-distributive-mul-add-formal-power-series-Commutative-Semiring) , + left-zero-law-mul-formal-power-series-Commutative-Semiring , + right-zero-law-mul-formal-power-series-Commutative-Semiring) + + commutative-semiring-formal-power-series-Commutative-Semiring : + Commutative-Semiring l + commutative-semiring-formal-power-series-Commutative-Semiring = + ( semiring-formal-power-series-Commutative-Semiring , + commutative-mul-formal-power-series-Commutative-Semiring) +``` diff --git a/src/commutative-algebra/polynomials-commutative-semirings.lagda.md b/src/commutative-algebra/polynomials-commutative-semirings.lagda.md new file mode 100644 index 0000000000..4f1f8aa797 --- /dev/null +++ b/src/commutative-algebra/polynomials-commutative-semirings.lagda.md @@ -0,0 +1,660 @@ +# Polynomials in commutative semirings + +```agda +{-# OPTIONS --lossy-unification #-} + +module commutative-algebra.polynomials-commutative-semirings where +``` + +
Imports + +```agda +open import commutative-algebra.commutative-semirings +open import commutative-algebra.formal-power-series-commutative-semirings +open import commutative-algebra.powers-of-elements-commutative-semirings +open import commutative-algebra.sums-of-finite-families-of-elements-commutative-semirings +open import commutative-algebra.sums-of-finite-sequences-of-elements-commutative-semirings + +open import elementary-number-theory.addition-natural-numbers +open import elementary-number-theory.binary-sum-decompositions-natural-numbers +open import elementary-number-theory.inequality-natural-numbers +open import elementary-number-theory.maximum-natural-numbers +open import elementary-number-theory.natural-numbers +open import elementary-number-theory.strict-inequality-natural-numbers + +open import foundation.action-on-identifications-functions +open import foundation.cartesian-product-types +open import foundation.coproduct-types +open import foundation.dependent-pair-types +open import foundation.empty-types +open import foundation.equivalences +open import foundation.existential-quantification +open import foundation.function-types +open import foundation.identity-types +open import foundation.propositional-truncations +open import foundation.propositions +open import foundation.sets +open import foundation.subtypes +open import foundation.transport-along-identifications +open import foundation.universal-property-propositional-truncation-into-sets +open import foundation.universe-levels + +open import lists.sequences + +open import univalent-combinatorics.cartesian-product-types +open import univalent-combinatorics.coproduct-types +open import univalent-combinatorics.dependent-pair-types +open import univalent-combinatorics.finite-types +open import univalent-combinatorics.standard-finite-types +``` + +
+ +## Idea + +A +{{#concept "polynomial" WDID=Q43260 WD="polynomial" disambiguation="in a commutative semiring" Agda=polynomial-Commutative-Semiring}} +in a [commutative semiring](commutative-algebra.commutative-semirings.md) is a +[formal power series](commutative-algebra.formal-power-series-commutative-semirings.md) +`Σₙ aₙxⁿ` whose coefficients `aₙ` are zero for sufficiently large `n`. + +## Definition + +```agda +module _ + {l : Level} {R : Commutative-Semiring l} + where + + is-degree-bound-prop-formal-power-series-Commutative-Semiring : + formal-power-series-Commutative-Semiring R → ℕ → Prop l + is-degree-bound-prop-formal-power-series-Commutative-Semiring + ( formal-power-series-coefficients-Commutative-Semiring a) + ( N) = + Π-Prop + ( ℕ) + ( λ n → + hom-Prop (leq-ℕ-Prop N n) (is-zero-prop-Commutative-Semiring R (a n))) + + is-degree-bound-formal-power-series-Commutative-Semiring : + formal-power-series-Commutative-Semiring R → ℕ → UU l + is-degree-bound-formal-power-series-Commutative-Semiring p n = + type-Prop + ( is-degree-bound-prop-formal-power-series-Commutative-Semiring p n) + + is-polynomial-prop-formal-power-series-Commutative-Semiring : + formal-power-series-Commutative-Semiring R → Prop l + is-polynomial-prop-formal-power-series-Commutative-Semiring a = + ∃ ℕ (is-degree-bound-prop-formal-power-series-Commutative-Semiring a) + + is-polynomial-formal-power-series-Commutative-Semiring : + formal-power-series-Commutative-Semiring R → UU l + is-polynomial-formal-power-series-Commutative-Semiring a = + type-Prop (is-polynomial-prop-formal-power-series-Commutative-Semiring a) + +polynomial-Commutative-Semiring : + {l : Level} → (R : Commutative-Semiring l) → UU l +polynomial-Commutative-Semiring R = + type-subtype + ( is-polynomial-prop-formal-power-series-Commutative-Semiring {R = R}) + +module _ + {l : Level} {R : Commutative-Semiring l} + where + + polynomial-add-degree-formal-power-series-Commutative-Semiring : + (p : formal-power-series-Commutative-Semiring R) → + (N : ℕ) → + ( (n : ℕ) → + is-zero-Commutative-Semiring R + ( coefficient-formal-power-series-Commutative-Semiring p (n +ℕ N))) → + polynomial-Commutative-Semiring R + polynomial-add-degree-formal-power-series-Commutative-Semiring + ( formal-power-series-coefficients-Commutative-Semiring p) N H = + ( formal-power-series-coefficients-Commutative-Semiring p , + intro-exists + ( N) + ( λ n N≤n → + let (m , m+N=n) = subtraction-leq-ℕ N n N≤n + in tr (is-zero-Commutative-Semiring R ∘ p) m+N=n (H m))) + +module _ + {l : Level} {R : Commutative-Semiring l} + (p : polynomial-Commutative-Semiring R) + where + + formal-power-series-polynomial-Commutative-Semiring : + formal-power-series-Commutative-Semiring R + formal-power-series-polynomial-Commutative-Semiring = pr1 p + + coefficient-polynomial-Commutative-Semiring : + sequence (type-Commutative-Semiring R) + coefficient-polynomial-Commutative-Semiring = + coefficient-formal-power-series-Commutative-Semiring + ( formal-power-series-polynomial-Commutative-Semiring) + + is-polynomial-formal-power-series-polynomial-Commutative-Semiring : + is-polynomial-formal-power-series-Commutative-Semiring + ( formal-power-series-polynomial-Commutative-Semiring) + is-polynomial-formal-power-series-polynomial-Commutative-Semiring = pr2 p +``` + +## Properties + +### The constant zero polynomial + +```agda +module _ + {l : Level} (R : Commutative-Semiring l) + where + + zero-polynomial-Commutative-Semiring : polynomial-Commutative-Semiring R + zero-polynomial-Commutative-Semiring = + polynomial-add-degree-formal-power-series-Commutative-Semiring + ( zero-formal-power-series-Commutative-Semiring R) + ( zero-ℕ) + ( λ _ → refl) +``` + +### The constant one polynomial + +```agda +module _ + {l : Level} (R : Commutative-Semiring l) + where + + one-polynomial-Commutative-Semiring : polynomial-Commutative-Semiring R + one-polynomial-Commutative-Semiring = + polynomial-add-degree-formal-power-series-Commutative-Semiring + ( one-formal-power-series-Commutative-Semiring R) + ( 1) + ( λ _ → refl) +``` + +### The identity polynomial + +```agda +module _ + {l : Level} (R : Commutative-Semiring l) + where + + id-polynomial-Commutative-Semiring : polynomial-Commutative-Semiring R + id-polynomial-Commutative-Semiring = + polynomial-add-degree-formal-power-series-Commutative-Semiring + ( id-formal-power-series-Commutative-Semiring R) + ( 2) + ( λ _ → refl) +``` + +### The set of polynomials + +```agda +module _ + {l : Level} (R : Commutative-Semiring l) + where + + set-polynomial-Commutative-Semiring : Set l + set-polynomial-Commutative-Semiring = + set-subset + ( set-formal-power-series-Commutative-Semiring R) + ( is-polynomial-prop-formal-power-series-Commutative-Semiring) +``` + +### Evaluation of polynomials + +```agda +module _ + {l : Level} {R : Commutative-Semiring l} + where + + ev-degree-bound-formal-power-series-Commutative-Semiring : + (p : formal-power-series-Commutative-Semiring R) → + type-Commutative-Semiring R → + Σ ℕ (is-degree-bound-formal-power-series-Commutative-Semiring p) → + type-Commutative-Semiring R + ev-degree-bound-formal-power-series-Commutative-Semiring p x (N , N≤n→pn=0) = + sum-fin-sequence-type-Commutative-Semiring R N + ( term-ev-formal-power-series-Commutative-Semiring p x ∘ nat-Fin N) + + abstract + eq-ev-degree-bound-formal-power-series-Commutative-Semiring : + (p : formal-power-series-Commutative-Semiring R) → + (x : type-Commutative-Semiring R) → + (b1 b2 : + Σ ℕ (is-degree-bound-formal-power-series-Commutative-Semiring p)) → + ev-degree-bound-formal-power-series-Commutative-Semiring p x b1 = + ev-degree-bound-formal-power-series-Commutative-Semiring p x b2 + eq-ev-degree-bound-formal-power-series-Commutative-Semiring + p@(formal-power-series-coefficients-Commutative-Semiring c) x + (N₁ , N₁≤n→pn=0) (N₂ , N₂≤n→pn=0) = + rec-coproduct + ( λ N₁≤N₂ → inv (case N₁ N₁≤n→pn=0 N₂ N₂≤n→pn=0 N₁≤N₂)) + ( λ N₂≤N₁ → case N₂ N₂≤n→pn=0 N₁ N₁≤n→pn=0 N₂≤N₁) + ( linear-leq-ℕ N₁ N₂) + where + case : + (Na : ℕ) + (Ha : (n : ℕ) → leq-ℕ Na n → is-zero-Commutative-Semiring R (c n)) → + (Nb : ℕ) → + (Hb : (n : ℕ) → leq-ℕ Nb n → is-zero-Commutative-Semiring R (c n)) → + leq-ℕ Na Nb → + ev-degree-bound-formal-power-series-Commutative-Semiring + ( p) + ( x) + ( Nb , Hb) = + ev-degree-bound-formal-power-series-Commutative-Semiring + ( p) + ( x) + ( Na , Ha) + case Na Na≤n→pn=0 Nb Nb≤n→pn=0 Na≤Nb = + let (Δ , Δ+Na=Nb) = subtraction-leq-ℕ Na Nb Na≤Nb + in + equational-reasoning + sum-fin-sequence-type-Commutative-Semiring R Nb + ( term-ev-formal-power-series-Commutative-Semiring p x ∘ + nat-Fin Nb) + = + sum-fin-sequence-type-Commutative-Semiring R (Na +ℕ Δ) + ( term-ev-formal-power-series-Commutative-Semiring p x ∘ + nat-Fin (Na +ℕ Δ)) + by + ap + (λ N → + sum-fin-sequence-type-Commutative-Semiring R N + ( term-ev-formal-power-series-Commutative-Semiring p x ∘ + nat-Fin N)) + (inv (commutative-add-ℕ Na Δ ∙ Δ+Na=Nb)) + = + add-Commutative-Semiring R + ( sum-fin-sequence-type-Commutative-Semiring R Na + ( term-ev-formal-power-series-Commutative-Semiring p x ∘ + nat-Fin (Na +ℕ Δ) ∘ + inl-coproduct-Fin Na Δ)) + ( sum-fin-sequence-type-Commutative-Semiring R Δ + ( term-ev-formal-power-series-Commutative-Semiring p x ∘ + nat-Fin (Na +ℕ Δ) ∘ + inr-coproduct-Fin Na Δ)) + by + split-sum-fin-sequence-type-Commutative-Semiring R Na Δ _ + = + add-Commutative-Semiring R + ( ev-degree-bound-formal-power-series-Commutative-Semiring + ( p) + ( x) + ( Na , Na≤n→pn=0)) + ( sum-fin-sequence-type-Commutative-Semiring R Δ + ( λ _ → zero-Commutative-Semiring R)) + by + ap-add-Commutative-Semiring R + ( htpy-sum-fin-sequence-type-Commutative-Semiring R Na + ( λ n → + ap + ( term-ev-formal-power-series-Commutative-Semiring + ( p) + ( x)) + ( nat-inl-coproduct-Fin Na Δ n))) + ( htpy-sum-fin-sequence-type-Commutative-Semiring R Δ + ( λ n → + equational-reasoning + mul-Commutative-Semiring R + ( c (nat-Fin (Na +ℕ Δ) (inr-coproduct-Fin Na Δ n))) + ( power-Commutative-Semiring R + ( nat-Fin (Na +ℕ Δ) (inr-coproduct-Fin Na Δ n)) + ( x)) + = + mul-Commutative-Semiring R + ( c (Na +ℕ nat-Fin Δ n)) + ( _) + by + ap-mul-Commutative-Semiring R + ( ap c (nat-inr-coproduct-Fin Na Δ n)) + ( refl) + = + mul-Commutative-Semiring R + ( zero-Commutative-Semiring R) + ( _) + by + ap-mul-Commutative-Semiring R + ( Na≤n→pn=0 + ( Na +ℕ nat-Fin Δ n) + ( leq-add-ℕ Na _)) + ( refl) + = zero-Commutative-Semiring R + by left-zero-law-mul-Commutative-Semiring R _)) + = + add-Commutative-Semiring R + ( ev-degree-bound-formal-power-series-Commutative-Semiring + ( p) + ( x) + ( Na , Na≤n→pn=0)) + ( zero-Commutative-Semiring R) + by + ap-add-Commutative-Semiring R refl + ( sum-zero-fin-sequence-type-Commutative-Semiring R Δ) + = + ev-degree-bound-formal-power-series-Commutative-Semiring + ( p) + ( x) + (Na , Na≤n→pn=0) + by right-unit-law-add-Commutative-Semiring R _ + + ev-polynomial-Commutative-Semiring : + polynomial-Commutative-Semiring R → type-Commutative-Semiring R → + type-Commutative-Semiring R + ev-polynomial-Commutative-Semiring (p , deg-bound-p) x = + map-universal-property-set-quotient-trunc-Prop + ( set-Commutative-Semiring R) + ( ev-degree-bound-formal-power-series-Commutative-Semiring p x) + ( eq-ev-degree-bound-formal-power-series-Commutative-Semiring p x) + ( deg-bound-p) + + abstract + eq-ev-polynomial-degree-bound-Commutative-Semiring : + (p : polynomial-Commutative-Semiring R) → + (x : type-Commutative-Semiring R) → + (N : ℕ) → + (H : (n : ℕ) → leq-ℕ N n → + is-zero-Commutative-Semiring R + ( coefficient-polynomial-Commutative-Semiring p n)) → + ev-polynomial-Commutative-Semiring p x = + ev-degree-bound-formal-power-series-Commutative-Semiring + ( formal-power-series-polynomial-Commutative-Semiring p) + ( x) + ( N , H) + eq-ev-polynomial-degree-bound-Commutative-Semiring (p , is-poly-p) x N H = + ap + ( λ ipp → ev-polynomial-Commutative-Semiring (p , ipp) x) + ( all-elements-equal-type-trunc-Prop + ( is-poly-p) + ( intro-exists N H)) ∙ + htpy-universal-property-set-quotient-trunc-Prop + ( set-Commutative-Semiring R) + ( ev-degree-bound-formal-power-series-Commutative-Semiring p x) + ( eq-ev-degree-bound-formal-power-series-Commutative-Semiring p x) + ( N , H) +``` + +### Truncation of a formal power series into a polynomial + +```agda +module _ + {l : Level} {R : Commutative-Semiring l} + where + + truncate-formal-power-series-Commutative-Semiring : + (n : ℕ) → formal-power-series-Commutative-Semiring R → + polynomial-Commutative-Semiring R + truncate-formal-power-series-Commutative-Semiring + ( n) + ( formal-power-series-coefficients-Commutative-Semiring c) = + let + d : (k : ℕ) → (le-ℕ k n + leq-ℕ n k) → type-Commutative-Semiring R + d = λ where + k (inl k Date: Tue, 9 Sep 2025 02:54:43 -0700 Subject: [PATCH 56/97] Metrics of a metric space are uniformly continuous (#1534) Depends on #1533 and #1532. --- src/metric-spaces.lagda.md | 1 + .../approximations-metric-spaces.lagda.md | 1 + ...c-spaces-are-uniformly-continuous.lagda.md | 152 ++++++++++++++++++ .../metrics-of-metric-spaces.lagda.md | 4 + src/order-theory/large-posets.lagda.md | 44 +++++ .../distance-real-numbers.lagda.md | 10 ++ .../nonnegative-real-numbers.lagda.md | 10 ++ 7 files changed, 222 insertions(+) create mode 100644 src/metric-spaces/metrics-of-metric-spaces-are-uniformly-continuous.lagda.md diff --git a/src/metric-spaces.lagda.md b/src/metric-spaces.lagda.md index 4700b85087..16236a4f7f 100644 --- a/src/metric-spaces.lagda.md +++ b/src/metric-spaces.lagda.md @@ -101,6 +101,7 @@ open import metric-spaces.metric-space-of-short-functions-metric-spaces public open import metric-spaces.metric-spaces public open import metric-spaces.metrics public open import metric-spaces.metrics-of-metric-spaces public +open import metric-spaces.metrics-of-metric-spaces-are-uniformly-continuous public open import metric-spaces.monotonic-rational-neighborhood-relations public open import metric-spaces.nets-located-metric-spaces public open import metric-spaces.nets-metric-spaces public diff --git a/src/metric-spaces/approximations-metric-spaces.lagda.md b/src/metric-spaces/approximations-metric-spaces.lagda.md index 6de3b0be3c..81e45ddedc 100644 --- a/src/metric-spaces/approximations-metric-spaces.lagda.md +++ b/src/metric-spaces/approximations-metric-spaces.lagda.md @@ -25,6 +25,7 @@ open import foundation.transport-along-identifications open import foundation.unions-subtypes open import foundation.universe-levels +open import metric-spaces.cartesian-products-metric-spaces open import metric-spaces.equality-of-metric-spaces open import metric-spaces.functions-metric-spaces open import metric-spaces.images-isometries-metric-spaces diff --git a/src/metric-spaces/metrics-of-metric-spaces-are-uniformly-continuous.lagda.md b/src/metric-spaces/metrics-of-metric-spaces-are-uniformly-continuous.lagda.md new file mode 100644 index 0000000000..32c5c91820 --- /dev/null +++ b/src/metric-spaces/metrics-of-metric-spaces-are-uniformly-continuous.lagda.md @@ -0,0 +1,152 @@ +# Metrics of metric spaces are uniformly continuous + +```agda +module metric-spaces.metrics-of-metric-spaces-are-uniformly-continuous where +``` + +
Imports + +```agda +open import elementary-number-theory.positive-rational-numbers +open import elementary-number-theory.strict-inequality-rational-numbers + +open import foundation.action-on-identifications-binary-functions +open import foundation.action-on-identifications-functions +open import foundation.dependent-pair-types +open import foundation.existential-quantification +open import foundation.identity-types +open import foundation.logical-equivalences +open import foundation.transport-along-identifications +open import foundation.universe-levels + +open import metric-spaces.cartesian-products-metric-spaces +open import metric-spaces.metric-spaces +open import metric-spaces.metrics +open import metric-spaces.metrics-of-metric-spaces +open import metric-spaces.uniformly-continuous-functions-metric-spaces + +open import order-theory.large-posets + +open import real-numbers.addition-real-numbers +open import real-numbers.dedekind-real-numbers +open import real-numbers.distance-real-numbers +open import real-numbers.inequality-real-numbers +open import real-numbers.nonnegative-real-numbers +open import real-numbers.rational-real-numbers +``` + +
+ +## Idea + +If `ρ` is a [metric](metric-spaces.metrics-of-metric-spaces.md) of the +[metric space](metric-spaces.metric-spaces.md) `M`, then it is a +[uniformly continuous map](metric-spaces.uniformly-continuous-functions-metric-spaces.md) +from the +[product metric space](metric-spaces.cartesian-products-metric-spaces.md) +`M × M` to the metric space of +[nonnegative real numbers](real-numbers.nonnegative-real-numbers.md). + +## Proof + +```agda +module _ + {l1 l2 l3 : Level} (M : Metric-Space l1 l2) + (ρ : distance-function l3 (set-Metric-Space M)) + (H : is-metric-of-Metric-Space M ρ) + where + + private + open inequality-reasoning-Large-Poset ℝ-Large-Poset + + ρ' : type-Metric-Space M → type-Metric-Space M → ℝ l3 + ρ' x y = real-ℝ⁰⁺ (ρ x y) + + commutative-ρ' : (x y : type-Metric-Space M) → ρ' x y = ρ' y x + commutative-ρ' x y = + ap real-ℝ⁰⁺ (is-symmetric-is-metric-of-Metric-Space M ρ H x y) + + abstract + dist-metric-leq-metric-of-Metric-Space : + (x y y' : type-Metric-Space M) → + dist-ℝ (real-ℝ⁰⁺ (ρ x y)) (real-ℝ⁰⁺ (ρ x y')) ≤-ℝ real-ℝ⁰⁺ (ρ y y') + dist-metric-leq-metric-of-Metric-Space x y y' = + leq-dist-leq-add-ℝ _ _ _ + ( chain-of-inequalities + ρ' x y + ≤ ρ' x y' +ℝ ρ' y' y + by is-triangular-is-metric-of-Metric-Space M ρ H x y' y + ≤ ρ' y' y +ℝ ρ' x y' + by leq-eq-ℝ _ _ (commutative-add-ℝ _ _) + ≤ ρ' y y' +ℝ ρ' x y' + by leq-eq-ℝ _ _ (ap-add-ℝ (commutative-ρ' y' y) refl)) + ( chain-of-inequalities + ρ' x y' + ≤ ρ' x y +ℝ ρ' y y' + by is-triangular-is-metric-of-Metric-Space M ρ H x y y' + ≤ ρ' y y' +ℝ ρ' x y + by leq-eq-ℝ _ _ (commutative-add-ℝ _ _)) + + modulus-of-uniform-continuity-metric-of-Metric-Space : ℚ⁺ → ℚ⁺ + modulus-of-uniform-continuity-metric-of-Metric-Space = + modulus-le-double-le-ℚ⁺ + + is-modulus-modulus-of-uniform-continuity-metric-of-Metric-Space : + is-modulus-of-uniform-continuity-function-Metric-Space + ( product-Metric-Space M M) + ( metric-space-ℝ⁰⁺ l3) + ( ind-Σ ρ) + ( modulus-of-uniform-continuity-metric-of-Metric-Space) + is-modulus-modulus-of-uniform-continuity-metric-of-Metric-Space + (x , y) ε (x' , y') (Nε'xx' , Nε'yy') = + let + ε' = modulus-le-double-le-ℚ⁺ ε + 2ε'<ε = le-double-le-modulus-le-double-le-ℚ⁺ ε + in + neighborhood-dist-ℝ ε (ρ' x y) (ρ' x' y') + ( chain-of-inequalities + dist-ℝ (ρ' x y) (ρ' x' y') + ≤ dist-ℝ (ρ' x y) (ρ' x y') +ℝ dist-ℝ (ρ' x y') (ρ' x' y') + by triangle-inequality-dist-ℝ _ _ _ + ≤ dist-ℝ (ρ' x y) (ρ' x y') +ℝ dist-ℝ (ρ' y' x) (ρ' y' x') + by + leq-eq-ℝ _ _ + ( ap-add-ℝ + ( refl) + ( ap-binary + ( dist-ℝ) + ( commutative-ρ' x y') + ( commutative-ρ' x' y'))) + ≤ ρ' y y' +ℝ ρ' x x' + by + preserves-leq-add-ℝ _ _ _ _ + ( dist-metric-leq-metric-of-Metric-Space x y y') + ( dist-metric-leq-metric-of-Metric-Space y' x x') + ≤ real-ℚ⁺ ε' +ℝ real-ℚ⁺ ε' + by + preserves-leq-add-ℝ _ _ _ _ + ( forward-implication (H ε' y y') Nε'yy') + ( forward-implication (H ε' x x') Nε'xx') + ≤ real-ℚ⁺ (ε' +ℚ⁺ ε') + by leq-eq-ℝ _ _ (add-real-ℚ _ _) + ≤ real-ℚ⁺ ε + by preserves-leq-real-ℚ _ _ (leq-le-ℚ 2ε'<ε)) + + is-uniformly-continuous-metric-of-Metric-Space : + is-uniformly-continuous-function-Metric-Space + ( product-Metric-Space M M) + ( metric-space-ℝ⁰⁺ l3) + ( ind-Σ ρ) + is-uniformly-continuous-metric-of-Metric-Space = + intro-exists + ( modulus-of-uniform-continuity-metric-of-Metric-Space) + ( is-modulus-modulus-of-uniform-continuity-metric-of-Metric-Space) + + uniformly-continuous-metric-of-Metric-Space : + uniformly-continuous-function-Metric-Space + ( product-Metric-Space M M) + ( metric-space-ℝ⁰⁺ l3) + uniformly-continuous-metric-of-Metric-Space = + ( ind-Σ ρ , + is-uniformly-continuous-metric-of-Metric-Space) +``` diff --git a/src/metric-spaces/metrics-of-metric-spaces.lagda.md b/src/metric-spaces/metrics-of-metric-spaces.lagda.md index 7b15b986cc..b4d0275b97 100644 --- a/src/metric-spaces/metrics-of-metric-spaces.lagda.md +++ b/src/metric-spaces/metrics-of-metric-spaces.lagda.md @@ -224,3 +224,7 @@ module _ eq-isometric-equiv-Metric-Space _ _ ( isometric-equiv-metric-is-metric-of-Metric-Space M ρ is-metric-M-ρ) ``` + +## See also + +- [Metrics of metric spaces are uniformly continuous](metric-spaces.metrics-of-metric-spaces-are-uniformly-continuous.md) diff --git a/src/order-theory/large-posets.lagda.md b/src/order-theory/large-posets.lagda.md index ebe0411daf..5fbe47a803 100644 --- a/src/order-theory/large-posets.lagda.md +++ b/src/order-theory/large-posets.lagda.md @@ -19,6 +19,7 @@ open import foundation.large-binary-relations open import foundation.logical-equivalences open import foundation.propositions open import foundation.sets +open import foundation.transport-along-identifications open import foundation.universe-levels open import order-theory.large-preorders @@ -194,3 +195,46 @@ module _ is-large-poset-large-category-Large-Poset = is-prop-leq-Large-Poset P ``` + +## Reasoning with inequalities in large posets + +Inequalities in large posets can be constructed by equational reasoning as +follows: + +```text +let open inequality-reasoning-Poset X +in + chain-of-inequalities + x ≤ y + by ineq-1 + ≤ z + by ineq-2 + ≤ v + by ineq-3 +``` + +Note, however, that in our setup of equational reasoning with inequalities it is +not possible to mix inequalities with equalities or strict inequalities. + +```agda +module inequality-reasoning-Large-Poset + {α : Level → Level} {β : Level → Level → Level} (P : Large-Poset α β) + where + + infixl 1 chain-of-inequalities_ + infixl 0 step-calculate-in-Large-Poset + + chain-of-inequalities_ : + {l : Level} (x : type-Large-Poset P l) → leq-Large-Poset P x x + chain-of-inequalities_ = refl-leq-Large-Poset P + + step-calculate-in-Large-Poset : + {l1 l2 : Level} {x : type-Large-Poset P l1} {y : type-Large-Poset P l2} → + leq-Large-Poset P x y → + {l3 : Level} (z : type-Large-Poset P l3) → + leq-Large-Poset P y z → leq-Large-Poset P x z + step-calculate-in-Large-Poset {x = x} {y = y} u z v = + transitive-leq-Large-Poset P x y z v u + + syntax step-calculate-in-Large-Poset u z v = u ≤ z by v +``` diff --git a/src/real-numbers/distance-real-numbers.lagda.md b/src/real-numbers/distance-real-numbers.lagda.md index fda1d23c3b..16affcab86 100644 --- a/src/real-numbers/distance-real-numbers.lagda.md +++ b/src/real-numbers/distance-real-numbers.lagda.md @@ -243,6 +243,16 @@ abstract ( z) ( x-y≤z) ( inv-tr (λ w → leq-ℝ w z) (distributive-neg-diff-ℝ _ _) y-x≤z) + + leq-dist-leq-add-ℝ : + {l1 l2 l3 : Level} (x : ℝ l1) (y : ℝ l2) (z : ℝ l3) → + x ≤-ℝ z +ℝ y → + y ≤-ℝ z +ℝ x → + dist-ℝ x y ≤-ℝ z + leq-dist-leq-add-ℝ x y z x≤z+y y≤z+x = + leq-dist-leq-diff-ℝ x y z + ( leq-transpose-right-add-ℝ _ _ _ x≤z+y) + ( leq-transpose-right-add-ℝ _ _ _ y≤z+x) ``` ### Addition preserves distance between real numbers diff --git a/src/real-numbers/nonnegative-real-numbers.lagda.md b/src/real-numbers/nonnegative-real-numbers.lagda.md index 2da96b125d..d2d88d1aa6 100644 --- a/src/real-numbers/nonnegative-real-numbers.lagda.md +++ b/src/real-numbers/nonnegative-real-numbers.lagda.md @@ -32,6 +32,8 @@ open import foundation.universe-levels open import logic.functoriality-existential-quantification +open import metric-spaces.metric-spaces + open import real-numbers.addition-real-numbers open import real-numbers.dedekind-real-numbers open import real-numbers.inequality-real-numbers @@ -39,6 +41,7 @@ open import real-numbers.rational-real-numbers open import real-numbers.saturation-inequality-real-numbers open import real-numbers.similarity-real-numbers open import real-numbers.strict-inequality-real-numbers +open import real-numbers.subsets-real-numbers ```
@@ -531,3 +534,10 @@ module _ ( leq-le-positive-rational-ℝ⁰⁺ x y (backward-implication ∘ H) , leq-le-positive-rational-ℝ⁰⁺ y x (forward-implication ∘ H)) ``` + +### The metric space of nonnegative real numbers + +```agda +metric-space-ℝ⁰⁺ : (l : Level) → Metric-Space (lsuc l) l +metric-space-ℝ⁰⁺ l = metric-space-subset-ℝ (is-nonnegative-prop-ℝ {l}) +``` From b7554c00f1a1f2d5cb0c79cdfc62183de0c79c3b Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Tue, 9 Sep 2025 03:00:10 -0700 Subject: [PATCH 57/97] The positive rational numbers are countable (#1538) --- .../positive-integer-fractions.lagda.md | 5 ++ .../positive-rational-numbers.lagda.md | 19 +++++++ src/foundation/decidable-subtypes.lagda.md | 52 +++++++++++++++++++ src/foundation/maybe.lagda.md | 4 ++ src/set-theory/countable-sets.lagda.md | 16 ++++++ 5 files changed, 96 insertions(+) diff --git a/src/elementary-number-theory/positive-integer-fractions.lagda.md b/src/elementary-number-theory/positive-integer-fractions.lagda.md index 7e92ff3e65..cb9c312f2f 100644 --- a/src/elementary-number-theory/positive-integer-fractions.lagda.md +++ b/src/elementary-number-theory/positive-integer-fractions.lagda.md @@ -16,6 +16,7 @@ open import elementary-number-theory.multiplication-positive-and-negative-intege open import elementary-number-theory.positive-integers open import elementary-number-theory.reduced-integer-fractions +open import foundation.decidable-subtypes open import foundation.propositions open import foundation.subtypes open import foundation.universe-levels @@ -46,6 +47,10 @@ module _ is-prop-is-positive-fraction-ℤ : is-prop is-positive-fraction-ℤ is-prop-is-positive-fraction-ℤ = is-prop-is-positive-ℤ (numerator-fraction-ℤ x) + +decidable-subtype-positive-fraction-ℤ : decidable-subtype lzero fraction-ℤ +decidable-subtype-positive-fraction-ℤ x = + decidable-subtype-positive-ℤ (numerator-fraction-ℤ x) ``` ## Properties diff --git a/src/elementary-number-theory/positive-rational-numbers.lagda.md b/src/elementary-number-theory/positive-rational-numbers.lagda.md index 2cdf96cf0f..b56b9c5844 100644 --- a/src/elementary-number-theory/positive-rational-numbers.lagda.md +++ b/src/elementary-number-theory/positive-rational-numbers.lagda.md @@ -42,6 +42,7 @@ open import foundation.binary-relations open import foundation.binary-transport open import foundation.cartesian-product-types open import foundation.coproduct-types +open import foundation.decidable-subtypes open import foundation.dependent-pair-types open import foundation.empty-types open import foundation.equivalences @@ -72,6 +73,8 @@ open import order-theory.preorders open import order-theory.strict-preorders open import order-theory.strictly-preordered-sets open import order-theory.total-orders + +open import set-theory.countable-sets ``` @@ -107,6 +110,10 @@ module _ is-positive-prop-ℚ : Prop lzero pr1 is-positive-prop-ℚ = is-positive-ℚ pr2 is-positive-prop-ℚ = is-prop-is-positive-ℚ + +decidable-subtype-positive-ℚ : decidable-subtype lzero ℚ +decidable-subtype-positive-ℚ x = + decidable-subtype-positive-fraction-ℤ (fraction-ℚ x) ``` ### The type of positive rational numbers @@ -163,6 +170,18 @@ is-set-ℚ⁺ : is-set ℚ⁺ is-set-ℚ⁺ = is-set-type-Set set-ℚ⁺ ``` +### The set of positive rational numbers is countable + +```agda +abstract + is-countable-set-ℚ⁺ : is-countable set-ℚ⁺ + is-countable-set-ℚ⁺ = + is-countable-decidable-subset-is-countable + ( ℚ-Set) + ( decidable-subtype-positive-ℚ) + ( is-countable-ℚ) +``` + ### The rational image of a positive integer is positive ```agda diff --git a/src/foundation/decidable-subtypes.lagda.md b/src/foundation/decidable-subtypes.lagda.md index 6b70642df5..b2c8b2f18f 100644 --- a/src/foundation/decidable-subtypes.lagda.md +++ b/src/foundation/decidable-subtypes.lagda.md @@ -8,6 +8,7 @@ module foundation.decidable-subtypes where ```agda open import foundation.1-types +open import foundation.action-on-identifications-functions open import foundation.booleans open import foundation.coproduct-types open import foundation.decidable-embeddings @@ -17,12 +18,14 @@ open import foundation.decidable-types open import foundation.dependent-pair-types open import foundation.empty-types open import foundation.equality-dependent-function-types +open import foundation.existential-quantification open import foundation.full-subtypes open import foundation.functoriality-cartesian-product-types open import foundation.functoriality-dependent-function-types open import foundation.functoriality-dependent-pair-types open import foundation.inhabited-subtypes open import foundation.logical-equivalences +open import foundation.maybe open import foundation.negation open import foundation.postcomposition-functions open import foundation.propositional-maps @@ -30,7 +33,9 @@ open import foundation.raising-universe-levels open import foundation.sets open import foundation.structured-type-duality open import foundation.subtypes +open import foundation.surjective-maps open import foundation.type-theoretic-principle-of-choice +open import foundation.unit-type open import foundation.universe-levels open import foundation-core.embeddings @@ -484,3 +489,50 @@ is-true-decidable-subtype : decidable-subtype lzero bool is-true-decidable-subtype x = ( is-true x , is-prop-is-true x , is-decidable-is-true x) ``` + +### Given a decidable subtype `S ⊆ X`, there is an equivalence `X ≃ Σ X (λ x → is-decidable (x ∈ S))` + +```agda +module _ + {l1 l2 : Level} {X : UU l1} (S : decidable-subtype l2 X) + where + + equiv-Σ-decide-is-in-decidable-subtype : + X ≃ Σ X (is-decidable ∘ is-in-decidable-subtype S) + equiv-Σ-decide-is-in-decidable-subtype = + inv-equiv + ( equiv-inclusion-is-full-subtype + ( λ x → is-decidable-Prop (subtype-decidable-subtype S x)) + ( is-decidable-decidable-subtype S)) +``` + +### Given a decidable subtype `S ⊆ X`, there is a surjective map from `Maybe X` to `Maybe S` + +```agda +module _ + {l1 l2 : Level} {X : UU l1} (S : decidable-subtype l2 X) + where + + map-maybe-decidable-subtype : + Σ X (is-decidable ∘ is-in-decidable-subtype S) → + Maybe (type-decidable-subtype S) + map-maybe-decidable-subtype (x , inl x∈S) = unit-Maybe (x , x∈S) + map-maybe-decidable-subtype (x , inr x∉S) = exception-Maybe + + abstract + is-surjective-extend-map-maybe-decidable-subtype : + is-surjective (extend-Maybe map-maybe-decidable-subtype) + is-surjective-extend-map-maybe-decidable-subtype (inr star) = + intro-exists exception-Maybe refl + is-surjective-extend-map-maybe-decidable-subtype (inl (x , x∈S)) = + intro-exists (unit-Maybe (x , inl x∈S)) refl + + surjection-maybe-decidable-subtype : + Maybe X ↠ Maybe (type-decidable-subtype S) + surjection-maybe-decidable-subtype = + comp-surjection + ( extend-Maybe map-maybe-decidable-subtype , + is-surjective-extend-map-maybe-decidable-subtype) + ( surjection-map-surjection-Maybe + ( surjection-equiv (equiv-Σ-decide-is-in-decidable-subtype S))) +``` diff --git a/src/foundation/maybe.lagda.md b/src/foundation/maybe.lagda.md index 36e1543116..69d4951026 100644 --- a/src/foundation/maybe.lagda.md +++ b/src/foundation/maybe.lagda.md @@ -291,6 +291,10 @@ module _ ( λ x p → intro-exists (inl x) (ap inl p)) ( F y) is-surjective-map-is-surjective-Maybe F (inr *) = intro-exists (inr *) refl + + surjection-map-surjection-Maybe : (f : A ↠ B) → Maybe A ↠ Maybe B + surjection-map-surjection-Maybe (f , is-surjective-f) = + ( map-Maybe f , is-surjective-map-is-surjective-Maybe is-surjective-f) ``` ### There is a surjection from `Maybe A + Maybe B` to `Maybe (A + B)` diff --git a/src/set-theory/countable-sets.lagda.md b/src/set-theory/countable-sets.lagda.md index b501136f9e..2bd4f63177 100644 --- a/src/set-theory/countable-sets.lagda.md +++ b/src/set-theory/countable-sets.lagda.md @@ -28,6 +28,7 @@ open import foundation.existential-quantification open import foundation.function-types open import foundation.functoriality-cartesian-product-types open import foundation.functoriality-coproduct-types +open import foundation.functoriality-propositional-truncation open import foundation.injective-maps open import foundation.maybe open import foundation.negated-equality @@ -502,6 +503,21 @@ is-countable-Fin-Set (succ-ℕ n) = ( is-countable-Fin-Set n) (is-countable-unit) ``` +### Decidable subsets of countable sets are countable + +```agda +module _ + {l1 l2 : Level} (X : Set l1) (S : decidable-subtype l2 (type-Set X)) + where + + abstract + is-countable-decidable-subset-is-countable : + is-countable X → is-countable (set-subset X (subtype-decidable-subtype S)) + is-countable-decidable-subset-is-countable = + map-trunc-Prop + ( comp-surjection (surjection-maybe-decidable-subtype S)) +``` + ### For any countable set `X` with decidable equality, there exists an embedding `X ↪ ℕ` ```agda From 375ba03854e3bce89df0a7094f8519d30a0733bb Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Tue, 9 Sep 2025 03:38:28 -0700 Subject: [PATCH 58/97] Left modules over commutative rings (#1539) --- .../function-commutative-rings.lagda.md | 25 +- src/linear-algebra.lagda.md | 2 + ...ts-left-modules-commutative-rings.lagda.md | 39 +++ .../left-modules-commutative-rings.lagda.md | 238 ++++++++++++++++++ .../left-modules-rings.lagda.md | 2 +- 5 files changed, 303 insertions(+), 3 deletions(-) create mode 100644 src/linear-algebra/dependent-products-left-modules-commutative-rings.lagda.md create mode 100644 src/linear-algebra/left-modules-commutative-rings.lagda.md diff --git a/src/commutative-algebra/function-commutative-rings.lagda.md b/src/commutative-algebra/function-commutative-rings.lagda.md index fb7920277a..0b0ce91c90 100644 --- a/src/commutative-algebra/function-commutative-rings.lagda.md +++ b/src/commutative-algebra/function-commutative-rings.lagda.md @@ -17,6 +17,9 @@ open import foundation.universe-levels open import group-theory.abelian-groups open import group-theory.commutative-monoids +open import linear-algebra.dependent-products-left-modules-commutative-rings +open import linear-algebra.left-modules-commutative-rings + open import ring-theory.rings ``` @@ -24,8 +27,10 @@ open import ring-theory.rings ## Idea -Given a commutative ring `A` and a type `X`, the type `A^X` of functions from -`X` into the underlying type of `A` is again a commutative ring. +Given a [commutative ring](commutative-algebra.commutative-rings.md) `A` and a +type `X`, the type `A^X` of functions from `X` into the underlying type of `A` +is a commutative ring, and a +[left module](linear-algebra.left-modules-rings.md). ## Definition @@ -162,3 +167,19 @@ module _ commutative-mul-function-Commutative-Ring = commutative-mul-Commutative-Ring function-Commutative-Ring ``` + +## Properties + +### The function commutative ring is a left module over the coefficient commutative ring + +```agda +module _ + {l1 l2 : Level} (R : Commutative-Ring l1) (X : UU l2) + where + + left-module-function-Commutative-Ring : + left-module-Commutative-Ring (l1 ⊔ l2) R + left-module-function-Commutative-Ring = + Π-left-module-Commutative-Ring R X + ( λ _ → left-module-commutative-ring-Commutative-Ring R) +``` diff --git a/src/linear-algebra.lagda.md b/src/linear-algebra.lagda.md index 5804ec6d0a..512785e345 100644 --- a/src/linear-algebra.lagda.md +++ b/src/linear-algebra.lagda.md @@ -7,6 +7,7 @@ module linear-algebra where open import linear-algebra.constant-matrices public open import linear-algebra.constant-tuples public +open import linear-algebra.dependent-products-left-modules-commutative-rings public open import linear-algebra.dependent-products-left-modules-rings public open import linear-algebra.diagonal-matrices-on-rings public open import linear-algebra.finite-sequences-in-abelian-groups public @@ -21,6 +22,7 @@ open import linear-algebra.finite-sequences-in-rings public open import linear-algebra.finite-sequences-in-semigroups public open import linear-algebra.finite-sequences-in-semirings public open import linear-algebra.functoriality-matrices public +open import linear-algebra.left-modules-commutative-rings public open import linear-algebra.left-modules-rings public open import linear-algebra.left-submodules-rings public open import linear-algebra.linear-maps-left-modules-rings public diff --git a/src/linear-algebra/dependent-products-left-modules-commutative-rings.lagda.md b/src/linear-algebra/dependent-products-left-modules-commutative-rings.lagda.md new file mode 100644 index 0000000000..ce50fc8274 --- /dev/null +++ b/src/linear-algebra/dependent-products-left-modules-commutative-rings.lagda.md @@ -0,0 +1,39 @@ +# Dependent products of left modules over commutative rings + +```agda +module linear-algebra.dependent-products-left-modules-commutative-rings where +``` + +
Imports + +```agda +open import commutative-algebra.commutative-rings + +open import foundation.function-extensionality +open import foundation.universe-levels + +open import linear-algebra.dependent-products-left-modules-rings +open import linear-algebra.left-modules-commutative-rings +``` + +
+ +## Idea + +Given a [commutative ring](commutative-algebra.commutative-rings.md) `R` and a +family of [left modules](linear-algebra.left-modules-commutative-rings.md) `Mᵢ` +over `R` indexed by `i : I`, the dependent product `Π (i : I) Mᵢ` is a left +module over `R`. + +## Definition + +```agda +module _ + {l1 l2 l3 : Level} (R : Commutative-Ring l1) (I : UU l2) + (M : I → left-module-Commutative-Ring l3 R) + where + + Π-left-module-Commutative-Ring : left-module-Commutative-Ring (l2 ⊔ l3) R + Π-left-module-Commutative-Ring = + Π-left-module-Ring (ring-Commutative-Ring R) I M +``` diff --git a/src/linear-algebra/left-modules-commutative-rings.lagda.md b/src/linear-algebra/left-modules-commutative-rings.lagda.md new file mode 100644 index 0000000000..5862c00d5a --- /dev/null +++ b/src/linear-algebra/left-modules-commutative-rings.lagda.md @@ -0,0 +1,238 @@ +# Left modules over commutative rings + +```agda +module linear-algebra.left-modules-commutative-rings where +``` + +
Imports + +```agda +open import commutative-algebra.commutative-rings + +open import foundation.identity-types +open import foundation.propositions +open import foundation.sets +open import foundation.universe-levels + +open import group-theory.abelian-groups + +open import linear-algebra.left-modules-rings +``` + +
+ +## Idea + +A +{{#concept "left module" WD="left module" WDID="Q120721996" disambiguation="over a commutative ring" Agda=left-module-Commutative-Ring}} +over a [commutative ring](commutative-algebra.commutative-rings.md) `R` is a +[left module](linear-algebra.left-modules-rings.md) over `R` viewed as a +[ring](ring-theory.rings.md). + +## Definition + +```agda +left-module-Commutative-Ring : + {l1 : Level} (l2 : Level) → Commutative-Ring l1 → UU (l1 ⊔ lsuc l2) +left-module-Commutative-Ring l2 R = + left-module-Ring l2 (ring-Commutative-Ring R) +``` + +## Properties + +```agda +module _ + {l1 l2 : Level} (R : Commutative-Ring l1) + (M : left-module-Commutative-Ring l2 R) + where + + ab-left-module-Commutative-Ring : Ab l2 + ab-left-module-Commutative-Ring = + ab-left-module-Ring (ring-Commutative-Ring R) M + + set-left-module-Commutative-Ring : Set l2 + set-left-module-Commutative-Ring = + set-left-module-Ring (ring-Commutative-Ring R) M + + type-left-module-Commutative-Ring : UU l2 + type-left-module-Commutative-Ring = + type-left-module-Ring (ring-Commutative-Ring R) M + + add-left-module-Commutative-Ring : + (x y : type-left-module-Commutative-Ring) → + type-left-module-Commutative-Ring + add-left-module-Commutative-Ring = + add-left-module-Ring (ring-Commutative-Ring R) M + + mul-left-module-Commutative-Ring : + type-Commutative-Ring R → type-left-module-Commutative-Ring → + type-left-module-Commutative-Ring + mul-left-module-Commutative-Ring = + mul-left-module-Ring (ring-Commutative-Ring R) M + + zero-left-module-Commutative-Ring : type-left-module-Commutative-Ring + zero-left-module-Commutative-Ring = + zero-left-module-Ring (ring-Commutative-Ring R) M + + is-zero-prop-left-module-Commutative-Ring : + type-left-module-Commutative-Ring → Prop l2 + is-zero-prop-left-module-Commutative-Ring = + is-zero-prop-left-module-Ring (ring-Commutative-Ring R) M + + is-zero-left-module-Commutative-Ring : + type-left-module-Commutative-Ring → UU l2 + is-zero-left-module-Commutative-Ring = + is-zero-left-module-Ring (ring-Commutative-Ring R) M + + neg-left-module-Commutative-Ring : + type-left-module-Commutative-Ring → type-left-module-Commutative-Ring + neg-left-module-Commutative-Ring = + neg-left-module-Ring (ring-Commutative-Ring R) M + + associative-add-left-module-Commutative-Ring : + (x y z : type-left-module-Commutative-Ring) → + add-left-module-Commutative-Ring (add-left-module-Commutative-Ring x y) z = + add-left-module-Commutative-Ring x (add-left-module-Commutative-Ring y z) + associative-add-left-module-Commutative-Ring = + associative-add-left-module-Ring (ring-Commutative-Ring R) M + + commutative-add-left-module-Commutative-Ring : + (x y : type-left-module-Commutative-Ring) → + add-left-module-Commutative-Ring x y = + add-left-module-Commutative-Ring y x + commutative-add-left-module-Commutative-Ring = + commutative-add-left-module-Ring (ring-Commutative-Ring R) M + + left-unit-law-add-left-module-Commutative-Ring : + (x : type-left-module-Commutative-Ring) → + add-left-module-Commutative-Ring zero-left-module-Commutative-Ring x = x + left-unit-law-add-left-module-Commutative-Ring = + left-unit-law-add-left-module-Ring (ring-Commutative-Ring R) M + + right-unit-law-add-left-module-Commutative-Ring : + (x : type-left-module-Commutative-Ring) → + add-left-module-Commutative-Ring x zero-left-module-Commutative-Ring = x + right-unit-law-add-left-module-Commutative-Ring = + right-unit-law-add-left-module-Ring (ring-Commutative-Ring R) M + + left-inverse-law-add-left-module-Commutative-Ring : + (x : type-left-module-Commutative-Ring) → + add-left-module-Commutative-Ring (neg-left-module-Commutative-Ring x) x = + zero-left-module-Commutative-Ring + left-inverse-law-add-left-module-Commutative-Ring = + left-inverse-law-add-left-module-Ring (ring-Commutative-Ring R) M + + right-inverse-law-add-left-module-Commutative-Ring : + (x : type-left-module-Commutative-Ring) → + add-left-module-Commutative-Ring x (neg-left-module-Commutative-Ring x) = + zero-left-module-Commutative-Ring + right-inverse-law-add-left-module-Commutative-Ring = + right-inverse-law-add-left-module-Ring (ring-Commutative-Ring R) M + + left-unit-law-mul-left-module-Commutative-Ring : + (x : type-left-module-Commutative-Ring) → + mul-left-module-Commutative-Ring (one-Commutative-Ring R) x = x + left-unit-law-mul-left-module-Commutative-Ring = + left-unit-law-mul-left-module-Ring (ring-Commutative-Ring R) M + + left-distributive-mul-add-left-module-Commutative-Ring : + (r : type-Commutative-Ring R) (x y : type-left-module-Commutative-Ring) → + mul-left-module-Commutative-Ring r (add-left-module-Commutative-Ring x y) = + add-left-module-Commutative-Ring + ( mul-left-module-Commutative-Ring r x) + ( mul-left-module-Commutative-Ring r y) + left-distributive-mul-add-left-module-Commutative-Ring = + left-distributive-mul-add-left-module-Ring (ring-Commutative-Ring R) M + + right-distributive-mul-add-left-module-Commutative-Ring : + (r s : type-Commutative-Ring R) (x : type-left-module-Commutative-Ring) → + mul-left-module-Commutative-Ring (add-Commutative-Ring R r s) x = + add-left-module-Commutative-Ring + ( mul-left-module-Commutative-Ring r x) + ( mul-left-module-Commutative-Ring s x) + right-distributive-mul-add-left-module-Commutative-Ring = + right-distributive-mul-add-left-module-Ring (ring-Commutative-Ring R) M + + associative-mul-left-module-Commutative-Ring : + (r s : type-Commutative-Ring R) (x : type-left-module-Commutative-Ring) → + mul-left-module-Commutative-Ring (mul-Commutative-Ring R r s) x = + mul-left-module-Commutative-Ring r (mul-left-module-Commutative-Ring s x) + associative-mul-left-module-Commutative-Ring = + associative-mul-left-module-Ring (ring-Commutative-Ring R) M + + left-zero-law-mul-left-module-Commutative-Ring : + (x : type-left-module-Commutative-Ring) → + mul-left-module-Commutative-Ring (zero-Commutative-Ring R) x = + zero-left-module-Commutative-Ring + left-zero-law-mul-left-module-Commutative-Ring = + left-zero-law-mul-left-module-Ring (ring-Commutative-Ring R) M + + right-zero-law-mul-left-module-Commutative-Ring : + (r : type-Commutative-Ring R) → + mul-left-module-Commutative-Ring r zero-left-module-Commutative-Ring = + zero-left-module-Commutative-Ring + right-zero-law-mul-left-module-Commutative-Ring = + right-zero-law-mul-left-module-Ring (ring-Commutative-Ring R) M + + left-negative-law-mul-left-module-Commutative-Ring : + (r : type-Commutative-Ring R) (x : type-left-module-Commutative-Ring) → + mul-left-module-Commutative-Ring (neg-Commutative-Ring R r) x = + neg-left-module-Commutative-Ring (mul-left-module-Commutative-Ring r x) + left-negative-law-mul-left-module-Commutative-Ring = + left-negative-law-mul-left-module-Ring (ring-Commutative-Ring R) M + + right-negative-law-mul-left-module-Commutative-Ring : + (r : type-Commutative-Ring R) (x : type-left-module-Commutative-Ring) → + mul-left-module-Commutative-Ring r (neg-left-module-Commutative-Ring x) = + neg-left-module-Commutative-Ring (mul-left-module-Commutative-Ring r x) + right-negative-law-mul-left-module-Commutative-Ring = + right-negative-law-mul-left-module-Ring (ring-Commutative-Ring R) M + + mul-neg-one-left-module-Commutative-Ring : + (x : type-left-module-Commutative-Ring) → + mul-left-module-Commutative-Ring + ( neg-Commutative-Ring R (one-Commutative-Ring R)) + ( x) = + neg-left-module-Commutative-Ring x + mul-neg-one-left-module-Commutative-Ring = + mul-neg-one-left-module-Ring (ring-Commutative-Ring R) M +``` + +## Properties + +### Any commutative ring is a left module over itself + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + left-module-commutative-ring-Commutative-Ring : + left-module-Commutative-Ring l R + left-module-commutative-ring-Commutative-Ring = + left-module-ring-Ring (ring-Commutative-Ring R) +``` + +### Constructing a left module over a commutative ring from axioms + +```agda +make-left-module-Commutative-Ring : + {l1 l2 : Level} → + (R : Commutative-Ring l1) (A : Ab l2) → + (mul-left : type-Commutative-Ring R → type-Ab A → type-Ab A) → + (left-distributive-mul-add : + (r : type-Commutative-Ring R) (a b : type-Ab A) → + mul-left r (add-Ab A a b) = add-Ab A (mul-left r a) (mul-left r b)) → + (right-distributive-mul-add : + (r s : type-Commutative-Ring R) (a : type-Ab A) → + mul-left (add-Commutative-Ring R r s) a = + add-Ab A (mul-left r a) (mul-left s a)) → + (left-unit-law-mul : + (a : type-Ab A) → mul-left (one-Commutative-Ring R) a = a) → + (associative-mul : + (r s : type-Commutative-Ring R) (a : type-Ab A) → + mul-left (mul-Commutative-Ring R r s) a = mul-left r (mul-left s a)) → + left-module-Commutative-Ring l2 R +make-left-module-Commutative-Ring R = + make-left-module-Ring (ring-Commutative-Ring R) +``` diff --git a/src/linear-algebra/left-modules-rings.lagda.md b/src/linear-algebra/left-modules-rings.lagda.md index 35ae1ca391..6bc9d5ff41 100644 --- a/src/linear-algebra/left-modules-rings.lagda.md +++ b/src/linear-algebra/left-modules-rings.lagda.md @@ -36,7 +36,7 @@ open import ring-theory.rings ## Idea A -{{#concept "left module" WD="left module" WDID="Q120721996" Agda=left-module-Ring}} +{{#concept "left module" WD="left module" WDID="Q120721996" disambiguation="over a ring" Agda=left-module-Ring}} `M` over a [ring](ring-theory.rings.md) `R` consists of an [abelian group](group-theory.abelian-groups.md) `M` equipped with an action `R → M → M` such that From 34140535b4a7b9a36d4353e4e93114178228742d Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Thu, 11 Sep 2025 10:59:17 -0700 Subject: [PATCH 59/97] Inhabited totally bounded subspaces of metric spaces (#1542) Making this its own concept cleaned up a number of things. --- .../cartesian-products-subtypes.lagda.md | 24 ++ src/metric-spaces.lagda.md | 2 + .../approximations-metric-spaces.lagda.md | 47 +++ ...y-bounded-subspaces-metric-spaces.lagda.md | 137 ++++++ src/metric-spaces/nets-metric-spaces.lagda.md | 20 + .../subspaces-metric-spaces.lagda.md | 19 + .../totally-bounded-metric-spaces.lagda.md | 61 ++- ...y-bounded-subspaces-metric-spaces.lagda.md | 123 ++++++ src/real-numbers.lagda.md | 1 + ...ally-bounded-subsets-real-numbers.lagda.md | 390 ++++++++++++++++++ ...ally-bounded-subsets-real-numbers.lagda.md | 294 ------------- .../finitely-enumerable-subtypes.lagda.md | 27 ++ 12 files changed, 850 insertions(+), 295 deletions(-) create mode 100644 src/metric-spaces/inhabited-totally-bounded-subspaces-metric-spaces.lagda.md create mode 100644 src/metric-spaces/totally-bounded-subspaces-metric-spaces.lagda.md create mode 100644 src/real-numbers/inhabited-totally-bounded-subsets-real-numbers.lagda.md diff --git a/src/foundation/cartesian-products-subtypes.lagda.md b/src/foundation/cartesian-products-subtypes.lagda.md index a9a160b7be..809c564d69 100644 --- a/src/foundation/cartesian-products-subtypes.lagda.md +++ b/src/foundation/cartesian-products-subtypes.lagda.md @@ -10,6 +10,8 @@ module foundation.cartesian-products-subtypes where open import foundation.cartesian-product-types open import foundation.conjunction open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.identity-types open import foundation.subtypes open import foundation.universe-levels ``` @@ -30,4 +32,26 @@ product-subtype : {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} → subtype l3 A → subtype l4 B → subtype (l3 ⊔ l4) (A × B) product-subtype P Q (a , b) = P a ∧ Q b + +type-product-subtype : + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} → + subtype l3 A → subtype l4 B → UU (l1 ⊔ l2 ⊔ l3 ⊔ l4) +type-product-subtype P Q = type-subtype (product-subtype P Q) +``` + +## Properties + +### The type of the Cartesian product of subtypes is equivalent to the Cartesian products of their types + +```agda +equiv-product-subtype : + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} → + (S : subtype l3 A) (T : subtype l4 B) → + type-product-subtype S T ≃ (type-subtype S × type-subtype T) +equiv-product-subtype S T = + ( (λ ((s , t) , s∈S , t∈T) → ((s , s∈S) , (t , t∈T))) , + is-equiv-is-invertible + ( λ ((s , s∈S) , (t , t∈T)) → ((s , t) , s∈S , t∈T)) + ( λ _ → refl) + ( λ _ → refl)) ``` diff --git a/src/metric-spaces.lagda.md b/src/metric-spaces.lagda.md index 16236a4f7f..194833d256 100644 --- a/src/metric-spaces.lagda.md +++ b/src/metric-spaces.lagda.md @@ -79,6 +79,7 @@ open import metric-spaces.images-metric-spaces public open import metric-spaces.images-short-functions-metric-spaces public open import metric-spaces.images-uniformly-continuous-functions-metric-spaces public open import metric-spaces.indexed-sums-metric-spaces public +open import metric-spaces.inhabited-totally-bounded-subspaces-metric-spaces public open import metric-spaces.interior-subsets-metric-spaces public open import metric-spaces.isometries-metric-spaces public open import metric-spaces.isometries-pseudometric-spaces public @@ -126,6 +127,7 @@ open import metric-spaces.similarity-of-elements-pseudometric-spaces public open import metric-spaces.subspaces-metric-spaces public open import metric-spaces.symmetric-rational-neighborhood-relations public open import metric-spaces.totally-bounded-metric-spaces public +open import metric-spaces.totally-bounded-subspaces-metric-spaces public open import metric-spaces.triangular-rational-neighborhood-relations public open import metric-spaces.uniformly-continuous-functions-metric-spaces public ``` diff --git a/src/metric-spaces/approximations-metric-spaces.lagda.md b/src/metric-spaces/approximations-metric-spaces.lagda.md index 81e45ddedc..3d36710b88 100644 --- a/src/metric-spaces/approximations-metric-spaces.lagda.md +++ b/src/metric-spaces/approximations-metric-spaces.lagda.md @@ -9,6 +9,7 @@ module metric-spaces.approximations-metric-spaces where ```agda open import elementary-number-theory.positive-rational-numbers +open import foundation.cartesian-products-subtypes open import foundation.dependent-pair-types open import foundation.existential-quantification open import foundation.full-subtypes @@ -262,6 +263,52 @@ module _ unit-trunc-Prop s ``` +### Cartesian products of approximations + +```agda +module _ + {l1 l2 l3 l4 l5 l6 : Level} (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) + (ε : ℚ⁺) + (A : approximation-Metric-Space l5 X ε) + (B : approximation-Metric-Space l6 Y ε) + where + + abstract + is-approximation-product-approximation-Metric-Space : + is-approximation-Metric-Space + ( product-Metric-Space X Y) + ( ε) + ( product-subtype + ( subset-approximation-Metric-Space X ε A) + ( subset-approximation-Metric-Space Y ε B)) + is-approximation-product-approximation-Metric-Space (x , y) = + let + open + do-syntax-trunc-Prop + ( ∃ + ( type-product-subtype + ( subset-approximation-Metric-Space X ε A) + ( subset-approximation-Metric-Space Y ε B)) + ( λ (ab , _) → + neighborhood-prop-Metric-Space + ( product-Metric-Space X Y) + ( ε) + ( ab) + ( x , y))) + in do + ((a , a∈A) , Nεax) ← is-approximation-approximation-Metric-Space X ε A x + ((b , b∈B) , Nεby) ← is-approximation-approximation-Metric-Space Y ε B y + intro-exists (((a , b) , a∈A , b∈B)) (Nεax , Nεby) + + product-approximation-Metric-Space : + approximation-Metric-Space (l5 ⊔ l6) (product-Metric-Space X Y) ε + product-approximation-Metric-Space = + ( product-subtype + ( subset-approximation-Metric-Space X ε A) + ( subset-approximation-Metric-Space Y ε B) , + is-approximation-product-approximation-Metric-Space) +``` + ## References {{#bibliography}} diff --git a/src/metric-spaces/inhabited-totally-bounded-subspaces-metric-spaces.lagda.md b/src/metric-spaces/inhabited-totally-bounded-subspaces-metric-spaces.lagda.md new file mode 100644 index 0000000000..19a7eefb41 --- /dev/null +++ b/src/metric-spaces/inhabited-totally-bounded-subspaces-metric-spaces.lagda.md @@ -0,0 +1,137 @@ +# Inhabited, totally bounded subspaces of metric spaces + +```agda +module metric-spaces.inhabited-totally-bounded-subspaces-metric-spaces where +``` + +
Imports + +```agda +open import foundation.cartesian-products-subtypes +open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.function-types +open import foundation.images +open import foundation.images-subtypes +open import foundation.inhabited-subtypes +open import foundation.inhabited-types +open import foundation.universe-levels + +open import metric-spaces.cartesian-products-metric-spaces +open import metric-spaces.metric-spaces +open import metric-spaces.subspaces-metric-spaces +open import metric-spaces.totally-bounded-metric-spaces +open import metric-spaces.totally-bounded-subspaces-metric-spaces +open import metric-spaces.uniformly-continuous-functions-metric-spaces +``` + +
+ +## Idea + +An +{{#concept "inhabited, totally bounded subspace" Disambiguation="of a metric space" Agda=inhabited-totally-bounded-subspace-Metric-Space}} +of a [metric space](metric-spaces.metric-spaces.md) `X` is a +[subspace](metric-spaces.subspaces-metric-spaces.md) `S ⊆ X` that is +[totally bounded](metric-spaces.totally-bounded-subspaces-metric-spaces.md) and +[inhabited](foundation.inhabited-subtypes.md). + +## Definition + +```agda +inhabited-totally-bounded-subspace-Metric-Space : + {l1 l2 : Level} (l3 l4 : Level) → Metric-Space l1 l2 → + UU (l1 ⊔ l2 ⊔ lsuc l3 ⊔ lsuc l4) +inhabited-totally-bounded-subspace-Metric-Space l3 l4 X = + Σ ( totally-bounded-subspace-Metric-Space l3 l4 X) + ( λ S → + is-inhabited-subtype (subset-totally-bounded-subspace-Metric-Space X S)) + +module _ + {l1 l2 l3 l4 : Level} (X : Metric-Space l1 l2) + (S : inhabited-totally-bounded-subspace-Metric-Space l3 l4 X) + where + + totally-bounded-subspace-inhabited-totally-bounded-subspace-Metric-Space : + totally-bounded-subspace-Metric-Space l3 l4 X + totally-bounded-subspace-inhabited-totally-bounded-subspace-Metric-Space = + pr1 S + + subset-inhabited-totally-bounded-subspace-Metric-Space : + subset-Metric-Space l3 X + subset-inhabited-totally-bounded-subspace-Metric-Space = + subset-totally-bounded-subspace-Metric-Space + ( X) + ( totally-bounded-subspace-inhabited-totally-bounded-subspace-Metric-Space) + + subspace-inhabited-totally-bounded-subspace-Metric-Space : + Metric-Space (l1 ⊔ l3) l2 + subspace-inhabited-totally-bounded-subspace-Metric-Space = + subspace-totally-bounded-subspace-Metric-Space + ( X) + ( totally-bounded-subspace-inhabited-totally-bounded-subspace-Metric-Space) + + is-totally-bounded-subspace-inhabited-totally-bounded-subspace-Metric-Space : + is-totally-bounded-Metric-Space + ( l4) + ( subspace-inhabited-totally-bounded-subspace-Metric-Space) + is-totally-bounded-subspace-inhabited-totally-bounded-subspace-Metric-Space = + is-totally-bounded-subspace-totally-bounded-subspace-Metric-Space + ( X) + ( totally-bounded-subspace-inhabited-totally-bounded-subspace-Metric-Space) + + is-inhabited-inhabited-totally-bounded-subspace-Metric-Space : + is-inhabited-subtype subset-inhabited-totally-bounded-subspace-Metric-Space + is-inhabited-inhabited-totally-bounded-subspace-Metric-Space = pr2 S +``` + +## Properties + +### The image of an inhabited totally bounded subspace of a metric space under a uniformly continuous function is an inhabited totally bounded subspace + +```agda +im-uniformly-continuous-function-inhabited-totally-bounded-subspace-Metric-Space : + {l1 l2 l3 l4 l5 l6 : Level} → + (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) → + (f : uniformly-continuous-function-Metric-Space X Y) → + inhabited-totally-bounded-subspace-Metric-Space l5 l6 X → + inhabited-totally-bounded-subspace-Metric-Space + ( l1 ⊔ l3 ⊔ l5) + ( l1 ⊔ l3 ⊔ l5 ⊔ l6) + ( Y) +im-uniformly-continuous-function-inhabited-totally-bounded-subspace-Metric-Space + X Y f (S , |S|) = + ( im-uniformly-continuous-function-totally-bounded-subspace-Metric-Space + ( X) + ( Y) + ( f) + ( S) , + map-is-inhabited + ( map-unit-im + ( map-uniformly-continuous-function-Metric-Space X Y f ∘ + inclusion-totally-bounded-subspace-Metric-Space X S)) + ( |S|)) +``` + +### Inhabited, totally bounded subspaces of metric spaces are closed under cartesian products + +```agda +product-inhabited-totally-bounded-subspace-Metric-Space : + {l1 l2 l3 l4 l5 l6 l7 l8 : Level} → + (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) → + (S : inhabited-totally-bounded-subspace-Metric-Space l5 l6 X) → + (T : inhabited-totally-bounded-subspace-Metric-Space l7 l8 Y) → + inhabited-totally-bounded-subspace-Metric-Space + ( l5 ⊔ l7) + ( l1 ⊔ l3 ⊔ l5 ⊔ l6 ⊔ l7 ⊔ l8) + ( product-Metric-Space X Y) +product-inhabited-totally-bounded-subspace-Metric-Space + X Y (S , |S|) (T , |T|) = + ( product-totally-bounded-subspace-Metric-Space X Y S T , + map-is-inhabited + ( map-inv-equiv + ( equiv-product-subtype + ( subset-totally-bounded-subspace-Metric-Space X S) + ( subset-totally-bounded-subspace-Metric-Space Y T))) + ( is-inhabited-Σ |S| (λ _ → |T|))) +``` diff --git a/src/metric-spaces/nets-metric-spaces.lagda.md b/src/metric-spaces/nets-metric-spaces.lagda.md index 16b79aa421..bbbd680d5b 100644 --- a/src/metric-spaces/nets-metric-spaces.lagda.md +++ b/src/metric-spaces/nets-metric-spaces.lagda.md @@ -17,6 +17,7 @@ open import foundation.subtypes open import foundation.universe-levels open import metric-spaces.approximations-metric-spaces +open import metric-spaces.cartesian-products-metric-spaces open import metric-spaces.equality-of-metric-spaces open import metric-spaces.functions-metric-spaces open import metric-spaces.images-isometries-metric-spaces @@ -206,3 +207,22 @@ module _ is-approximation-im-isometric-equiv-approximation-Metric-Space X Y f ε ( approximation-net-Metric-Space X ε N)) ``` + +### Cartesian products of nets of metric spaces + +```agda +module _ + {l1 l2 l3 l4 l5 l6 : Level} (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) + (ε : ℚ⁺) (M : net-Metric-Space l5 X ε) (N : net-Metric-Space l6 Y ε) + where + + product-net-Metric-Space : + net-Metric-Space (l5 ⊔ l6) (product-Metric-Space X Y) ε + product-net-Metric-Space = + ( product-finitely-enumerable-subtype + ( finitely-enumerable-subset-net-Metric-Space X ε M) + ( finitely-enumerable-subset-net-Metric-Space Y ε N) , + is-approximation-product-approximation-Metric-Space X Y ε + ( approximation-net-Metric-Space X ε M) + ( approximation-net-Metric-Space Y ε N)) +``` diff --git a/src/metric-spaces/subspaces-metric-spaces.lagda.md b/src/metric-spaces/subspaces-metric-spaces.lagda.md index 7e45d42eaf..30c6622489 100644 --- a/src/metric-spaces/subspaces-metric-spaces.lagda.md +++ b/src/metric-spaces/subspaces-metric-spaces.lagda.md @@ -26,6 +26,7 @@ open import metric-spaces.saturated-rational-neighborhood-relations open import metric-spaces.short-functions-metric-spaces open import metric-spaces.symmetric-rational-neighborhood-relations open import metric-spaces.triangular-rational-neighborhood-relations +open import metric-spaces.uniformly-continuous-functions-metric-spaces ``` @@ -195,3 +196,21 @@ module _ ( A) ( isometry-inclusion-subspace-Metric-Space A S) ``` + +### The inclusion of a subspace into its ambient space is uniformly continuous + +```agda +module _ + {l l1 l2 : Level} + (A : Metric-Space l1 l2) + (S : subset-Metric-Space l A) + where + + uniformly-continuous-inclusion-subspace-Metric-Space : + uniformly-continuous-function-Metric-Space (subspace-Metric-Space A S) A + uniformly-continuous-inclusion-subspace-Metric-Space = + uniformly-continuous-isometry-Metric-Space + ( subspace-Metric-Space A S) + ( A) + ( isometry-inclusion-subspace-Metric-Space A S) +``` diff --git a/src/metric-spaces/totally-bounded-metric-spaces.lagda.md b/src/metric-spaces/totally-bounded-metric-spaces.lagda.md index 07d7409b91..afc419656a 100644 --- a/src/metric-spaces/totally-bounded-metric-spaces.lagda.md +++ b/src/metric-spaces/totally-bounded-metric-spaces.lagda.md @@ -15,6 +15,7 @@ open import foundation.propositional-truncations open import foundation.propositions open import foundation.universe-levels +open import metric-spaces.cartesian-products-metric-spaces open import metric-spaces.equality-of-metric-spaces open import metric-spaces.functions-metric-spaces open import metric-spaces.images-isometries-metric-spaces @@ -36,7 +37,9 @@ A [metric space](metric-spaces.metric-spaces.md) is {{#concept "totally bounded" disambiguation="metric space" WDID=Q1362228 WD="totally bounded space" Agda=is-totally-bounded-Metric-Space}} if for every `ε : ℚ⁺`, it has an `ε`-[net](metric-spaces.nets-metric-spaces.md). -## Definition +## Definitions + +### The property of a space being totally bounded ```agda module _ @@ -56,6 +59,27 @@ module _ type-Prop is-totally-bounded-prop-Metric-Space ``` +### Totally bounded metric spaces + +```agda +Totally-Bounded-Metric-Space : + (l1 l2 l3 : Level) → UU (lsuc l1 ⊔ lsuc l2 ⊔ lsuc l3) +Totally-Bounded-Metric-Space l1 l2 l3 = + Σ (Metric-Space l1 l2) (is-totally-bounded-Metric-Space l3) + +module _ + {l1 l2 l3 : Level} (M : Totally-Bounded-Metric-Space l1 l2 l3) + where + + metric-space-Totally-Bounded-Metric-Space : Metric-Space l1 l2 + metric-space-Totally-Bounded-Metric-Space = pr1 M + + is-totally-bounded-metric-space-Totally-Bounded-Metric-Space : + is-totally-bounded-Metric-Space l3 metric-space-Totally-Bounded-Metric-Space + is-totally-bounded-metric-space-Totally-Bounded-Metric-Space = + pr2 M +``` + ## Properties ### The image of a totally bounded metric space under a uniformly continuous function is totally bounded @@ -175,3 +199,38 @@ module _ ( λ μX ε → net-im-isometric-equiv-net-Metric-Space X Y f ε (μX ε)) ( tbX) ``` + +### Totally bounded metric spaces are closed under cartesian products + +```agda +abstract + is-totally-bounded-product-Totally-Bounded-Metric-Space : + {l1 l2 l3 l4 l5 l6 : Level} → + (X : Totally-Bounded-Metric-Space l1 l2 l3) → + (Y : Totally-Bounded-Metric-Space l4 l5 l6) → + is-totally-bounded-Metric-Space + ( l3 ⊔ l6) + ( product-Metric-Space + ( metric-space-Totally-Bounded-Metric-Space X) + ( metric-space-Totally-Bounded-Metric-Space Y)) + is-totally-bounded-product-Totally-Bounded-Metric-Space (X , tbX) (Y , tbY) = + let + open + do-syntax-trunc-Prop + ( is-totally-bounded-prop-Metric-Space + _ + ( product-Metric-Space X Y)) + in do + mX ← tbX + mY ← tbY + unit-trunc-Prop ( λ ε → product-net-Metric-Space X Y ε (mX ε) (mY ε)) + +product-Totally-Bounded-Metric-Space : + {l1 l2 l3 l4 l5 l6 : Level} → + (X : Totally-Bounded-Metric-Space l1 l2 l3) → + (Y : Totally-Bounded-Metric-Space l4 l5 l6) → + Totally-Bounded-Metric-Space (l1 ⊔ l4) (l2 ⊔ l5) (l3 ⊔ l6) +product-Totally-Bounded-Metric-Space (X , tbX) (Y , tbY) = + ( product-Metric-Space X Y , + is-totally-bounded-product-Totally-Bounded-Metric-Space (X , tbX) (Y , tbY)) +``` diff --git a/src/metric-spaces/totally-bounded-subspaces-metric-spaces.lagda.md b/src/metric-spaces/totally-bounded-subspaces-metric-spaces.lagda.md new file mode 100644 index 0000000000..58cee39164 --- /dev/null +++ b/src/metric-spaces/totally-bounded-subspaces-metric-spaces.lagda.md @@ -0,0 +1,123 @@ +# Totally bounded subspaces of metric spaces + +```agda +module metric-spaces.totally-bounded-subspaces-metric-spaces where +``` + +
Imports + +```agda +open import foundation.cartesian-products-subtypes +open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.images-subtypes +open import foundation.logical-equivalences +open import foundation.subtypes +open import foundation.universe-levels + +open import metric-spaces.cartesian-products-metric-spaces +open import metric-spaces.metric-spaces +open import metric-spaces.subspaces-metric-spaces +open import metric-spaces.totally-bounded-metric-spaces +open import metric-spaces.uniformly-continuous-functions-metric-spaces +``` + +
+ +## Idea + +A +{{#concept "totally bounded" disambiguation="subspace of a metric space" WDID=Q1362228 WD="totally bounded space" Agda=is-totally-bounded-subset-Metric-Space}} +[subspace](metric-spaces.subspaces-metric-spaces.md) of a +[metric space](metric-spaces.metric-spaces.md) is a subspace that is +[totally bounded](metric-spaces.totally-bounded-metric-spaces.md). + +## Definition + +```agda +totally-bounded-subspace-Metric-Space : + {l1 l2 : Level} (l3 l4 : Level) → Metric-Space l1 l2 → + UU (l1 ⊔ l2 ⊔ lsuc l3 ⊔ lsuc l4) +totally-bounded-subspace-Metric-Space l3 l4 X = + Σ ( subset-Metric-Space l3 X) + ( λ S → is-totally-bounded-Metric-Space l4 (subspace-Metric-Space X S)) + +module _ + {l1 l2 l3 l4 : Level} (X : Metric-Space l1 l2) + (S : totally-bounded-subspace-Metric-Space l3 l4 X) + where + + subset-totally-bounded-subspace-Metric-Space : subset-Metric-Space l3 X + subset-totally-bounded-subspace-Metric-Space = pr1 S + + type-totally-bounded-subspace-Metric-Space : UU (l1 ⊔ l3) + type-totally-bounded-subspace-Metric-Space = + type-subtype subset-totally-bounded-subspace-Metric-Space + + inclusion-totally-bounded-subspace-Metric-Space : + type-totally-bounded-subspace-Metric-Space → type-Metric-Space X + inclusion-totally-bounded-subspace-Metric-Space = + inclusion-subtype subset-totally-bounded-subspace-Metric-Space + + subspace-totally-bounded-subspace-Metric-Space : Metric-Space (l1 ⊔ l3) l2 + subspace-totally-bounded-subspace-Metric-Space = + subspace-Metric-Space X subset-totally-bounded-subspace-Metric-Space + + is-totally-bounded-subspace-totally-bounded-subspace-Metric-Space : + is-totally-bounded-Metric-Space + ( l4) + ( subspace-totally-bounded-subspace-Metric-Space) + is-totally-bounded-subspace-totally-bounded-subspace-Metric-Space = + pr2 S +``` + +## Properties + +### The image of a totally bounded subspace under a uniformly continuous function + +```agda +im-uniformly-continuous-function-totally-bounded-subspace-Metric-Space : + {l1 l2 l3 l4 l5 l6 : Level} → + (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) → + (f : uniformly-continuous-function-Metric-Space X Y) → + totally-bounded-subspace-Metric-Space l5 l6 X → + totally-bounded-subspace-Metric-Space (l1 ⊔ l3 ⊔ l5) (l1 ⊔ l3 ⊔ l5 ⊔ l6) Y +im-uniformly-continuous-function-totally-bounded-subspace-Metric-Space + X Y f (S , tbS) = + ( im-subtype (map-uniformly-continuous-function-Metric-Space X Y f) S , + is-totally-bounded-im-uniformly-continuous-function-is-totally-bounded-Metric-Space + ( subspace-Metric-Space X S) + ( Y) + ( tbS) + ( comp-uniformly-continuous-function-Metric-Space + ( subspace-Metric-Space X S) + ( X) + ( Y) + ( f) + ( uniformly-continuous-inclusion-subspace-Metric-Space X S))) +``` + +### Totally bounded subspaces of metric spaces are closed under Cartesian products + +```agda +product-totally-bounded-subspace-Metric-Space : + {l1 l2 l3 l4 l5 l6 l7 l8 : Level} → + (X : Metric-Space l1 l2) (Y : Metric-Space l3 l4) → + (S : totally-bounded-subspace-Metric-Space l5 l6 X) → + (T : totally-bounded-subspace-Metric-Space l7 l8 Y) → + totally-bounded-subspace-Metric-Space + ( l5 ⊔ l7) + ( l1 ⊔ l3 ⊔ l5 ⊔ l6 ⊔ l7 ⊔ l8) + ( product-Metric-Space X Y) +product-totally-bounded-subspace-Metric-Space X Y (S , tbS) (T , tbT) = + ( product-subtype S T , + preserves-is-totally-bounded-isometric-equiv-Metric-Space + ( product-Metric-Space + ( subspace-Metric-Space X S) + ( subspace-Metric-Space Y T)) + ( subspace-Metric-Space (product-Metric-Space X Y) (product-subtype S T)) + ( is-totally-bounded-product-Totally-Bounded-Metric-Space + ( subspace-Metric-Space X S , tbS) + ( subspace-Metric-Space Y T , tbT)) + ( inv-equiv (equiv-product-subtype S T) , (λ _ _ _ → id-iff))) +``` diff --git a/src/real-numbers.lagda.md b/src/real-numbers.lagda.md index 1ddc758600..aba3f11975 100644 --- a/src/real-numbers.lagda.md +++ b/src/real-numbers.lagda.md @@ -23,6 +23,7 @@ open import real-numbers.inequality-real-numbers public open import real-numbers.inequality-upper-dedekind-real-numbers public open import real-numbers.infima-families-real-numbers public open import real-numbers.inhabited-finitely-enumerable-subsets-real-numbers public +open import real-numbers.inhabited-totally-bounded-subsets-real-numbers public open import real-numbers.isometry-addition-real-numbers public open import real-numbers.isometry-negation-real-numbers public open import real-numbers.lower-dedekind-real-numbers public diff --git a/src/real-numbers/inhabited-totally-bounded-subsets-real-numbers.lagda.md b/src/real-numbers/inhabited-totally-bounded-subsets-real-numbers.lagda.md new file mode 100644 index 0000000000..23d900598b --- /dev/null +++ b/src/real-numbers/inhabited-totally-bounded-subsets-real-numbers.lagda.md @@ -0,0 +1,390 @@ +# Inhabited totally bounded subsets of the real numbers + +```agda +{-# OPTIONS --lossy-unification #-} + +module real-numbers.inhabited-totally-bounded-subsets-real-numbers where +``` + +
Imports + +```agda +open import elementary-number-theory.positive-rational-numbers + +open import foundation.dependent-pair-types +open import foundation.empty-types +open import foundation.existential-quantification +open import foundation.function-types +open import foundation.identity-types +open import foundation.images +open import foundation.inhabited-subtypes +open import foundation.inhabited-types +open import foundation.logical-equivalences +open import foundation.propositional-truncations +open import foundation.propositions +open import foundation.subtypes +open import foundation.transport-along-identifications +open import foundation.universe-levels + +open import metric-spaces.approximations-metric-spaces +open import metric-spaces.inhabited-totally-bounded-subspaces-metric-spaces +open import metric-spaces.metric-spaces +open import metric-spaces.nets-metric-spaces +open import metric-spaces.subspaces-metric-spaces +open import metric-spaces.totally-bounded-metric-spaces + +open import order-theory.upper-bounds-large-posets + +open import real-numbers.addition-real-numbers +open import real-numbers.cauchy-completeness-dedekind-real-numbers +open import real-numbers.dedekind-real-numbers +open import real-numbers.difference-real-numbers +open import real-numbers.inequality-real-numbers +open import real-numbers.infima-families-real-numbers +open import real-numbers.inhabited-finitely-enumerable-subsets-real-numbers +open import real-numbers.maximum-inhabited-finitely-enumerable-subsets-real-numbers +open import real-numbers.metric-space-of-real-numbers +open import real-numbers.negation-real-numbers +open import real-numbers.rational-real-numbers +open import real-numbers.strict-inequality-real-numbers +open import real-numbers.subsets-real-numbers +open import real-numbers.suprema-families-real-numbers +open import real-numbers.totally-bounded-subsets-real-numbers + +open import univalent-combinatorics.inhabited-finitely-enumerable-subtypes +``` + +
+ +## Idea + +A [subset of the real numbers](real-numbers.subsets-real-numbers.md) is +{{#concept "inhabited and totally bounded" Disambiguation="subset of the real numbers" Agda=inhabited-totally-bounded-subset-ℝ}} +if it is an +[inhabited, totally bounded subspace](metric-spaces.inhabited-totally-bounded-subspaces-metric-spaces.md) +of the +[metric space of real numbers](real-numbers.metric-space-of-real-numbers.md). + +```agda +inhabited-totally-bounded-subset-ℝ : + (l1 l2 l3 : Level) → UU (lsuc l1 ⊔ lsuc l2 ⊔ lsuc l3) +inhabited-totally-bounded-subset-ℝ l1 l2 l3 = + inhabited-totally-bounded-subspace-Metric-Space l1 l3 (metric-space-ℝ l2) + +module _ + {l1 l2 l3 : Level} (S : inhabited-totally-bounded-subset-ℝ l1 l2 l3) + where + + totally-bounded-subset-inhabited-totally-bounded-subset-ℝ : + totally-bounded-subset-ℝ l1 l2 l3 + totally-bounded-subset-inhabited-totally-bounded-subset-ℝ = + totally-bounded-subspace-inhabited-totally-bounded-subspace-Metric-Space + ( metric-space-ℝ l2) + ( S) + + subset-inhabited-totally-bounded-subset-ℝ : subset-ℝ l1 l2 + subset-inhabited-totally-bounded-subset-ℝ = + subset-inhabited-totally-bounded-subspace-Metric-Space + ( metric-space-ℝ l2) + ( S) + + subspace-inhabited-totally-bounded-subset-ℝ : + Metric-Space (l1 ⊔ lsuc l2) l2 + subspace-inhabited-totally-bounded-subset-ℝ = + subspace-inhabited-totally-bounded-subspace-Metric-Space + ( metric-space-ℝ l2) + ( S) + + is-totally-bounded-subspace-inhabited-totally-bounded-subset-ℝ : + is-totally-bounded-Metric-Space + ( l3) + ( subspace-inhabited-totally-bounded-subset-ℝ) + is-totally-bounded-subspace-inhabited-totally-bounded-subset-ℝ = + is-totally-bounded-subspace-inhabited-totally-bounded-subspace-Metric-Space + ( metric-space-ℝ l2) + ( S) + + is-inhabited-inhabited-totally-bounded-subset-ℝ : + is-inhabited-subtype subset-inhabited-totally-bounded-subset-ℝ + is-inhabited-inhabited-totally-bounded-subset-ℝ = + is-inhabited-inhabited-totally-bounded-subspace-Metric-Space + ( metric-space-ℝ l2) + ( S) +``` + +## Properties + +### The elementwise negation of an inhabited totally bounded subset of ℝ is inhabited and totally bounded + +```agda +neg-inhabited-totally-bounded-subset-ℝ : + {l1 l2 l3 : Level} → + inhabited-totally-bounded-subset-ℝ l1 l2 l3 → + inhabited-totally-bounded-subset-ℝ l1 l2 (l1 ⊔ lsuc l2 ⊔ l3) +neg-inhabited-totally-bounded-subset-ℝ (S@(S' , _) , |S|) = + ( neg-totally-bounded-subset-ℝ S , + neg-is-inhabited-subset-ℝ S' |S|) +``` + +### Inhabited, totally bounded subsets of ℝ have a supremum + +This proof is adapted from Theorem 11.5.7 of {{#cite UF13}}. + +```agda +module _ + {l1 l2 l3 : Level} (S : subset-ℝ l1 l2) (|S| : is-inhabited-subtype S) + (M : modulus-of-total-boundedness-subset-ℝ l3 S) + where + + private + net : ℚ⁺ → inhabited-finitely-enumerable-subset-ℝ (l1 ⊔ lsuc l2 ⊔ l3) l2 + net δ = + im-inhabited-finitely-enumerable-subtype + ( inclusion-subset-ℝ S) + ( inhabited-finitely-enumerable-subtype-net-Metric-Space + ( metric-space-subset-ℝ S) |S| δ (M δ)) + + is-net : + (δ : ℚ⁺) → + is-approximation-Metric-Space + ( metric-space-subset-ℝ S) + ( δ) + ( subset-net-Metric-Space (metric-space-subset-ℝ S) δ (M δ)) + is-net δ = pr2 (M δ) + + net⊆S : + (δ : ℚ⁺) → (subset-inhabited-finitely-enumerable-subset-ℝ (net δ)) ⊆ S + net⊆S δ n = + rec-trunc-Prop + ( S n) + ( λ z → tr (type-Prop ∘ S) (pr2 z) (pr2 (pr1 (pr1 z)))) + + max-net : ℚ⁺ → ℝ l2 + max-net δ = max-inhabited-finitely-enumerable-subset-ℝ (net δ) + + abstract + cauchy-approximation-sup-modulated-totally-bounded-subset-ℝ : + cauchy-approximation-ℝ l2 + cauchy-approximation-sup-modulated-totally-bounded-subset-ℝ = + let + bound : (ε η : ℚ⁺) → leq-ℝ (max-net ε) (max-net η +ℝ real-ℚ⁺ η) + bound ε η = + forward-implication + ( is-least-upper-bound-max-inhabited-finitely-enumerable-subset-ℝ + ( net ε) + ( max-net η +ℝ real-ℚ⁺ η)) + ( λ (z , z∈net-ε) → + let + open + do-syntax-trunc-Prop + ( leq-prop-ℝ z (max-net η +ℝ real-ℚ⁺ η)) + in do + (((y , y∈S) , y∈net-η) , Nηyz) ← + is-net η (z , net⊆S ε z z∈net-ε) + transitive-leq-ℝ + ( z) + ( y +ℝ real-ℚ⁺ η) + ( max-net η +ℝ real-ℚ⁺ η) + ( preserves-leq-right-add-ℝ + ( real-ℚ⁺ η) + ( y) + ( max-net η) + ( is-upper-bound-max-inhabited-finitely-enumerable-subset-ℝ + ( net η) + ( map-unit-im (pr1 ∘ pr1) (((y , y∈S) , y∈net-η))))) + ( right-leq-real-bound-neighborhood-ℝ η _ _ Nηyz)) + in + ( max-net , + λ ε η → + neighborhood-real-bound-each-leq-ℝ (ε +ℚ⁺ η) _ _ + ( transitive-leq-ℝ + ( max-net ε) + ( max-net η +ℝ real-ℚ⁺ η) + ( max-net η +ℝ real-ℚ⁺ (ε +ℚ⁺ η)) + ( preserves-leq-left-add-ℝ (max-net η) _ _ + ( preserves-leq-real-ℚ _ _ (leq-left-add-rational-ℚ⁺ _ ε))) + ( bound ε η)) + ( transitive-leq-ℝ + ( max-net η) + ( max-net ε +ℝ real-ℚ⁺ ε) + ( max-net ε +ℝ real-ℚ⁺ (ε +ℚ⁺ η)) + ( preserves-leq-left-add-ℝ (max-net ε) _ _ + ( preserves-leq-real-ℚ _ _ (leq-right-add-rational-ℚ⁺ _ η))) + ( bound η ε))) + + sup-modulated-totally-bounded-subset-ℝ : ℝ l2 + sup-modulated-totally-bounded-subset-ℝ = + lim-cauchy-approximation-ℝ + ( cauchy-approximation-sup-modulated-totally-bounded-subset-ℝ) + + is-upper-bound-sup-modulated-totally-bounded-subset-ℝ : + is-upper-bound-family-of-elements-Large-Poset + ( ℝ-Large-Poset) + ( inclusion-subset-ℝ S) + ( sup-modulated-totally-bounded-subset-ℝ) + is-upper-bound-sup-modulated-totally-bounded-subset-ℝ (x , x∈S) = + leq-not-le-ℝ _ _ + ( λ sup @@ -144,269 +116,3 @@ module _ ( neg-subset-ℝ (subset-totally-bounded-subset-ℝ S) , is-totally-bounded-neg-totally-bounded-subset-ℝ) ``` - -### Inhabited, totally bounded subsets of ℝ have a supremum - -This proof is adapted from Theorem 11.5.7 of {{#cite UF13}}. - -```agda -module _ - {l1 l2 l3 : Level} (S : subset-ℝ l1 l2) (|S| : is-inhabited-subtype S) - (M : modulus-of-total-boundedness-subset-ℝ l3 S) - where - - private - net : ℚ⁺ → inhabited-finitely-enumerable-subset-ℝ (l1 ⊔ lsuc l2 ⊔ l3) l2 - net δ = - im-inhabited-finitely-enumerable-subtype - ( inclusion-subset-ℝ S) - ( inhabited-finitely-enumerable-subtype-net-Metric-Space - ( metric-space-subset-ℝ S) |S| δ (M δ)) - - is-net : - (δ : ℚ⁺) → - is-approximation-Metric-Space - ( metric-space-subset-ℝ S) - ( δ) - ( subset-net-Metric-Space (metric-space-subset-ℝ S) δ (M δ)) - is-net δ = pr2 (M δ) - - net⊆S : - (δ : ℚ⁺) → (subset-inhabited-finitely-enumerable-subset-ℝ (net δ)) ⊆ S - net⊆S δ n = - rec-trunc-Prop - ( S n) - ( λ z → tr (type-Prop ∘ S) (pr2 z) (pr2 (pr1 (pr1 z)))) - - max-net : ℚ⁺ → ℝ l2 - max-net δ = max-inhabited-finitely-enumerable-subset-ℝ (net δ) - - abstract - cauchy-approximation-sup-modulated-totally-bounded-subset-ℝ : - cauchy-approximation-ℝ l2 - cauchy-approximation-sup-modulated-totally-bounded-subset-ℝ = - let - bound : (ε η : ℚ⁺) → leq-ℝ (max-net ε) (max-net η +ℝ real-ℚ⁺ η) - bound ε η = - forward-implication - ( is-least-upper-bound-max-inhabited-finitely-enumerable-subset-ℝ - ( net ε) - ( max-net η +ℝ real-ℚ⁺ η)) - ( λ (z , z∈net-ε) → - let - open - do-syntax-trunc-Prop - ( leq-prop-ℝ z (max-net η +ℝ real-ℚ⁺ η)) - in do - (((y , y∈S) , y∈net-η) , Nηyz) ← - is-net η (z , net⊆S ε z z∈net-ε) - transitive-leq-ℝ - ( z) - ( y +ℝ real-ℚ⁺ η) - ( max-net η +ℝ real-ℚ⁺ η) - ( preserves-leq-right-add-ℝ - ( real-ℚ⁺ η) - ( y) - ( max-net η) - ( is-upper-bound-max-inhabited-finitely-enumerable-subset-ℝ - ( net η) - ( map-unit-im (pr1 ∘ pr1) (((y , y∈S) , y∈net-η))))) - ( right-leq-real-bound-neighborhood-ℝ η _ _ Nηyz)) - in - ( max-net , - λ ε η → - neighborhood-real-bound-each-leq-ℝ (ε +ℚ⁺ η) _ _ - ( transitive-leq-ℝ - ( max-net ε) - ( max-net η +ℝ real-ℚ⁺ η) - ( max-net η +ℝ real-ℚ⁺ (ε +ℚ⁺ η)) - ( preserves-leq-left-add-ℝ (max-net η) _ _ - ( preserves-leq-real-ℚ _ _ (leq-left-add-rational-ℚ⁺ _ ε))) - ( bound ε η)) - ( transitive-leq-ℝ - ( max-net η) - ( max-net ε +ℝ real-ℚ⁺ ε) - ( max-net ε +ℝ real-ℚ⁺ (ε +ℚ⁺ η)) - ( preserves-leq-left-add-ℝ (max-net ε) _ _ - ( preserves-leq-real-ℚ _ _ (leq-right-add-rational-ℚ⁺ _ η))) - ( bound η ε))) - - sup-modulated-totally-bounded-subset-ℝ : ℝ l2 - sup-modulated-totally-bounded-subset-ℝ = - lim-cauchy-approximation-ℝ - ( cauchy-approximation-sup-modulated-totally-bounded-subset-ℝ) - - is-upper-bound-sup-modulated-totally-bounded-subset-ℝ : - is-upper-bound-family-of-elements-Large-Poset - ( ℝ-Large-Poset) - ( inclusion-subset-ℝ S) - ( sup-modulated-totally-bounded-subset-ℝ) - is-upper-bound-sup-modulated-totally-bounded-subset-ℝ (x , x∈S) = - leq-not-le-ℝ _ _ - ( λ sup Date: Thu, 11 Sep 2025 22:43:04 -0700 Subject: [PATCH 60/97] Formal power series and polynomials in commutative rings (#1541) --- src/commutative-algebra.lagda.md | 2 + ...al-power-series-commutative-rings.lagda.md | 509 ++++++++++++++++++ ...ower-series-commutative-semirings.lagda.md | 134 +++++ .../polynomials-commutative-rings.lagda.md | 376 +++++++++++++ ...polynomials-commutative-semirings.lagda.md | 243 +++++++++ ...of-elements-commutative-semirings.lagda.md | 22 + ...um-decompositions-natural-numbers.lagda.md | 12 + src/group-theory/abelian-groups.lagda.md | 12 + ...milies-of-elements-abelian-groups.lagda.md | 24 + ...s-of-elements-commutative-monoids.lagda.md | 26 +- ...te-families-of-elements-semirings.lagda.md | 22 + 11 files changed, 1381 insertions(+), 1 deletion(-) create mode 100644 src/commutative-algebra/formal-power-series-commutative-rings.lagda.md create mode 100644 src/commutative-algebra/polynomials-commutative-rings.lagda.md diff --git a/src/commutative-algebra.lagda.md b/src/commutative-algebra.lagda.md index dd213bb5da..b9f47f04bf 100644 --- a/src/commutative-algebra.lagda.md +++ b/src/commutative-algebra.lagda.md @@ -18,6 +18,7 @@ open import commutative-algebra.dependent-products-commutative-semirings public open import commutative-algebra.discrete-fields public open import commutative-algebra.eisenstein-integers public open import commutative-algebra.euclidean-domains public +open import commutative-algebra.formal-power-series-commutative-rings public open import commutative-algebra.formal-power-series-commutative-semirings public open import commutative-algebra.full-ideals-commutative-rings public open import commutative-algebra.function-commutative-rings public @@ -42,6 +43,7 @@ open import commutative-algebra.maximal-ideals-commutative-rings public open import commutative-algebra.multiples-of-elements-commutative-rings public open import commutative-algebra.nilradical-commutative-rings public open import commutative-algebra.nilradicals-commutative-semirings public +open import commutative-algebra.polynomials-commutative-rings public open import commutative-algebra.polynomials-commutative-semirings public open import commutative-algebra.poset-of-ideals-commutative-rings public open import commutative-algebra.poset-of-radical-ideals-commutative-rings public diff --git a/src/commutative-algebra/formal-power-series-commutative-rings.lagda.md b/src/commutative-algebra/formal-power-series-commutative-rings.lagda.md new file mode 100644 index 0000000000..b833c50eb8 --- /dev/null +++ b/src/commutative-algebra/formal-power-series-commutative-rings.lagda.md @@ -0,0 +1,509 @@ +# Formal power series in commutative rings + +```agda +module commutative-algebra.formal-power-series-commutative-rings where +``` + +
Imports + +```agda +open import commutative-algebra.commutative-rings +open import commutative-algebra.convolution-sequences-commutative-rings +open import commutative-algebra.formal-power-series-commutative-semirings +open import commutative-algebra.function-commutative-rings +open import commutative-algebra.homomorphisms-commutative-rings +open import commutative-algebra.powers-of-elements-commutative-rings + +open import elementary-number-theory.natural-numbers + +open import foundation.action-on-identifications-functions +open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.function-extensionality +open import foundation.identity-types +open import foundation.sets +open import foundation.universe-levels + +open import group-theory.abelian-groups +open import group-theory.commutative-monoids +open import group-theory.groups +open import group-theory.monoids +open import group-theory.semigroups + +open import lists.sequences + +open import ring-theory.rings +open import ring-theory.semirings +``` + +
+ +## Idea + +A +{{#concept "formal power series" WD="formal power series" WDID=Q1003025 disambiguation="in a commutative ring" Agda=formal-power-series-Commutative-Ring}} +is a formal sum of the form `Σₙ aₙxⁿ`, where `n` ranges over the +[natural numbers](elementary-number-theory.natural-numbers.md), without any +notion of convergence. + +## Definition + +```agda +formal-power-series-Commutative-Ring : + {l : Level} (R : Commutative-Ring l) → UU l +formal-power-series-Commutative-Ring R = + formal-power-series-Commutative-Semiring + ( commutative-semiring-Commutative-Ring R) + +formal-power-series-coefficients-Commutative-Ring : + {l : Level} (R : Commutative-Ring l) → + sequence (type-Commutative-Ring R) → formal-power-series-Commutative-Ring R +formal-power-series-coefficients-Commutative-Ring R = + formal-power-series-coefficients-Commutative-Semiring +``` + +## Properties + +### The terms in the infinite sum of evaluating a formal power series at an argument + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + term-ev-formal-power-series-Commutative-Ring : + (f : formal-power-series-Commutative-Ring R) → + (x : type-Commutative-Ring R) → + sequence (type-Commutative-Ring R) + term-ev-formal-power-series-Commutative-Ring = + term-ev-formal-power-series-Commutative-Semiring +``` + +### The set of formal power series + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + set-formal-power-series-Commutative-Ring : Set l + set-formal-power-series-Commutative-Ring = + set-formal-power-series-Commutative-Semiring + ( commutative-semiring-Commutative-Ring R) +``` + +### The constant zero formal power series + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + zero-formal-power-series-Commutative-Ring : + formal-power-series-Commutative-Ring R + zero-formal-power-series-Commutative-Ring = + zero-formal-power-series-Commutative-Semiring _ +``` + +### The constant one formal power series + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + one-formal-power-series-Commutative-Ring : + formal-power-series-Commutative-Ring R + one-formal-power-series-Commutative-Ring = + one-formal-power-series-Commutative-Semiring _ +``` + +### The identity formal power series + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + id-formal-power-series-Commutative-Ring : + formal-power-series-Commutative-Ring R + id-formal-power-series-Commutative-Ring = + id-formal-power-series-Commutative-Semiring _ +``` + +### Constant power series + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + constant-formal-power-series-Commutative-Ring : + type-Commutative-Ring R → formal-power-series-Commutative-Ring R + constant-formal-power-series-Commutative-Ring = + constant-formal-power-series-Commutative-Semiring _ +``` + +### The constant zero formal power series is the constant formal power series with value zero + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + constant-zero-formal-power-series-Commutative-Ring : + constant-formal-power-series-Commutative-Ring R (zero-Commutative-Ring R) = + zero-formal-power-series-Commutative-Ring R + constant-zero-formal-power-series-Commutative-Ring = + constant-zero-formal-power-series-Commutative-Semiring _ +``` + +### The constant one formal power series is the constant formal power series with value one + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + constant-one-formal-power-series-Commutative-Ring : + constant-formal-power-series-Commutative-Ring R (one-Commutative-Ring R) = + one-formal-power-series-Commutative-Ring R + constant-one-formal-power-series-Commutative-Ring = + constant-one-formal-power-series-Commutative-Semiring _ +``` + +### Addition + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + add-formal-power-series-Commutative-Ring : + formal-power-series-Commutative-Ring R → + formal-power-series-Commutative-Ring R → + formal-power-series-Commutative-Ring R + add-formal-power-series-Commutative-Ring = + add-formal-power-series-Commutative-Semiring +``` + +#### Associativity + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + associative-add-formal-power-series-Commutative-Ring : + (x y z : formal-power-series-Commutative-Ring R) → + add-formal-power-series-Commutative-Ring R + ( add-formal-power-series-Commutative-Ring R x y) + ( z) = + add-formal-power-series-Commutative-Ring R + ( x) + ( add-formal-power-series-Commutative-Ring R y z) + associative-add-formal-power-series-Commutative-Ring = + associative-add-formal-power-series-Commutative-Semiring +``` + +#### Commutativity + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + commutative-add-formal-power-series-Commutative-Ring : + (x y : formal-power-series-Commutative-Ring R) → + add-formal-power-series-Commutative-Ring R x y = + add-formal-power-series-Commutative-Ring R y x + commutative-add-formal-power-series-Commutative-Ring = + commutative-add-formal-power-series-Commutative-Semiring +``` + +#### Unit laws + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + left-unit-law-add-formal-power-series-Commutative-Ring : + (x : formal-power-series-Commutative-Ring R) → + add-formal-power-series-Commutative-Ring R + ( zero-formal-power-series-Commutative-Ring R) + ( x) = + x + left-unit-law-add-formal-power-series-Commutative-Ring = + left-unit-law-add-formal-power-series-Commutative-Semiring + + right-unit-law-add-formal-power-series-Commutative-Ring : + (x : formal-power-series-Commutative-Ring R) → + add-formal-power-series-Commutative-Ring R + ( x) + ( zero-formal-power-series-Commutative-Ring R) = + x + right-unit-law-add-formal-power-series-Commutative-Ring = + right-unit-law-add-formal-power-series-Commutative-Semiring +``` + +### Negation + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + neg-formal-power-series-Commutative-Ring : + formal-power-series-Commutative-Ring R → + formal-power-series-Commutative-Ring R + neg-formal-power-series-Commutative-Ring x = + formal-power-series-coefficients-Commutative-Semiring + ( λ n → + neg-Commutative-Ring R + ( coefficient-formal-power-series-Commutative-Semiring x n)) +``` + +#### Inverse laws for addition + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + abstract + left-inverse-law-add-formal-power-series-Commutative-Ring : + (x : formal-power-series-Commutative-Ring R) → + add-formal-power-series-Commutative-Ring R + ( neg-formal-power-series-Commutative-Ring R x) + ( x) = + zero-formal-power-series-Commutative-Ring R + left-inverse-law-add-formal-power-series-Commutative-Ring x = + ap + ( formal-power-series-coefficients-Commutative-Ring R) + ( eq-htpy (λ n → left-inverse-law-add-Commutative-Ring R _)) + + right-inverse-law-add-formal-power-series-Commutative-Ring : + (x : formal-power-series-Commutative-Ring R) → + add-formal-power-series-Commutative-Ring R + ( x) + ( neg-formal-power-series-Commutative-Ring R x) = + zero-formal-power-series-Commutative-Ring R + right-inverse-law-add-formal-power-series-Commutative-Ring x = + ap + ( formal-power-series-coefficients-Commutative-Ring R) + ( eq-htpy (λ n → right-inverse-law-add-Commutative-Ring R _)) +``` + +### Multiplication + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + mul-formal-power-series-Commutative-Ring : + formal-power-series-Commutative-Ring R → + formal-power-series-Commutative-Ring R → + formal-power-series-Commutative-Ring R + mul-formal-power-series-Commutative-Ring = + mul-formal-power-series-Commutative-Semiring +``` + +#### Associativity + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + associative-mul-formal-power-series-Commutative-Ring : + (x y z : formal-power-series-Commutative-Ring R) → + mul-formal-power-series-Commutative-Ring R + ( mul-formal-power-series-Commutative-Ring R x y) + ( z) = + mul-formal-power-series-Commutative-Ring R + ( x) + ( mul-formal-power-series-Commutative-Ring R y z) + associative-mul-formal-power-series-Commutative-Ring = + associative-mul-formal-power-series-Commutative-Semiring +``` + +#### Commutativity + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + commutative-mul-formal-power-series-Commutative-Ring : + (x y : formal-power-series-Commutative-Ring R) → + mul-formal-power-series-Commutative-Ring R x y = + mul-formal-power-series-Commutative-Ring R y x + commutative-mul-formal-power-series-Commutative-Ring = + commutative-mul-formal-power-series-Commutative-Semiring +``` + +#### Unit laws + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + left-unit-law-mul-formal-power-series-Commutative-Ring : + (x : formal-power-series-Commutative-Ring R) → + mul-formal-power-series-Commutative-Ring R + ( one-formal-power-series-Commutative-Ring R) + ( x) = + x + left-unit-law-mul-formal-power-series-Commutative-Ring = + left-unit-law-mul-formal-power-series-Commutative-Semiring + + right-unit-law-mul-formal-power-series-Commutative-Ring : + (x : formal-power-series-Commutative-Ring R) → + mul-formal-power-series-Commutative-Ring R + ( x) + ( one-formal-power-series-Commutative-Ring R) = + x + right-unit-law-mul-formal-power-series-Commutative-Ring = + right-unit-law-mul-formal-power-series-Commutative-Semiring +``` + +#### Zero laws + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + left-zero-law-mul-formal-power-series-Commutative-Ring : + (x : formal-power-series-Commutative-Ring R) → + mul-formal-power-series-Commutative-Ring R + ( zero-formal-power-series-Commutative-Ring R) + ( x) = + zero-formal-power-series-Commutative-Ring R + left-zero-law-mul-formal-power-series-Commutative-Ring = + left-zero-law-mul-formal-power-series-Commutative-Semiring + + right-zero-law-mul-formal-power-series-Commutative-Ring : + (x : formal-power-series-Commutative-Ring R) → + mul-formal-power-series-Commutative-Ring R + ( x) + ( zero-formal-power-series-Commutative-Ring R) = + zero-formal-power-series-Commutative-Ring R + right-zero-law-mul-formal-power-series-Commutative-Ring = + right-zero-law-mul-formal-power-series-Commutative-Semiring +``` + +### Distributive laws + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + left-distributive-mul-add-formal-power-series-Commutative-Ring : + (x y z : formal-power-series-Commutative-Ring R) → + mul-formal-power-series-Commutative-Ring R + ( x) + ( add-formal-power-series-Commutative-Ring R y z) = + add-formal-power-series-Commutative-Ring R + ( mul-formal-power-series-Commutative-Ring R x y) + ( mul-formal-power-series-Commutative-Ring R x z) + left-distributive-mul-add-formal-power-series-Commutative-Ring = + left-distributive-mul-add-formal-power-series-Commutative-Semiring + + right-distributive-mul-add-formal-power-series-Commutative-Ring : + (x y z : formal-power-series-Commutative-Ring R) → + mul-formal-power-series-Commutative-Ring R + ( add-formal-power-series-Commutative-Ring R x y) + ( z) = + add-formal-power-series-Commutative-Ring R + ( mul-formal-power-series-Commutative-Ring R x z) + ( mul-formal-power-series-Commutative-Ring R y z) + right-distributive-mul-add-formal-power-series-Commutative-Ring = + right-distributive-mul-add-formal-power-series-Commutative-Semiring +``` + +### The commutative ring of formal power series + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + additive-semigroup-formal-power-series-Commutative-Ring : Semigroup l + additive-semigroup-formal-power-series-Commutative-Ring = + additive-semigroup-formal-power-series-Commutative-Semiring + ( commutative-semiring-Commutative-Ring R) + + additive-group-formal-power-series-Commutative-Ring : Group l + additive-group-formal-power-series-Commutative-Ring = + ( additive-semigroup-formal-power-series-Commutative-Ring , + ( zero-formal-power-series-Commutative-Ring R , + left-unit-law-add-formal-power-series-Commutative-Ring R , + right-unit-law-add-formal-power-series-Commutative-Ring R) , + neg-formal-power-series-Commutative-Ring R , + left-inverse-law-add-formal-power-series-Commutative-Ring R , + right-inverse-law-add-formal-power-series-Commutative-Ring R) + + additive-ab-formal-power-series-Commutative-Ring : Ab l + additive-ab-formal-power-series-Commutative-Ring = + ( additive-group-formal-power-series-Commutative-Ring , + commutative-add-formal-power-series-Commutative-Ring R) + + ring-formal-power-series-Commutative-Ring : Ring l + ring-formal-power-series-Commutative-Ring = + ( additive-ab-formal-power-series-Commutative-Ring , + ( mul-formal-power-series-Commutative-Ring R , + associative-mul-formal-power-series-Commutative-Ring R) , + ( one-formal-power-series-Commutative-Ring R , + left-unit-law-mul-formal-power-series-Commutative-Ring R , + right-unit-law-mul-formal-power-series-Commutative-Ring R) , + left-distributive-mul-add-formal-power-series-Commutative-Ring R , + right-distributive-mul-add-formal-power-series-Commutative-Ring R) + + commutative-ring-formal-power-series-Commutative-Ring : Commutative-Ring l + commutative-ring-formal-power-series-Commutative-Ring = + ( ring-formal-power-series-Commutative-Ring , + commutative-mul-formal-power-series-Commutative-Ring R) +``` + +### The constant power series operation is a commutative ring homomorphism + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + preserves-mul-constant-formal-power-series-Commutative-Ring : + {x y : type-Commutative-Ring R} → + constant-formal-power-series-Commutative-Ring R + ( mul-Commutative-Ring R x y) = + mul-formal-power-series-Commutative-Ring R + ( constant-formal-power-series-Commutative-Ring R x) + ( constant-formal-power-series-Commutative-Ring R y) + preserves-mul-constant-formal-power-series-Commutative-Ring = + preserves-mul-constant-formal-power-series-Commutative-Semiring _ + + preserves-add-constant-formal-power-series-Commutative-Ring : + {x y : type-Commutative-Ring R} → + constant-formal-power-series-Commutative-Ring R + ( add-Commutative-Ring R x y) = + add-formal-power-series-Commutative-Ring R + ( constant-formal-power-series-Commutative-Ring R x) + ( constant-formal-power-series-Commutative-Ring R y) + preserves-add-constant-formal-power-series-Commutative-Ring = + preserves-add-constant-formal-power-series-Commutative-Semiring _ + + hom-constant-formal-power-series-Commutative-Ring : + hom-Commutative-Ring + ( R) + ( commutative-ring-formal-power-series-Commutative-Ring R) + hom-constant-formal-power-series-Commutative-Ring = + ( ( constant-formal-power-series-Commutative-Ring R , + preserves-add-constant-formal-power-series-Commutative-Ring) , + preserves-mul-constant-formal-power-series-Commutative-Ring , + constant-one-formal-power-series-Commutative-Ring R) +``` diff --git a/src/commutative-algebra/formal-power-series-commutative-semirings.lagda.md b/src/commutative-algebra/formal-power-series-commutative-semirings.lagda.md index 3f059ae8f2..96cd3315fe 100644 --- a/src/commutative-algebra/formal-power-series-commutative-semirings.lagda.md +++ b/src/commutative-algebra/formal-power-series-commutative-semirings.lagda.md @@ -10,18 +10,23 @@ module commutative-algebra.formal-power-series-commutative-semirings where open import commutative-algebra.commutative-semirings open import commutative-algebra.convolution-sequences-commutative-semirings open import commutative-algebra.function-commutative-semirings +open import commutative-algebra.homomorphisms-commutative-semirings open import commutative-algebra.powers-of-elements-commutative-semirings +open import commutative-algebra.sums-of-finite-families-of-elements-commutative-semirings +open import elementary-number-theory.binary-sum-decompositions-natural-numbers open import elementary-number-theory.natural-numbers open import foundation.action-on-identifications-functions open import foundation.dependent-pair-types open import foundation.equivalences +open import foundation.function-extensionality open import foundation.identity-types open import foundation.sets open import foundation.universe-levels open import group-theory.commutative-monoids +open import group-theory.homomorphisms-commutative-monoids open import group-theory.monoids open import group-theory.semigroups @@ -165,6 +170,64 @@ module _ (succ-ℕ (succ-ℕ _)) → zero-Commutative-Semiring R) ``` +### Constant formal power series + +```agda +module _ + {l : Level} (R : Commutative-Semiring l) + where + + constant-formal-power-series-Commutative-Semiring : + type-Commutative-Semiring R → formal-power-series-Commutative-Semiring R + constant-formal-power-series-Commutative-Semiring c = + formal-power-series-coefficients-Commutative-Semiring + ( λ where + zero-ℕ → c + (succ-ℕ _) → zero-Commutative-Semiring R) +``` + +### The constant zero formal power series is the constant formal power series with value zero + +```agda +module _ + {l : Level} (R : Commutative-Semiring l) + where + + abstract + constant-zero-formal-power-series-Commutative-Semiring : + constant-formal-power-series-Commutative-Semiring R + ( zero-Commutative-Semiring R) = + zero-formal-power-series-Commutative-Semiring R + constant-zero-formal-power-series-Commutative-Semiring = + ap + ( formal-power-series-coefficients-Commutative-Semiring) + ( eq-htpy + ( λ where + zero-ℕ → refl + (succ-ℕ _) → refl)) +``` + +### The constant one formal power series is the constant formal power series with value one + +```agda +module _ + {l : Level} (R : Commutative-Semiring l) + where + + abstract + constant-one-formal-power-series-Commutative-Semiring : + constant-formal-power-series-Commutative-Semiring R + ( one-Commutative-Semiring R) = + one-formal-power-series-Commutative-Semiring R + constant-one-formal-power-series-Commutative-Semiring = + ap + ( formal-power-series-coefficients-Commutative-Semiring) + ( eq-htpy + ( λ where + zero-ℕ → refl + (succ-ℕ _) → refl)) +``` + ### Addition ```agda @@ -490,3 +553,74 @@ module _ ( semiring-formal-power-series-Commutative-Semiring , commutative-mul-formal-power-series-Commutative-Semiring) ``` + +### The constant formal power series operation is a ring homomorphism + +```agda +module _ + {l : Level} (R : Commutative-Semiring l) + where + + abstract + preserves-mul-constant-formal-power-series-Commutative-Semiring : + {x y : type-Commutative-Semiring R} → + constant-formal-power-series-Commutative-Semiring R + ( mul-Commutative-Semiring R x y) = + mul-formal-power-series-Commutative-Semiring + ( constant-formal-power-series-Commutative-Semiring R x) + ( constant-formal-power-series-Commutative-Semiring R y) + preserves-mul-constant-formal-power-series-Commutative-Semiring {x} {y} = + ap + ( formal-power-series-coefficients-Commutative-Semiring) + ( inv + ( eq-htpy + ( λ where + zero-ℕ → + sum-finite-is-contr-Commutative-Semiring R + ( _) + ( is-contr-binary-sum-decomposition-zero-ℕ) + ( 0 , 0 , refl) + ( _) + (succ-ℕ n) → + htpy-sum-finite-Commutative-Semiring R + ( _) + ( λ where + (succ-ℕ m , _ , refl) → + left-zero-law-mul-Commutative-Semiring R _ + (zero-ℕ , succ-ℕ n , refl) → + right-zero-law-mul-Commutative-Semiring R _) ∙ + sum-zero-finite-Commutative-Semiring R _))) + + preserves-add-constant-formal-power-series-Commutative-Semiring : + {x y : type-Commutative-Semiring R} → + constant-formal-power-series-Commutative-Semiring R + ( add-Commutative-Semiring R x y) = + add-formal-power-series-Commutative-Semiring + ( constant-formal-power-series-Commutative-Semiring R x) + ( constant-formal-power-series-Commutative-Semiring R y) + preserves-add-constant-formal-power-series-Commutative-Semiring = + ap + ( formal-power-series-coefficients-Commutative-Semiring) + ( eq-htpy + ( λ where + zero-ℕ → refl + (succ-ℕ n) → inv (left-unit-law-add-Commutative-Semiring R _))) + + hom-additive-commutative-monoid-constant-formal-power-series-Commutative-Semiring : + hom-Commutative-Monoid + ( additive-commutative-monoid-Commutative-Semiring R) + ( additive-commutative-monoid-formal-power-series-Commutative-Semiring R) + hom-additive-commutative-monoid-constant-formal-power-series-Commutative-Semiring = + ( ( constant-formal-power-series-Commutative-Semiring R , + preserves-add-constant-formal-power-series-Commutative-Semiring) , + constant-zero-formal-power-series-Commutative-Semiring R) + + hom-constant-formal-power-series-Commutative-Semiring : + hom-Commutative-Semiring + ( R) + ( commutative-semiring-formal-power-series-Commutative-Semiring R) + hom-constant-formal-power-series-Commutative-Semiring = + ( hom-additive-commutative-monoid-constant-formal-power-series-Commutative-Semiring , + preserves-mul-constant-formal-power-series-Commutative-Semiring , + constant-one-formal-power-series-Commutative-Semiring R) +``` diff --git a/src/commutative-algebra/polynomials-commutative-rings.lagda.md b/src/commutative-algebra/polynomials-commutative-rings.lagda.md new file mode 100644 index 0000000000..4848a32e59 --- /dev/null +++ b/src/commutative-algebra/polynomials-commutative-rings.lagda.md @@ -0,0 +1,376 @@ +# Polynomials in commutative rings + +```agda +{-# OPTIONS --lossy-unification #-} + +module commutative-algebra.polynomials-commutative-rings where +``` + +
Imports + +```agda +open import commutative-algebra.commutative-rings +open import commutative-algebra.commutative-semirings +open import commutative-algebra.formal-power-series-commutative-rings +open import commutative-algebra.homomorphisms-commutative-rings +open import commutative-algebra.polynomials-commutative-semirings + +open import elementary-number-theory.natural-numbers + +open import foundation.action-on-identifications-functions +open import foundation.dependent-pair-types +open import foundation.identity-types +open import foundation.propositional-truncations +open import foundation.propositions +open import foundation.sets +open import foundation.universe-levels + +open import group-theory.abelian-groups +open import group-theory.commutative-monoids +open import group-theory.subgroups-abelian-groups + +open import lists.sequences + +open import logic.functoriality-existential-quantification + +open import ring-theory.rings +``` + +
+ +## Idea + +A +{{#concept "polynomial" WDID=Q43260 WD="polynomial" disambiguation="in a commutative ring" Agda=polynomial-Commutative-Ring}} +in a [commutative ring](commutative-algebra.commutative-rings.md) `R` is a +[polynomial](commutative-algebra.polynomials-commutative-semirings.md) in `R` +interpreted as a +[commutative semiring](commutative-algebra.commutative-semirings.md). + +## Definition + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + is-polynomial-prop-formal-power-series-Commutative-Ring : + formal-power-series-Commutative-Ring R → Prop l + is-polynomial-prop-formal-power-series-Commutative-Ring = + is-polynomial-prop-formal-power-series-Commutative-Semiring + + is-polynomial-formal-power-series-Commutative-Ring : + formal-power-series-Commutative-Ring R → UU l + is-polynomial-formal-power-series-Commutative-Ring = + is-polynomial-formal-power-series-Commutative-Semiring + + polynomial-Commutative-Ring : UU l + polynomial-Commutative-Ring = + polynomial-Commutative-Semiring (commutative-semiring-Commutative-Ring R) + + formal-power-series-polynomial-Commutative-Ring : + polynomial-Commutative-Ring → formal-power-series-Commutative-Ring R + formal-power-series-polynomial-Commutative-Ring = + formal-power-series-polynomial-Commutative-Semiring + + coefficient-polynomial-Commutative-Ring : + polynomial-Commutative-Ring → sequence (type-Commutative-Ring R) + coefficient-polynomial-Commutative-Ring = + coefficient-polynomial-Commutative-Semiring + + is-polynomial-formal-power-series-polynomial-Commutative-Ring : + (p : polynomial-Commutative-Ring) → + is-polynomial-formal-power-series-Commutative-Ring + ( formal-power-series-polynomial-Commutative-Ring p) + is-polynomial-formal-power-series-polynomial-Commutative-Ring = + is-polynomial-formal-power-series-polynomial-Commutative-Semiring +``` + +## Properties + +### The constant zero polynomial + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + zero-polynomial-Commutative-Ring : polynomial-Commutative-Ring R + zero-polynomial-Commutative-Ring = zero-polynomial-Commutative-Semiring _ +``` + +### The constant one polynomial + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + one-polynomial-Commutative-Ring : polynomial-Commutative-Ring R + one-polynomial-Commutative-Ring = one-polynomial-Commutative-Semiring _ +``` + +### The identity polynomial + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + id-polynomial-Commutative-Ring : polynomial-Commutative-Ring R + id-polynomial-Commutative-Ring = id-polynomial-Commutative-Semiring _ +``` + +### Constant polynomials + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + constant-polynomial-Commutative-Ring : + type-Commutative-Ring R → polynomial-Commutative-Ring R + constant-polynomial-Commutative-Ring = + constant-polynomial-Commutative-Semiring + ( commutative-semiring-Commutative-Ring R) +``` + +### The set of polynomials + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + set-polynomial-Commutative-Ring : Set l + set-polynomial-Commutative-Ring = + set-polynomial-Commutative-Semiring + ( commutative-semiring-Commutative-Ring R) +``` + +### Equality of polynomials + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + eq-polynomial-Commutative-Ring : + {p q : polynomial-Commutative-Ring R} → + ( formal-power-series-polynomial-Commutative-Ring R p = + formal-power-series-polynomial-Commutative-Ring R q) → + p = q + eq-polynomial-Commutative-Ring = eq-polynomial-Commutative-Semiring _ +``` + +### The constant zero polynomial is the constant polynomial with value zero + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + constant-zero-polynomial-Commutative-Ring : + constant-polynomial-Commutative-Ring R (zero-Commutative-Ring R) = + zero-polynomial-Commutative-Ring R + constant-zero-polynomial-Commutative-Ring = + constant-zero-polynomial-Commutative-Semiring _ +``` + +### The constant zero polynomial is the constant polynomial with value one + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + constant-one-polynomial-Commutative-Ring : + constant-polynomial-Commutative-Ring R (one-Commutative-Ring R) = + one-polynomial-Commutative-Ring R + constant-one-polynomial-Commutative-Ring = + constant-one-polynomial-Commutative-Semiring _ +``` + +### Evaluation of polynomials + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + ev-polynomial-Commutative-Ring : + polynomial-Commutative-Ring R → type-Commutative-Ring R → + type-Commutative-Ring R + ev-polynomial-Commutative-Ring = ev-polynomial-Commutative-Semiring +``` + +### Truncation of a formal power series into a polynomial + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + truncate-formal-power-series-Commutative-Ring : + (n : ℕ) → formal-power-series-Commutative-Ring R → + polynomial-Commutative-Ring R + truncate-formal-power-series-Commutative-Ring = + truncate-formal-power-series-Commutative-Semiring +``` + +### Addition of polynomials + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + add-polynomial-Commutative-Ring : + polynomial-Commutative-Ring R → polynomial-Commutative-Ring R → + polynomial-Commutative-Ring R + add-polynomial-Commutative-Ring = add-polynomial-Commutative-Semiring +``` + +#### The sum of two polynomials, evaluated at `x`, is equal to the sum of each polynomial evaluated at `x` + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + interchange-ev-add-polynomial-Commutative-Ring : + (p q : polynomial-Commutative-Ring R) → + (x : type-Commutative-Ring R) → + ev-polynomial-Commutative-Ring R + ( add-polynomial-Commutative-Ring R p q) + ( x) = + add-Commutative-Ring R + ( ev-polynomial-Commutative-Ring R p x) + ( ev-polynomial-Commutative-Ring R q x) + interchange-ev-add-polynomial-Commutative-Ring = + interchange-ev-add-polynomial-Commutative-Semiring +``` + +### Negation of polynomials + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + abstract + is-polynomial-neg-polynomial-Commutative-Ring : + (p : polynomial-Commutative-Ring R) → + is-polynomial-formal-power-series-Commutative-Ring R + ( neg-formal-power-series-Commutative-Ring R + ( formal-power-series-polynomial-Commutative-Ring R p)) + is-polynomial-neg-polynomial-Commutative-Ring (p , is-poly-p) = + map-tot-exists + ( λ n n≤k→pk=0 k n≤k → + ap (neg-Commutative-Ring R) (n≤k→pk=0 k n≤k) ∙ + neg-zero-Ab (ab-Commutative-Ring R)) + ( is-poly-p) + + neg-polynomial-Commutative-Ring : + polynomial-Commutative-Ring R → polynomial-Commutative-Ring R + neg-polynomial-Commutative-Ring (p , is-poly-p) = + ( neg-formal-power-series-Commutative-Ring R p , + is-polynomial-neg-polynomial-Commutative-Ring (p , is-poly-p)) +``` + +### The additive abelian group of polynomials in commutative rings + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + ab-polynomial-Commutative-Ring : Ab l + ab-polynomial-Commutative-Ring = + ab-Subgroup-Ab + ( additive-ab-formal-power-series-Commutative-Ring R) + ( is-polynomial-prop-formal-power-series-Commutative-Ring R , + is-polynomial-formal-power-series-polynomial-Commutative-Ring R + ( zero-polynomial-Commutative-Ring R) , + ( λ {p} {q} is-poly-p is-poly-q → + is-polynomial-add-polynomial-Commutative-Semiring + ( p , is-poly-p) + ( q , is-poly-q)) , + ( λ {p} is-poly-p → + is-polynomial-neg-polynomial-Commutative-Ring R (p , is-poly-p))) +``` + +### Multiplication + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + mul-polynomial-Commutative-Ring : + polynomial-Commutative-Ring R → polynomial-Commutative-Ring R → + polynomial-Commutative-Ring R + mul-polynomial-Commutative-Ring = mul-polynomial-Commutative-Semiring +``` + +### The commutative ring of polynomials + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + ring-polynomial-Commutative-Ring : Ring l + ring-polynomial-Commutative-Ring = + ( ab-polynomial-Commutative-Ring R , + pr1 + ( pr2 + ( semiring-polynomial-Commutative-Semiring + ( commutative-semiring-Commutative-Ring R)))) + + commutative-ring-polynomial-Commutative-Ring : Commutative-Ring l + commutative-ring-polynomial-Commutative-Ring = + ( ring-polynomial-Commutative-Ring , + commutative-mul-Commutative-Semiring + ( commutative-semiring-polynomial-Commutative-Semiring + ( commutative-semiring-Commutative-Ring R))) +``` + +### The constant polynomial operation is a commutative ring homomorphism + +```agda +module _ + {l : Level} (R : Commutative-Ring l) + where + + abstract + preserves-mul-constant-polynomial-Commutative-Ring : + {x y : type-Commutative-Ring R} → + constant-polynomial-Commutative-Ring R + ( mul-Commutative-Ring R x y) = + mul-polynomial-Commutative-Ring R + ( constant-polynomial-Commutative-Ring R x) + ( constant-polynomial-Commutative-Ring R y) + preserves-mul-constant-polynomial-Commutative-Ring = + preserves-mul-constant-polynomial-Commutative-Semiring _ + + preserves-add-constant-polynomial-Commutative-Ring : + {x y : type-Commutative-Ring R} → + constant-polynomial-Commutative-Ring R + ( add-Commutative-Ring R x y) = + add-polynomial-Commutative-Ring R + ( constant-polynomial-Commutative-Ring R x) + ( constant-polynomial-Commutative-Ring R y) + preserves-add-constant-polynomial-Commutative-Ring = + preserves-add-constant-polynomial-Commutative-Semiring _ + + constant-polynomial-hom-Commutative-Ring : + hom-Commutative-Ring + ( R) + ( commutative-ring-polynomial-Commutative-Ring R) + constant-polynomial-hom-Commutative-Ring = + ( ( constant-polynomial-Commutative-Ring R , + preserves-add-constant-polynomial-Commutative-Ring) , + preserves-mul-constant-polynomial-Commutative-Ring , + constant-one-polynomial-Commutative-Ring R) +``` diff --git a/src/commutative-algebra/polynomials-commutative-semirings.lagda.md b/src/commutative-algebra/polynomials-commutative-semirings.lagda.md index 4f1f8aa797..33c9a5a0a9 100644 --- a/src/commutative-algebra/polynomials-commutative-semirings.lagda.md +++ b/src/commutative-algebra/polynomials-commutative-semirings.lagda.md @@ -11,6 +11,7 @@ module commutative-algebra.polynomials-commutative-semirings where ```agda open import commutative-algebra.commutative-semirings open import commutative-algebra.formal-power-series-commutative-semirings +open import commutative-algebra.homomorphisms-commutative-semirings open import commutative-algebra.powers-of-elements-commutative-semirings open import commutative-algebra.sums-of-finite-families-of-elements-commutative-semirings open import commutative-algebra.sums-of-finite-sequences-of-elements-commutative-semirings @@ -36,11 +37,17 @@ open import foundation.propositions open import foundation.sets open import foundation.subtypes open import foundation.transport-along-identifications +open import foundation.unital-binary-operations open import foundation.universal-property-propositional-truncation-into-sets open import foundation.universe-levels +open import group-theory.commutative-monoids +open import group-theory.submonoids-commutative-monoids + open import lists.sequences +open import ring-theory.semirings + open import univalent-combinatorics.cartesian-product-types open import univalent-combinatorics.coproduct-types open import univalent-combinatorics.dependent-pair-types @@ -170,6 +177,22 @@ module _ ( λ _ → refl) ``` +### Constant polynomials + +```agda +module _ + {l : Level} (R : Commutative-Semiring l) + where + + constant-polynomial-Commutative-Semiring : + type-Commutative-Semiring R → polynomial-Commutative-Semiring R + constant-polynomial-Commutative-Semiring c = + polynomial-add-degree-formal-power-series-Commutative-Semiring + ( constant-formal-power-series-Commutative-Semiring R c) + ( 1) + ( λ _ → refl) +``` + ### The identity polynomial ```agda @@ -199,6 +222,52 @@ module _ ( is-polynomial-prop-formal-power-series-Commutative-Semiring) ``` +### Equality of polynomials + +```agda +module _ + {l : Level} (R : Commutative-Semiring l) + where + + eq-polynomial-Commutative-Semiring : + {p q : polynomial-Commutative-Semiring R} → + ( formal-power-series-polynomial-Commutative-Semiring p = + formal-power-series-polynomial-Commutative-Semiring q) → + p = q + eq-polynomial-Commutative-Semiring = + eq-type-subtype is-polynomial-prop-formal-power-series-Commutative-Semiring +``` + +### The constant zero polynomial is the constant polynomial with value zero + +```agda +module _ + {l : Level} (R : Commutative-Semiring l) + where + + constant-zero-polynomial-Commutative-Semiring : + constant-polynomial-Commutative-Semiring R (zero-Commutative-Semiring R) = + zero-polynomial-Commutative-Semiring R + constant-zero-polynomial-Commutative-Semiring = + eq-polynomial-Commutative-Semiring R + ( constant-zero-formal-power-series-Commutative-Semiring R) +``` + +### The constant one polynomial is the constant polynomial with value one + +```agda +module _ + {l : Level} (R : Commutative-Semiring l) + where + + constant-one-polynomial-Commutative-Semiring : + constant-polynomial-Commutative-Semiring R (one-Commutative-Semiring R) = + one-polynomial-Commutative-Semiring R + constant-one-polynomial-Commutative-Semiring = + eq-polynomial-Commutative-Semiring R + ( constant-one-formal-power-series-Commutative-Semiring R) +``` + ### Evaluation of polynomials ```agda @@ -569,6 +638,27 @@ module _ ( Hq'))) ``` +#### The commutative monoid of addition of polynomials + +```agda +module _ + {l : Level} (R : Commutative-Semiring l) + where + + additive-commutative-monoid-polynomial-Commutative-Semiring : + Commutative-Monoid l + additive-commutative-monoid-polynomial-Commutative-Semiring = + commutative-monoid-Commutative-Submonoid + ( additive-commutative-monoid-formal-power-series-Commutative-Semiring R) + ( is-polynomial-prop-formal-power-series-Commutative-Semiring , + is-polynomial-formal-power-series-polynomial-Commutative-Semiring + ( zero-polynomial-Commutative-Semiring R) , + ( λ p q is-poly-p is-poly-q → + is-polynomial-add-polynomial-Commutative-Semiring + ( p , is-poly-p) + ( q , is-poly-q))) +``` + ### Multiplication of polynomials ```agda @@ -658,3 +748,156 @@ module _ ( mul-formal-power-series-Commutative-Semiring p q , is-polynomial-mul-polynomial-Commutative-Semiring pp qq) ``` + +#### Commutative monoid laws of multiplication of polynomials + +```agda +module _ + {l : Level} (R : Commutative-Semiring l) + where + + multiplicative-commutative-monoid-polynomial-Commutative-Semiring : + Commutative-Monoid l + multiplicative-commutative-monoid-polynomial-Commutative-Semiring = + commutative-monoid-Commutative-Submonoid + ( multiplicative-commutative-monoid-Commutative-Semiring + ( commutative-semiring-formal-power-series-Commutative-Semiring R)) + ( is-polynomial-prop-formal-power-series-Commutative-Semiring , + is-polynomial-formal-power-series-polynomial-Commutative-Semiring + ( one-polynomial-Commutative-Semiring R) , + ( λ p q is-poly-p is-poly-q → + is-polynomial-mul-polynomial-Commutative-Semiring + ( p , is-poly-p) + ( q , is-poly-q))) +``` + +### The commutative semiring of multiplication of polynomials + +```agda +module _ + {l : Level} {R : Commutative-Semiring l} + where + + abstract + left-distributive-mul-add-polynomial-Commutative-Semiring : + (x y z : polynomial-Commutative-Semiring R) → + mul-polynomial-Commutative-Semiring x + ( add-polynomial-Commutative-Semiring y z) = + add-polynomial-Commutative-Semiring + ( mul-polynomial-Commutative-Semiring x y) + ( mul-polynomial-Commutative-Semiring x z) + left-distributive-mul-add-polynomial-Commutative-Semiring + (x , _) (y , _) (z , _) = + eq-polynomial-Commutative-Semiring R + ( left-distributive-mul-add-formal-power-series-Commutative-Semiring + ( x) + ( y) + ( z)) + + right-distributive-mul-add-polynomial-Commutative-Semiring : + (x y z : polynomial-Commutative-Semiring R) → + mul-polynomial-Commutative-Semiring + ( add-polynomial-Commutative-Semiring x y) + ( z) = + add-polynomial-Commutative-Semiring + ( mul-polynomial-Commutative-Semiring x z) + ( mul-polynomial-Commutative-Semiring y z) + right-distributive-mul-add-polynomial-Commutative-Semiring + (x , _) (y , _) (z , _) = + eq-polynomial-Commutative-Semiring R + ( right-distributive-mul-add-formal-power-series-Commutative-Semiring + ( x) + ( y) + ( z)) + + left-zero-law-mul-polynomial-Commutative-Semiring : + (x : polynomial-Commutative-Semiring R) → + mul-polynomial-Commutative-Semiring + ( zero-polynomial-Commutative-Semiring R) + ( x) = + zero-polynomial-Commutative-Semiring R + left-zero-law-mul-polynomial-Commutative-Semiring (x , _) = + eq-polynomial-Commutative-Semiring R + ( left-zero-law-mul-formal-power-series-Commutative-Semiring x) + + right-zero-law-mul-polynomial-Commutative-Semiring : + (x : polynomial-Commutative-Semiring R) → + mul-polynomial-Commutative-Semiring + ( x) + ( zero-polynomial-Commutative-Semiring R) = + zero-polynomial-Commutative-Semiring R + right-zero-law-mul-polynomial-Commutative-Semiring (x , _) = + eq-polynomial-Commutative-Semiring R + ( right-zero-law-mul-formal-power-series-Commutative-Semiring x) + +module _ + {l : Level} (R : Commutative-Semiring l) + where + + has-unit-mul-polynomial-Commutative-Semiring : + is-unital (mul-polynomial-Commutative-Semiring {R = R}) + has-unit-mul-polynomial-Commutative-Semiring = + has-unit-Commutative-Monoid + ( multiplicative-commutative-monoid-polynomial-Commutative-Semiring R) + + semiring-polynomial-Commutative-Semiring : Semiring l + semiring-polynomial-Commutative-Semiring = + ( additive-commutative-monoid-polynomial-Commutative-Semiring R , + ( ( mul-polynomial-Commutative-Semiring , + associative-mul-Commutative-Monoid + ( multiplicative-commutative-monoid-polynomial-Commutative-Semiring + ( R))) , + has-unit-mul-polynomial-Commutative-Semiring , + left-distributive-mul-add-polynomial-Commutative-Semiring , + right-distributive-mul-add-polynomial-Commutative-Semiring) , + left-zero-law-mul-polynomial-Commutative-Semiring , + right-zero-law-mul-polynomial-Commutative-Semiring) + + commutative-semiring-polynomial-Commutative-Semiring : Commutative-Semiring l + commutative-semiring-polynomial-Commutative-Semiring = + ( semiring-polynomial-Commutative-Semiring , + commutative-mul-Commutative-Monoid + ( multiplicative-commutative-monoid-polynomial-Commutative-Semiring R)) +``` + +### The constant polynomial operation is a commutative semiring homomorphism + +```agda +module _ + {l : Level} (R : Commutative-Semiring l) + where + + abstract + preserves-mul-constant-polynomial-Commutative-Semiring : + {x y : type-Commutative-Semiring R} → + constant-polynomial-Commutative-Semiring R + ( mul-Commutative-Semiring R x y) = + mul-polynomial-Commutative-Semiring + ( constant-polynomial-Commutative-Semiring R x) + ( constant-polynomial-Commutative-Semiring R y) + preserves-mul-constant-polynomial-Commutative-Semiring = + eq-polynomial-Commutative-Semiring R + ( preserves-mul-constant-formal-power-series-Commutative-Semiring R) + + preserves-add-constant-polynomial-Commutative-Semiring : + {x y : type-Commutative-Semiring R} → + constant-polynomial-Commutative-Semiring R + ( add-Commutative-Semiring R x y) = + add-polynomial-Commutative-Semiring + ( constant-polynomial-Commutative-Semiring R x) + ( constant-polynomial-Commutative-Semiring R y) + preserves-add-constant-polynomial-Commutative-Semiring = + eq-polynomial-Commutative-Semiring R + ( preserves-add-constant-formal-power-series-Commutative-Semiring R) + + constant-polynomial-hom-Commutative-Semiring : + hom-Commutative-Semiring + ( R) + ( commutative-semiring-polynomial-Commutative-Semiring R) + constant-polynomial-hom-Commutative-Semiring = + ( ( ( constant-polynomial-Commutative-Semiring R , + preserves-add-constant-polynomial-Commutative-Semiring) , + constant-zero-polynomial-Commutative-Semiring R) , + preserves-mul-constant-polynomial-Commutative-Semiring , + constant-one-polynomial-Commutative-Semiring R) +``` diff --git a/src/commutative-algebra/sums-of-finite-families-of-elements-commutative-semirings.lagda.md b/src/commutative-algebra/sums-of-finite-families-of-elements-commutative-semirings.lagda.md index e85e11b6f5..9ad2e2211a 100644 --- a/src/commutative-algebra/sums-of-finite-families-of-elements-commutative-semirings.lagda.md +++ b/src/commutative-algebra/sums-of-finite-families-of-elements-commutative-semirings.lagda.md @@ -16,6 +16,7 @@ open import elementary-number-theory.natural-numbers open import finite-group-theory.permutations-standard-finite-types open import foundation.automorphisms +open import foundation.contractible-types open import foundation.coproduct-types open import foundation.empty-types open import foundation.equivalences @@ -80,6 +81,27 @@ module _ sum-unit-finite-Semiring (semiring-Commutative-Semiring A) ``` +### Sums over contractible types + +```agda +module _ + {l1 l2 : Level} (A : Commutative-Semiring l1) (I : Finite-Type l2) + (is-contr-I : is-contr (type-Finite-Type I)) + (i : type-Finite-Type I) + where + + abstract + sum-finite-is-contr-Commutative-Semiring : + (f : type-Finite-Type I → type-Commutative-Semiring A) → + sum-finite-Commutative-Semiring A I f = f i + sum-finite-is-contr-Commutative-Semiring = + sum-finite-is-contr-Semiring + ( semiring-Commutative-Semiring A) + ( I) + ( is-contr-I) + ( i) +``` + ### Sums are homotopy invariant ```agda diff --git a/src/elementary-number-theory/binary-sum-decompositions-natural-numbers.lagda.md b/src/elementary-number-theory/binary-sum-decompositions-natural-numbers.lagda.md index 07a48dd75f..27d67462ef 100644 --- a/src/elementary-number-theory/binary-sum-decompositions-natural-numbers.lagda.md +++ b/src/elementary-number-theory/binary-sum-decompositions-natural-numbers.lagda.md @@ -317,3 +317,15 @@ module _ ( is-section-map-inv-equiv-permute-components-triple-with-sum-pr2) ( is-retraction-map-inv-equiv-permute-components-triple-with-sum-pr2) ``` + +### There is a unique binary sum decomposition of 0 + +```agda +is-contr-binary-sum-decomposition-zero-ℕ : + is-contr (binary-sum-decomposition-ℕ zero-ℕ) +is-contr-binary-sum-decomposition-zero-ℕ = + ( (zero-ℕ , zero-ℕ , refl) , + λ (i , j , j+i=0) → + eq-Eq-binary-sum-decomposition-ℕ zero-ℕ _ _ + ( inv (is-zero-right-is-zero-add-ℕ j i j+i=0))) +``` diff --git a/src/group-theory/abelian-groups.lagda.md b/src/group-theory/abelian-groups.lagda.md index 43e415465c..c39cd48dee 100644 --- a/src/group-theory/abelian-groups.lagda.md +++ b/src/group-theory/abelian-groups.lagda.md @@ -540,6 +540,18 @@ module _ is-unit-right-div-eq-Group (group-Ab A) ``` +### If `x + y = 0`, then `y = -x` + +```agda +module _ + {l : Level} (A : Ab l) + where + + unique-right-inv-Ab : + {x y : type-Ab A} → is-zero-Ab A (add-Ab A x y) → y = neg-Ab A x + unique-right-inv-Ab {x} {y} = unique-right-inv-Group (group-Ab A) x y +``` + ### The negative of `-x + y` is `-y + x` ```agda diff --git a/src/group-theory/sums-of-finite-families-of-elements-abelian-groups.lagda.md b/src/group-theory/sums-of-finite-families-of-elements-abelian-groups.lagda.md index d6e82b4ed1..c5db30c52b 100644 --- a/src/group-theory/sums-of-finite-families-of-elements-abelian-groups.lagda.md +++ b/src/group-theory/sums-of-finite-families-of-elements-abelian-groups.lagda.md @@ -206,3 +206,27 @@ module _ interchange-sum-add-finite-Ab = interchange-sum-mul-finite-Commutative-Monoid (commutative-monoid-Ab G) A ``` + +### Interchange law of sums and negation + +```agda +module _ + {l1 l2 : Level} (G : Ab l1) (A : Finite-Type l2) + where + + abstract + interchange-sum-neg-finite-Ab : + (f : type-Finite-Type A → type-Ab G) → + sum-finite-Ab G A (λ a → neg-Ab G (f a)) = neg-Ab G (sum-finite-Ab G A f) + interchange-sum-neg-finite-Ab f = + unique-right-inv-Ab G + ( equational-reasoning + add-Ab G + ( sum-finite-Ab G A f) + ( sum-finite-Ab G A (λ a → neg-Ab G (f a))) + = sum-finite-Ab G A (λ a → add-Ab G (f a) (neg-Ab G (f a))) + by inv (interchange-sum-add-finite-Ab G A _ _) + = sum-finite-Ab G A (λ _ → zero-Ab G) + by htpy-sum-finite-Ab G A (λ a → right-inverse-law-add-Ab G _) + = zero-Ab G by sum-zero-finite-Ab G A) +``` diff --git a/src/group-theory/sums-of-finite-families-of-elements-commutative-monoids.lagda.md b/src/group-theory/sums-of-finite-families-of-elements-commutative-monoids.lagda.md index b9aec167a2..bde90675d8 100644 --- a/src/group-theory/sums-of-finite-families-of-elements-commutative-monoids.lagda.md +++ b/src/group-theory/sums-of-finite-families-of-elements-commutative-monoids.lagda.md @@ -13,6 +13,7 @@ open import elementary-number-theory.addition-natural-numbers open import elementary-number-theory.natural-numbers open import foundation.action-on-identifications-functions +open import foundation.contractible-types open import foundation.coproduct-types open import foundation.dependent-pair-types open import foundation.empty-types @@ -706,7 +707,30 @@ module _ = f star by compute-sum-one-element-Commutative-Monoid M _ ``` -### Interchange law of sums and addition +#### Sums over contractible types + +```agda +module _ + {l1 l2 : Level} (M : Commutative-Monoid l1) (I : Finite-Type l2) + (is-contr-I : is-contr (type-Finite-Type I)) + (i : type-Finite-Type I) + where + + abstract + sum-finite-is-contr-Commutative-Monoid : + (f : type-Finite-Type I → type-Commutative-Monoid M) → + sum-finite-Commutative-Monoid M I f = f i + sum-finite-is-contr-Commutative-Monoid f = + sum-equiv-finite-Commutative-Monoid M + ( I) + ( unit-Finite-Type) + ( equiv-unit-is-contr is-contr-I) + ( f) ∙ + sum-finite-unit-type-Commutative-Monoid M _ ∙ + ap f (eq-is-contr is-contr-I) +``` + +#### Interchange law of sums and addition ```agda module _ diff --git a/src/ring-theory/sums-of-finite-families-of-elements-semirings.lagda.md b/src/ring-theory/sums-of-finite-families-of-elements-semirings.lagda.md index 7c67519855..484bf0534e 100644 --- a/src/ring-theory/sums-of-finite-families-of-elements-semirings.lagda.md +++ b/src/ring-theory/sums-of-finite-families-of-elements-semirings.lagda.md @@ -8,6 +8,7 @@ module ring-theory.sums-of-finite-families-of-elements-semirings where ```agda open import foundation.action-on-identifications-functions +open import foundation.contractible-types open import foundation.coproduct-types open import foundation.empty-types open import foundation.equivalences @@ -75,6 +76,27 @@ module _ ( additive-commutative-monoid-Semiring R) ``` +### Sums over contractible types + +```agda +module _ + {l1 l2 : Level} (R : Semiring l1) (I : Finite-Type l2) + (is-contr-I : is-contr (type-Finite-Type I)) + (i : type-Finite-Type I) + where + + abstract + sum-finite-is-contr-Semiring : + (f : type-Finite-Type I → type-Semiring R) → + sum-finite-Semiring R I f = f i + sum-finite-is-contr-Semiring = + sum-finite-is-contr-Commutative-Monoid + ( additive-commutative-monoid-Semiring R) + ( I) + ( is-contr-I) + ( i) +``` + ### Sums are homotopy invariant ```agda From a5e5093e06a7271f1fac6f81c69a8303835a4d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Fri, 12 Sep 2025 14:37:17 +0200 Subject: [PATCH 61/97] Add linear combinations, linear spans and tuple concatenation (#1537) This PR adds linear combinations, linear spans and tuple concatenation. It contains a proof that a linear span has the structure of a left submodule. --- src/linear-algebra.lagda.md | 2 + ...les-of-vectors-left-modules-rings.lagda.md | 293 +++++++++++++++++ .../linear-spans-left-modules-rings.lagda.md | 306 ++++++++++++++++++ .../subsets-left-modules-rings.lagda.md | 8 + src/lists.lagda.md | 1 + src/lists/concatenation-tuples.lagda.md | 55 ++++ 6 files changed, 665 insertions(+) create mode 100644 src/linear-algebra/linear-combinations-tuples-of-vectors-left-modules-rings.lagda.md create mode 100644 src/linear-algebra/linear-spans-left-modules-rings.lagda.md create mode 100644 src/lists/concatenation-tuples.lagda.md diff --git a/src/linear-algebra.lagda.md b/src/linear-algebra.lagda.md index 512785e345..ba50e0c42c 100644 --- a/src/linear-algebra.lagda.md +++ b/src/linear-algebra.lagda.md @@ -25,7 +25,9 @@ open import linear-algebra.functoriality-matrices public open import linear-algebra.left-modules-commutative-rings public open import linear-algebra.left-modules-rings public open import linear-algebra.left-submodules-rings public +open import linear-algebra.linear-combinations-tuples-of-vectors-left-modules-rings public open import linear-algebra.linear-maps-left-modules-rings public +open import linear-algebra.linear-spans-left-modules-rings public open import linear-algebra.matrices public open import linear-algebra.matrices-on-rings public open import linear-algebra.multiplication-matrices public diff --git a/src/linear-algebra/linear-combinations-tuples-of-vectors-left-modules-rings.lagda.md b/src/linear-algebra/linear-combinations-tuples-of-vectors-left-modules-rings.lagda.md new file mode 100644 index 0000000000..acaedba8a7 --- /dev/null +++ b/src/linear-algebra/linear-combinations-tuples-of-vectors-left-modules-rings.lagda.md @@ -0,0 +1,293 @@ +# Linear combinations of tuples of vectors in left modules over rings + +```agda +module linear-algebra.linear-combinations-tuples-of-vectors-left-modules-rings where +``` + +
Imports + +```agda +open import elementary-number-theory.natural-numbers + +open import foundation.action-on-identifications-functions +open import foundation.identity-types +open import foundation.universe-levels + +open import linear-algebra.left-modules-rings + +open import lists.concatenation-tuples +open import lists.functoriality-tuples +open import lists.tuples + +open import ring-theory.rings +``` + +
+ +## Idea + +Let `M` be a [left module](linear-algebra.left-modules-rings.md) over a +[ring](ring-theory.rings.md) `R`. For any `n`-tuple of vectors (elements of `M`) +`(x_1, ..., x_n)` and any `n`-tuple of coefficients (elements of `R`) +`(r_1, ..., r_n)`, we may form the +{{#concept "linear combination" Agda=linear-combination-left-module-Ring}} +`r_1 * x_1 + ... + r_n * x_n`. + +The proposition of _being_ a linear combination is formalized as being an +element of a [linear span](linear-algebra.linear-spans-left-modules-rings.md). + +## Definitions + +### Linear combinations of tuples of vectors in a left module over a ring + +```agda +module _ + {l1 l2 : Level} + (R : Ring l1) + (M : left-module-Ring l2 R) + where + + linear-combination-tuple-left-module-Ring : + {n : ℕ} → + tuple (type-Ring R) n → + tuple (type-left-module-Ring R M) n → + type-left-module-Ring R M + linear-combination-tuple-left-module-Ring empty-tuple empty-tuple = + zero-left-module-Ring R M + linear-combination-tuple-left-module-Ring (r ∷ scalars) (x ∷ vectors) = + add-left-module-Ring R M + ( linear-combination-tuple-left-module-Ring scalars vectors) + ( mul-left-module-Ring R M r x) +``` + +## Properties + +### Left distributivity law for multiplication + +```agda +module _ + {l1 l2 : Level} + (R : Ring l1) + (M : left-module-Ring l2 R) + where + + left-distributive-mul-linear-combination-tuple-left-module-Ring : + {n : ℕ} + (r : type-Ring R) → + (scalars : tuple (type-Ring R) n) → + (vectors : tuple (type-left-module-Ring R M) n) → + mul-left-module-Ring R M + ( r) + ( linear-combination-tuple-left-module-Ring R M scalars vectors) = + linear-combination-tuple-left-module-Ring R M + ( map-tuple (mul-Ring R r) scalars) + ( vectors) + left-distributive-mul-linear-combination-tuple-left-module-Ring + r empty-tuple empty-tuple = + equational-reasoning + mul-left-module-Ring R M r + ( linear-combination-tuple-left-module-Ring R M empty-tuple empty-tuple) + = mul-left-module-Ring R M r (zero-left-module-Ring R M) + by refl + = zero-left-module-Ring R M + by right-zero-law-mul-left-module-Ring R M r + = linear-combination-tuple-left-module-Ring R M empty-tuple empty-tuple + by refl + left-distributive-mul-linear-combination-tuple-left-module-Ring + r (s ∷ scalars) (x ∷ vectors) = + equational-reasoning + mul-left-module-Ring R M r + ( linear-combination-tuple-left-module-Ring R M + ( s ∷ scalars) + ( x ∷ vectors)) + = mul-left-module-Ring R M r + ( add-left-module-Ring R M + ( linear-combination-tuple-left-module-Ring R M scalars vectors) + ( mul-left-module-Ring R M s x)) + by refl + = add-left-module-Ring R M + ( mul-left-module-Ring R M r + ( linear-combination-tuple-left-module-Ring R M scalars vectors)) + ( mul-left-module-Ring R M r (mul-left-module-Ring R M s x)) + by + left-distributive-mul-add-left-module-Ring R M r + ( linear-combination-tuple-left-module-Ring R M scalars vectors) + ( mul-left-module-Ring R M s x) + = add-left-module-Ring R M + ( mul-left-module-Ring R M r + ( linear-combination-tuple-left-module-Ring R M scalars vectors)) + ( mul-left-module-Ring R M (mul-Ring R r s) x) + by + ap + ( λ y → + add-left-module-Ring R M + ( mul-left-module-Ring R M r + ( linear-combination-tuple-left-module-Ring R M + ( scalars) + ( vectors))) + ( y)) + ( inv (associative-mul-left-module-Ring R M r s x)) + = add-left-module-Ring R M + ( linear-combination-tuple-left-module-Ring R M + ( map-tuple (mul-Ring R r) scalars) + ( vectors)) + ( mul-left-module-Ring R M (mul-Ring R r s) x) + by + ap + ( λ y → + add-left-module-Ring R M + ( y) + ( mul-left-module-Ring R M (mul-Ring R r s) x)) + ( left-distributive-mul-linear-combination-tuple-left-module-Ring r + ( scalars) + ( vectors)) + = linear-combination-tuple-left-module-Ring R M + ( map-tuple (mul-Ring R r) (s ∷ scalars)) + ( x ∷ vectors) + by refl +``` + +### Concatenation is addition + +```agda +module _ + {l1 l2 : Level} + (R : Ring l1) + (M : left-module-Ring l2 R) + where + + add-concat-linear-combination-tuple-left-module-Ring : + {n m : ℕ} → + (scalars-a : tuple (type-Ring R) n) → + (vectors-a : tuple (type-left-module-Ring R M) n) → + (scalars-b : tuple (type-Ring R) m) → + (vectors-b : tuple (type-left-module-Ring R M) m) → + linear-combination-tuple-left-module-Ring R M + ( concat-tuple scalars-a scalars-b) + ( concat-tuple vectors-a vectors-b) = + add-left-module-Ring R M + ( linear-combination-tuple-left-module-Ring R M scalars-a vectors-a) + ( linear-combination-tuple-left-module-Ring R M scalars-b vectors-b) + add-concat-linear-combination-tuple-left-module-Ring + empty-tuple empty-tuple scalars-b vectors-b = + equational-reasoning + linear-combination-tuple-left-module-Ring R M + ( concat-tuple empty-tuple scalars-b) + ( concat-tuple empty-tuple vectors-b) + = linear-combination-tuple-left-module-Ring R M scalars-b vectors-b + by refl + = add-left-module-Ring R M + ( zero-left-module-Ring R M) + ( linear-combination-tuple-left-module-Ring R M scalars-b vectors-b) + by + inv + ( left-unit-law-add-left-module-Ring R M + ( linear-combination-tuple-left-module-Ring R M + ( scalars-b) + ( vectors-b))) + = add-left-module-Ring R M + ( linear-combination-tuple-left-module-Ring R M + ( empty-tuple) + ( empty-tuple)) + ( linear-combination-tuple-left-module-Ring R M scalars-b vectors-b) + by refl + add-concat-linear-combination-tuple-left-module-Ring + (r ∷ scalars-a) (x ∷ vectors-a) scalars-b vectors-b = + equational-reasoning + linear-combination-tuple-left-module-Ring R M + ( concat-tuple (r ∷ scalars-a) scalars-b) + ( concat-tuple (x ∷ vectors-a) vectors-b) + = linear-combination-tuple-left-module-Ring R M + ( r ∷ (concat-tuple scalars-a scalars-b)) + ( x ∷ (concat-tuple vectors-a vectors-b)) + by refl + = add-left-module-Ring R M + ( linear-combination-tuple-left-module-Ring R M + ( concat-tuple scalars-a scalars-b) + ( concat-tuple vectors-a vectors-b)) + ( mul-left-module-Ring R M r x) + by refl + = add-left-module-Ring R M + ( add-left-module-Ring R M + ( linear-combination-tuple-left-module-Ring R M + ( scalars-a) + ( vectors-a)) + ( linear-combination-tuple-left-module-Ring R M + ( scalars-b) + ( vectors-b))) + ( mul-left-module-Ring R M r x) + by + ap + ( λ z → add-left-module-Ring R M z (mul-left-module-Ring R M r x)) + ( add-concat-linear-combination-tuple-left-module-Ring + ( scalars-a) + ( vectors-a) + ( scalars-b) + ( vectors-b)) + = add-left-module-Ring R M + ( mul-left-module-Ring R M r x) + ( add-left-module-Ring R M + ( linear-combination-tuple-left-module-Ring R M + ( scalars-a) + ( vectors-a)) + ( linear-combination-tuple-left-module-Ring R M + ( scalars-b) + ( vectors-b))) + by + commutative-add-left-module-Ring R M + ( add-left-module-Ring R M + ( linear-combination-tuple-left-module-Ring R M + ( scalars-a) + ( vectors-a)) + ( linear-combination-tuple-left-module-Ring R M + ( scalars-b) + ( vectors-b))) + ( mul-left-module-Ring R M r x) + = add-left-module-Ring R M + ( add-left-module-Ring R M + ( mul-left-module-Ring R M r x) + ( linear-combination-tuple-left-module-Ring R M + ( scalars-a) + ( vectors-a))) + ( linear-combination-tuple-left-module-Ring R M + ( scalars-b) + ( vectors-b)) + by + inv + ( associative-add-left-module-Ring R M + ( mul-left-module-Ring R M r x) + ( linear-combination-tuple-left-module-Ring R M + ( scalars-a) + ( vectors-a)) + ( linear-combination-tuple-left-module-Ring R M + ( scalars-b) + ( vectors-b))) + = add-left-module-Ring R M + ( add-left-module-Ring R M + ( linear-combination-tuple-left-module-Ring R M + ( scalars-a) + ( vectors-a)) + ( mul-left-module-Ring R M r x)) + ( linear-combination-tuple-left-module-Ring R M + ( scalars-b) + ( vectors-b)) + by + ap + ( λ y → add-left-module-Ring R M y + ( linear-combination-tuple-left-module-Ring R M + ( scalars-b) + ( vectors-b))) + ( commutative-add-left-module-Ring R M + ( mul-left-module-Ring R M r x) + ( linear-combination-tuple-left-module-Ring R M + ( scalars-a) + ( vectors-a))) + = add-left-module-Ring R M + ( linear-combination-tuple-left-module-Ring R M + ( r ∷ scalars-a) + ( x ∷ vectors-a)) + ( linear-combination-tuple-left-module-Ring R M + ( scalars-b) + ( vectors-b)) + by refl +``` diff --git a/src/linear-algebra/linear-spans-left-modules-rings.lagda.md b/src/linear-algebra/linear-spans-left-modules-rings.lagda.md new file mode 100644 index 0000000000..e143ee3d39 --- /dev/null +++ b/src/linear-algebra/linear-spans-left-modules-rings.lagda.md @@ -0,0 +1,306 @@ +# Linear spans in left modules over rings + +```agda +module linear-algebra.linear-spans-left-modules-rings where +``` + +
Imports + +```agda +open import elementary-number-theory.addition-natural-numbers +open import elementary-number-theory.natural-numbers + +open import foundation.action-on-identifications-functions +open import foundation.dependent-pair-types +open import foundation.existential-quantification +open import foundation.identity-types +open import foundation.propositional-truncations +open import foundation.propositions +open import foundation.transport-along-identifications +open import foundation.universe-levels + +open import foundation-core.cartesian-product-types + +open import linear-algebra.left-modules-rings +open import linear-algebra.left-submodules-rings +open import linear-algebra.linear-combinations-tuples-of-vectors-left-modules-rings +open import linear-algebra.subsets-left-modules-rings + +open import lists.concatenation-tuples +open import lists.functoriality-tuples +open import lists.tuples + +open import ring-theory.rings +``` + +
+ +## Idea + +Let `M` be a [left module](linear-algebra.left-modules-rings.md) over a +[ring](ring-theory.rings.md) `R` and `G` be a subset of `M`. The +{{#concept "linear span" Agda=is-linear-span-subset-left-module-prop-Ring Agda=linear-span-left-module-Ring}} +of `G` is the subset of `M` which contains all +[linear combinations](linear-algebra.linear-combinations-tuples-of-vectors-left-modules-rings.md) +of the elements of `G`. + +## Definitions + +### The condition of being a linear span + +```agda +module _ + {l1 l2 l3 : Level} + (R : Ring l1) + (M : left-module-Ring l2 R) + (S : subset-left-module-Ring l3 R M) + (G : subset-left-module-Ring l3 R M) + where + + contains-all-linear-combinations-subset-left-module-prop-Ring : + Prop (l1 ⊔ l2 ⊔ l3) + contains-all-linear-combinations-subset-left-module-prop-Ring = + Π-Prop + ( ℕ) + ( λ n → + Π-Prop + ( tuple (type-Ring R) n) + ( λ scalars → + Π-Prop + ( tuple (type-subset-left-module-Ring R M G) n) + ( λ vectors → + S ( linear-combination-tuple-left-module-Ring R M + ( scalars) + ( map-tuple pr1 vectors))))) + + contains-all-linear-combinations-subset-left-module-Ring : + UU (l1 ⊔ l2 ⊔ l3) + contains-all-linear-combinations-subset-left-module-Ring = + type-Prop + contains-all-linear-combinations-subset-left-module-prop-Ring + + contains-only-linear-combinations-subset-left-module-prop-Ring : + Prop (l1 ⊔ l2 ⊔ l3) + contains-only-linear-combinations-subset-left-module-prop-Ring = + Π-Prop + ( type-subset-left-module-Ring R M S) + ( λ x → + exists-structure-Prop ℕ + ( λ n → + Σ ( tuple (type-Ring R) n) + ( λ scalars → + Σ ( tuple (type-subset-left-module-Ring R M G) n) + ( λ vectors → + pr1 x = linear-combination-tuple-left-module-Ring R M + ( scalars) + ( map-tuple pr1 vectors))))) + + contains-only-linear-combinations-subset-left-module-Ring : + UU (l1 ⊔ l2 ⊔ l3) + contains-only-linear-combinations-subset-left-module-Ring = + type-Prop + contains-only-linear-combinations-subset-left-module-prop-Ring + + is-linear-span-subset-left-module-prop-Ring : Prop (l1 ⊔ l2 ⊔ l3) + is-linear-span-subset-left-module-prop-Ring = + product-Prop + contains-all-linear-combinations-subset-left-module-prop-Ring + contains-only-linear-combinations-subset-left-module-prop-Ring + + is-linear-span-subset-left-module-Ring : UU (l1 ⊔ l2 ⊔ l3) + is-linear-span-subset-left-module-Ring = + type-Prop is-linear-span-subset-left-module-prop-Ring +``` + +### The type of linear spans + +```agda +linear-span-left-module-Ring : + {l1 l2 : Level} + (l : Level) + (R : Ring l1) + (M : left-module-Ring l2 R) → + UU (l1 ⊔ l2 ⊔ lsuc l) +linear-span-left-module-Ring l R M = + Σ ( (subset-left-module-Ring l R M) × (subset-left-module-Ring l R M)) + ( λ (S , G) → is-linear-span-subset-left-module-Ring R M S G) + +module _ + {l1 l2 l3 : Level} + (R : Ring l1) + (M : left-module-Ring l2 R) + (S : linear-span-left-module-Ring l3 R M) + where + + subset-linear-span-left-module-Ring : subset-left-module-Ring l3 R M + subset-linear-span-left-module-Ring = pr1 (pr1 S) + + generators-linear-span-left-module-Ring : subset-left-module-Ring l3 R M + generators-linear-span-left-module-Ring = pr2 (pr1 S) + + contains-all-linear-combinations-linear-span-left-module-Ring : + contains-all-linear-combinations-subset-left-module-Ring R M + subset-linear-span-left-module-Ring + generators-linear-span-left-module-Ring + contains-all-linear-combinations-linear-span-left-module-Ring = + pr1 (pr2 S) + + contains-only-linear-combinations-linear-span-left-module-Ring : + contains-only-linear-combinations-subset-left-module-Ring R M + subset-linear-span-left-module-Ring + generators-linear-span-left-module-Ring + contains-only-linear-combinations-linear-span-left-module-Ring = + pr2 (pr2 S) +``` + +## Properties + +### Linear span has the structure of a submodule + +```agda +module _ + {l1 l2 l3 : Level} + (R : Ring l1) + (M : left-module-Ring l2 R) + (S : linear-span-left-module-Ring l3 R M) + where + + contains-zero-linear-span-left-module-Ring : + contains-zero-subset-left-module-Ring R M + ( subset-linear-span-left-module-Ring R M S) + contains-zero-linear-span-left-module-Ring = + contains-all-linear-combinations-linear-span-left-module-Ring R M S + ( zero-ℕ) + ( empty-tuple) + ( empty-tuple) + + is-closed-under-addition-linear-span-left-module-Ring : + is-closed-under-addition-subset-left-module-Ring R M + ( subset-linear-span-left-module-Ring R M S) + is-closed-under-addition-linear-span-left-module-Ring + x y x-in-span y-in-span = + let + open + do-syntax-trunc-Prop + ( subset-linear-span-left-module-Ring R M S + ( add-left-module-Ring R M x y)) + in + do + ( x-n , x-scalars , x-vectors , x-identity) ← + contains-only-linear-combinations-linear-span-left-module-Ring R M S + ( x , x-in-span) + ( y-n , y-scalars , y-vectors , y-identity) ← + contains-only-linear-combinations-linear-span-left-module-Ring R M S + ( y , y-in-span) + tr + ( λ z → pr1 (subset-linear-span-left-module-Ring R M S z)) + ( equational-reasoning + linear-combination-tuple-left-module-Ring R M + ( concat-tuple x-scalars y-scalars) + ( map-tuple pr1 (concat-tuple x-vectors y-vectors)) + = linear-combination-tuple-left-module-Ring R M + ( concat-tuple x-scalars y-scalars) + ( concat-tuple + ( map-tuple pr1 x-vectors) + ( map-tuple pr1 y-vectors)) + by + ap + ( λ z → + ( linear-combination-tuple-left-module-Ring R M + ( concat-tuple x-scalars y-scalars) + ( z))) + ( distributive-map-concat-tuple pr1 x-vectors y-vectors) + = add-left-module-Ring R M + ( linear-combination-tuple-left-module-Ring R M + ( x-scalars) + ( map-tuple pr1 x-vectors)) + ( linear-combination-tuple-left-module-Ring R M + ( y-scalars) + ( map-tuple pr1 y-vectors)) + by + add-concat-linear-combination-tuple-left-module-Ring + ( R) + ( M) + ( x-scalars) + ( map-tuple pr1 x-vectors) + ( y-scalars) + ( map-tuple pr1 y-vectors) + = add-left-module-Ring R M + ( x) + ( linear-combination-tuple-left-module-Ring R M + ( y-scalars) + ( map-tuple pr1 y-vectors)) + by + ap + ( λ z → add-left-module-Ring R M + ( z) + ( linear-combination-tuple-left-module-Ring R M + ( y-scalars) + ( map-tuple pr1 y-vectors))) + ( inv x-identity) + = add-left-module-Ring R M x y + by + ap + ( add-left-module-Ring R M x) + ( inv y-identity)) + ( contains-all-linear-combinations-linear-span-left-module-Ring + ( R) + ( M) + ( S) + ( y-n +ℕ x-n) + ( concat-tuple x-scalars y-scalars) + ( concat-tuple x-vectors y-vectors)) + + is-closed-under-multiplication-by-scalarscalar-linear-span-left-module-Ring : + is-closed-under-multiplication-by-scalar-subset-left-module-Ring R M + ( subset-linear-span-left-module-Ring R M S) + is-closed-under-multiplication-by-scalarscalar-linear-span-left-module-Ring + r x x-in-span = + let + open + do-syntax-trunc-Prop + ( subset-linear-span-left-module-Ring R M S + ( mul-left-module-Ring R M r x)) + in do + ( n , scalars , vectors , identity) ← + ( contains-only-linear-combinations-linear-span-left-module-Ring R M S + ( x , x-in-span)) + ( tr + ( λ y → pr1 (subset-linear-span-left-module-Ring R M S y)) + ( equational-reasoning + linear-combination-tuple-left-module-Ring R M + ( map-tuple (mul-Ring R r) scalars) + ( map-tuple pr1 vectors) + = mul-left-module-Ring R M + ( r) + ( linear-combination-tuple-left-module-Ring R M + ( scalars) + ( map-tuple pr1 vectors)) + by + inv + ( left-distributive-mul-linear-combination-tuple-left-module-Ring + ( R) + ( M) + ( r) + ( scalars) + ( map-tuple pr1 vectors)) + = mul-left-module-Ring R M r x + by + ap + ( mul-left-module-Ring R M r) + ( inv identity)) + ( contains-all-linear-combinations-linear-span-left-module-Ring R M S + ( n) + ( map-tuple (mul-Ring R r) scalars) + ( vectors))) + + left-submodule-linear-span-left-module-Ring : left-submodule-Ring l3 R M + pr1 left-submodule-linear-span-left-module-Ring = + subset-linear-span-left-module-Ring R M S + pr1 (pr2 left-submodule-linear-span-left-module-Ring) = + contains-zero-linear-span-left-module-Ring + pr1 (pr2 (pr2 left-submodule-linear-span-left-module-Ring)) = + is-closed-under-addition-linear-span-left-module-Ring + pr2 (pr2 (pr2 left-submodule-linear-span-left-module-Ring)) = + is-closed-under-multiplication-by-scalarscalar-linear-span-left-module-Ring +``` diff --git a/src/linear-algebra/subsets-left-modules-rings.lagda.md b/src/linear-algebra/subsets-left-modules-rings.lagda.md index 5867b4a98b..cc1eb12ab6 100644 --- a/src/linear-algebra/subsets-left-modules-rings.lagda.md +++ b/src/linear-algebra/subsets-left-modules-rings.lagda.md @@ -36,6 +36,14 @@ subset-left-module-Ring : {l1 l2 : Level} (l : Level) (R : Ring l1) (M : left-module-Ring l2 R) → UU (l2 ⊔ lsuc l) subset-left-module-Ring l R M = subtype l (type-left-module-Ring R M) + +type-subset-left-module-Ring : + {l1 l2 l3 : Level} + (R : Ring l1) + (M : left-module-Ring l2 R) + (S : subset-left-module-Ring l3 R M) → + UU (l2 ⊔ l3) +type-subset-left-module-Ring R M S = type-subtype S ``` ### The condition that a subset is closed under addition diff --git a/src/lists.lagda.md b/src/lists.lagda.md index 373398754b..dad2af873e 100644 --- a/src/lists.lagda.md +++ b/src/lists.lagda.md @@ -7,6 +7,7 @@ module lists where open import lists.arrays public open import lists.concatenation-lists public +open import lists.concatenation-tuples public open import lists.dependent-sequences public open import lists.equivalence-tuples-finite-sequences public open import lists.finite-sequences public diff --git a/src/lists/concatenation-tuples.lagda.md b/src/lists/concatenation-tuples.lagda.md new file mode 100644 index 0000000000..3d724e03f5 --- /dev/null +++ b/src/lists/concatenation-tuples.lagda.md @@ -0,0 +1,55 @@ +# Concatenation of tuples + +```agda +module lists.concatenation-tuples where +``` + +
Imports + +```agda +open import elementary-number-theory.addition-natural-numbers +open import elementary-number-theory.natural-numbers + +open import foundation.action-on-identifications-functions +open import foundation.identity-types +open import foundation.universe-levels + +open import lists.functoriality-tuples +open import lists.tuples +``` + +
+ +## Idea + +Two [tuples](lists.tuples.md) can be +{{#concept "concatenated" Disambiguation="pairs of tuples" Agda=concat-tuple}} +to form a single tuple. Given a tuple `(u_1, ..., u_n)` and a tuple +`(v_1, ..., v_m)`, their concatenation is the tuple +`(u_1, ..., u_n, v_1, ..., v_m)`. + +## Definition + +```agda +concat-tuple : + {n m : ℕ} {l : Level} {A : UU l} → + tuple A n → tuple A m → tuple A (m +ℕ n) +concat-tuple empty-tuple v = v +concat-tuple (x ∷ u) v = x ∷ (concat-tuple u v) +``` + +## Properties + +### Distributivity + +```agda +distributive-map-concat-tuple : + {n m : ℕ} {l1 l2 : Level} {A : UU l1} {B : UU l2} → + (f : A → B) → (u : tuple A n) → (v : tuple A m) → + map-tuple f (concat-tuple u v) = concat-tuple (map-tuple f u) (map-tuple f v) +distributive-map-concat-tuple f empty-tuple v = refl +distributive-map-concat-tuple f (x ∷ u) v = + ap + ( λ w → f x ∷ w) + ( distributive-map-concat-tuple f u v) +``` From 523fa0a353238c355ab3443628ae4ad6d5e14d3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Fri, 12 Sep 2025 23:18:20 +0200 Subject: [PATCH 62/97] Improve code quality in the linear algebra namespace (#1544) --- .../left-submodules-rings.lagda.md | 67 +++++++++++------- .../linear-spans-left-modules-rings.lagda.md | 69 +++++++++++++++---- .../subsets-left-modules-rings.lagda.md | 15 ++-- 3 files changed, 108 insertions(+), 43 deletions(-) diff --git a/src/linear-algebra/left-submodules-rings.lagda.md b/src/linear-algebra/left-submodules-rings.lagda.md index e54f51ecdf..cce1b62c0c 100644 --- a/src/linear-algebra/left-submodules-rings.lagda.md +++ b/src/linear-algebra/left-submodules-rings.lagda.md @@ -146,7 +146,7 @@ is-closed-under-negation-left-submodule-Ring : ( subset-left-submodule-Ring R M N) is-closed-under-negation-left-submodule-Ring R M N x x-in-subset = tr - ( λ x' → pr1 (subset-left-submodule-Ring R M N x')) + ( λ x' → type-Prop (subset-left-submodule-Ring R M N x')) ( mul-neg-one-left-module-Ring R M x) ( is-closed-under-multiplication-by-scalar-left-submodule-Ring R M N ( neg-one-Ring R) @@ -194,18 +194,23 @@ module _ neg-left-submodule-Ring : type-left-submodule-Ring R M N → type-left-submodule-Ring R M N - pr1 (neg-left-submodule-Ring x) = neg-left-module-Ring R M (pr1 x) + pr1 (neg-left-submodule-Ring x) = + neg-left-module-Ring R M (inclusion-left-submodule-Ring R M N x) pr2 (neg-left-submodule-Ring x) = - is-closed-under-negation-left-submodule-Ring R M N (pr1 x) (pr2 x) + is-closed-under-negation-left-submodule-Ring R M N + ( inclusion-left-submodule-Ring R M N x) + ( pr2 x) add-left-submodule-Ring : (x y : type-left-submodule-Ring R M N) → type-left-submodule-Ring R M N pr1 (add-left-submodule-Ring x y) = - add-left-module-Ring R M (pr1 x) (pr1 y) + add-left-module-Ring R M + ( inclusion-left-submodule-Ring R M N x) + ( inclusion-left-submodule-Ring R M N y) pr2 (add-left-submodule-Ring x y) = is-closed-under-addition-left-submodule-Ring R M N - ( pr1 x) - ( pr1 y) + ( inclusion-left-submodule-Ring R M N x) + ( inclusion-left-submodule-Ring R M N y) ( pr2 x) ( pr2 y) @@ -214,10 +219,10 @@ module _ (x : type-left-submodule-Ring R M N) → type-left-submodule-Ring R M N pr1 (mul-left-submodule-Ring r x) = - mul-left-module-Ring R M r (pr1 x) + mul-left-module-Ring R M r (inclusion-left-submodule-Ring R M N x) pr2 (mul-left-submodule-Ring r x) = is-closed-under-multiplication-by-scalar-left-submodule-Ring R M N r - ( pr1 x) + ( inclusion-left-submodule-Ring R M N x) ( pr2 x) associative-add-left-submodule-Ring : @@ -226,21 +231,26 @@ module _ add-left-submodule-Ring x (add-left-submodule-Ring y z) associative-add-left-submodule-Ring x y z = eq-left-submodule-Ring-eq-left-module-Ring R M N - ( associative-add-left-module-Ring R M (pr1 x) (pr1 y) (pr1 z)) + ( associative-add-left-module-Ring R M + ( inclusion-left-submodule-Ring R M N x) + ( inclusion-left-submodule-Ring R M N y) + ( inclusion-left-submodule-Ring R M N z)) left-unit-law-add-left-submodule-Ring : (x : type-left-submodule-Ring R M N) → add-left-submodule-Ring (unit-left-submodule-Ring R M N) x = x left-unit-law-add-left-submodule-Ring x = eq-left-submodule-Ring-eq-left-module-Ring R M N - ( left-unit-law-add-left-module-Ring R M (pr1 x)) + ( left-unit-law-add-left-module-Ring R M + ( inclusion-left-submodule-Ring R M N x)) right-unit-law-add-left-submodule-Ring : (x : type-left-submodule-Ring R M N) → add-left-submodule-Ring x (unit-left-submodule-Ring R M N) = x right-unit-law-add-left-submodule-Ring x = eq-left-submodule-Ring-eq-left-module-Ring R M N - ( right-unit-law-add-left-module-Ring R M (pr1 x)) + ( right-unit-law-add-left-module-Ring R M + ( inclusion-left-submodule-Ring R M N x)) left-inverse-law-add-left-submodule-Ring : (x : type-left-submodule-Ring R M N) → @@ -248,7 +258,8 @@ module _ unit-left-submodule-Ring R M N left-inverse-law-add-left-submodule-Ring x = eq-left-submodule-Ring-eq-left-module-Ring R M N - ( left-inverse-law-add-left-module-Ring R M (pr1 x)) + ( left-inverse-law-add-left-module-Ring R M + ( inclusion-left-submodule-Ring R M N x)) right-inverse-law-add-left-submodule-Ring : (x : type-left-submodule-Ring R M N) → @@ -256,36 +267,42 @@ module _ unit-left-submodule-Ring R M N right-inverse-law-add-left-submodule-Ring x = eq-left-submodule-Ring-eq-left-module-Ring R M N - ( right-inverse-law-add-left-module-Ring R M (pr1 x)) + ( right-inverse-law-add-left-module-Ring R M + ( inclusion-left-submodule-Ring R M N x)) commutative-add-left-submodule-Ring : (x y : type-left-submodule-Ring R M N) → add-left-submodule-Ring x y = add-left-submodule-Ring y x commutative-add-left-submodule-Ring x y = eq-left-submodule-Ring-eq-left-module-Ring R M N - ( commutative-add-left-module-Ring R M (pr1 x) (pr1 y)) + ( commutative-add-left-module-Ring R M + ( inclusion-left-submodule-Ring R M N x) + ( inclusion-left-submodule-Ring R M N y)) - left-distributive-law-mul-add-left-submodule-Ring : + left-distributive-mul-add-left-submodule-Ring : (r : type-Ring R) (x y : type-left-submodule-Ring R M N) → mul-left-submodule-Ring r (add-left-submodule-Ring x y) = add-left-submodule-Ring ( mul-left-submodule-Ring r x) ( mul-left-submodule-Ring r y) - left-distributive-law-mul-add-left-submodule-Ring r x y = + left-distributive-mul-add-left-submodule-Ring r x y = eq-left-submodule-Ring-eq-left-module-Ring R M N - ( left-distributive-mul-add-left-module-Ring R M r (pr1 x) (pr1 y)) + ( left-distributive-mul-add-left-module-Ring R M r + ( inclusion-left-submodule-Ring R M N x) + ( inclusion-left-submodule-Ring R M N y)) - right-distributive-law-mul-add-left-submodule-Ring : + right-distributive-mul-add-left-submodule-Ring : (r s : type-Ring R) (x : type-left-submodule-Ring R M N) → mul-left-submodule-Ring (add-Ring R r s) x = add-left-submodule-Ring ( mul-left-submodule-Ring r x) ( mul-left-submodule-Ring s x) - right-distributive-law-mul-add-left-submodule-Ring r s x = + right-distributive-mul-add-left-submodule-Ring r s x = eq-left-submodule-Ring-eq-left-module-Ring R M N - ( right-distributive-mul-add-left-module-Ring R M r s (pr1 x)) + ( right-distributive-mul-add-left-module-Ring R M r s + ( inclusion-left-submodule-Ring R M N x)) associative-mul-left-submodule-Ring : (r s : type-Ring R) @@ -294,14 +311,16 @@ module _ mul-left-submodule-Ring r (mul-left-submodule-Ring s x) associative-mul-left-submodule-Ring r s x = eq-left-submodule-Ring-eq-left-module-Ring R M N - ( associative-mul-left-module-Ring R M r s (pr1 x)) + ( associative-mul-left-module-Ring R M r s + ( inclusion-left-submodule-Ring R M N x)) left-unit-law-mul-left-submodule-Ring : (x : type-left-submodule-Ring R M N) → mul-left-submodule-Ring (one-Ring R) x = x left-unit-law-mul-left-submodule-Ring x = eq-left-submodule-Ring-eq-left-module-Ring R M N - ( left-unit-law-mul-left-module-Ring R M (pr1 x)) + ( left-unit-law-mul-left-module-Ring R M + ( inclusion-left-submodule-Ring R M N x)) set-left-submodule-Ring : Set (l2 ⊔ l3) pr1 set-left-submodule-Ring = type-left-submodule-Ring R M N @@ -340,7 +359,7 @@ module _ (r : type-Ring R) → hom-Ab ab-left-submodule-Ring ab-left-submodule-Ring pr1 (map-hom-left-submodule-Ring r) = mul-left-submodule-Ring r pr2 (map-hom-left-submodule-Ring r) {x} {y} = - left-distributive-law-mul-add-left-submodule-Ring r x y + left-distributive-mul-add-left-submodule-Ring r x y mul-hom-left-submodule-Ring : hom-Ring R endomorphism-ring-left-submodule-Ring @@ -349,7 +368,7 @@ module _ eq-htpy-hom-Ab ab-left-submodule-Ring ab-left-submodule-Ring - ( right-distributive-law-mul-add-left-submodule-Ring r s) + ( right-distributive-mul-add-left-submodule-Ring r s) pr1 (pr2 mul-hom-left-submodule-Ring) {r} {s} = eq-htpy-hom-Ab ab-left-submodule-Ring diff --git a/src/linear-algebra/linear-spans-left-modules-rings.lagda.md b/src/linear-algebra/linear-spans-left-modules-rings.lagda.md index e143ee3d39..e6f99cb5b0 100644 --- a/src/linear-algebra/linear-spans-left-modules-rings.lagda.md +++ b/src/linear-algebra/linear-spans-left-modules-rings.lagda.md @@ -138,6 +138,15 @@ module _ generators-linear-span-left-module-Ring : subset-left-module-Ring l3 R M generators-linear-span-left-module-Ring = pr2 (pr1 S) + inclusion-generators-linear-span-left-module-Ring : + type-subset-left-module-Ring R M generators-linear-span-left-module-Ring → + type-left-module-Ring R M + inclusion-generators-linear-span-left-module-Ring = pr1 + + is-in-linear-span-left-module-Ring : type-left-module-Ring R M → UU l3 + is-in-linear-span-left-module-Ring x = + type-Prop (subset-linear-span-left-module-Ring x) + contains-all-linear-combinations-linear-span-left-module-Ring : contains-all-linear-combinations-subset-left-module-Ring R M subset-linear-span-left-module-Ring @@ -193,50 +202,74 @@ module _ contains-only-linear-combinations-linear-span-left-module-Ring R M S ( y , y-in-span) tr - ( λ z → pr1 (subset-linear-span-left-module-Ring R M S z)) + ( λ z → is-in-linear-span-left-module-Ring R M S z) ( equational-reasoning linear-combination-tuple-left-module-Ring R M ( concat-tuple x-scalars y-scalars) - ( map-tuple pr1 (concat-tuple x-vectors y-vectors)) + ( map-tuple + ( inclusion-generators-linear-span-left-module-Ring R M S) + ( concat-tuple x-vectors y-vectors)) = linear-combination-tuple-left-module-Ring R M ( concat-tuple x-scalars y-scalars) ( concat-tuple - ( map-tuple pr1 x-vectors) - ( map-tuple pr1 y-vectors)) + ( map-tuple + ( inclusion-generators-linear-span-left-module-Ring R M S) + ( x-vectors)) + ( map-tuple + ( inclusion-generators-linear-span-left-module-Ring R M S) + ( y-vectors))) by ap ( λ z → ( linear-combination-tuple-left-module-Ring R M ( concat-tuple x-scalars y-scalars) ( z))) - ( distributive-map-concat-tuple pr1 x-vectors y-vectors) + ( distributive-map-concat-tuple + ( inclusion-generators-linear-span-left-module-Ring R M S) + ( x-vectors) + ( y-vectors)) = add-left-module-Ring R M ( linear-combination-tuple-left-module-Ring R M ( x-scalars) - ( map-tuple pr1 x-vectors)) + ( map-tuple + ( inclusion-generators-linear-span-left-module-Ring R M S) + ( x-vectors))) ( linear-combination-tuple-left-module-Ring R M ( y-scalars) - ( map-tuple pr1 y-vectors)) + ( map-tuple + ( inclusion-generators-linear-span-left-module-Ring R M S) + ( y-vectors))) by add-concat-linear-combination-tuple-left-module-Ring ( R) ( M) ( x-scalars) - ( map-tuple pr1 x-vectors) + ( map-tuple + ( inclusion-generators-linear-span-left-module-Ring R M S) + ( x-vectors)) ( y-scalars) - ( map-tuple pr1 y-vectors) + ( map-tuple + ( inclusion-generators-linear-span-left-module-Ring R M S) + ( y-vectors)) = add-left-module-Ring R M ( x) ( linear-combination-tuple-left-module-Ring R M ( y-scalars) - ( map-tuple pr1 y-vectors)) + ( map-tuple + ( inclusion-generators-linear-span-left-module-Ring R M S) + ( y-vectors))) by ap ( λ z → add-left-module-Ring R M ( z) ( linear-combination-tuple-left-module-Ring R M ( y-scalars) - ( map-tuple pr1 y-vectors))) + ( map-tuple + ( inclusion-generators-linear-span-left-module-Ring + ( R) + ( M) + ( S)) + ( y-vectors)))) ( inv x-identity) = add-left-module-Ring R M x y by @@ -266,16 +299,20 @@ module _ ( contains-only-linear-combinations-linear-span-left-module-Ring R M S ( x , x-in-span)) ( tr - ( λ y → pr1 (subset-linear-span-left-module-Ring R M S y)) + ( λ y → is-in-linear-span-left-module-Ring R M S y) ( equational-reasoning linear-combination-tuple-left-module-Ring R M ( map-tuple (mul-Ring R r) scalars) - ( map-tuple pr1 vectors) + ( map-tuple + ( inclusion-generators-linear-span-left-module-Ring R M S) + ( vectors)) = mul-left-module-Ring R M ( r) ( linear-combination-tuple-left-module-Ring R M ( scalars) - ( map-tuple pr1 vectors)) + ( map-tuple + ( inclusion-generators-linear-span-left-module-Ring R M S) + ( vectors))) by inv ( left-distributive-mul-linear-combination-tuple-left-module-Ring @@ -283,7 +320,9 @@ module _ ( M) ( r) ( scalars) - ( map-tuple pr1 vectors)) + ( map-tuple + ( inclusion-generators-linear-span-left-module-Ring R M S) + ( vectors))) = mul-left-module-Ring R M r x by ap diff --git a/src/linear-algebra/subsets-left-modules-rings.lagda.md b/src/linear-algebra/subsets-left-modules-rings.lagda.md index cc1eb12ab6..8155bd0232 100644 --- a/src/linear-algebra/subsets-left-modules-rings.lagda.md +++ b/src/linear-algebra/subsets-left-modules-rings.lagda.md @@ -8,6 +8,7 @@ module linear-algebra.subsets-left-modules-rings where ```agda open import foundation.conjunction +open import foundation.dependent-pair-types open import foundation.propositions open import foundation.subtypes open import foundation.universe-levels @@ -37,13 +38,19 @@ subset-left-module-Ring : (l : Level) (R : Ring l1) (M : left-module-Ring l2 R) → UU (l2 ⊔ lsuc l) subset-left-module-Ring l R M = subtype l (type-left-module-Ring R M) -type-subset-left-module-Ring : +module _ {l1 l2 l3 : Level} (R : Ring l1) (M : left-module-Ring l2 R) - (S : subset-left-module-Ring l3 R M) → - UU (l2 ⊔ l3) -type-subset-left-module-Ring R M S = type-subtype S + (S : subset-left-module-Ring l3 R M) + where + + type-subset-left-module-Ring : UU (l2 ⊔ l3) + type-subset-left-module-Ring = type-subtype S + + inclusion-subset-left-module-Ring : + type-subset-left-module-Ring → type-left-module-Ring R M + inclusion-subset-left-module-Ring = pr1 ``` ### The condition that a subset is closed under addition From 8081ebeb6232b8b2e3d178406e974b2891308448 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 24 Sep 2025 12:18:15 +0200 Subject: [PATCH 63/97] Fix Agda definition pointers in concept macros (#1549) --- src/analysis/convergent-series-metric-abelian-groups.lagda.md | 2 +- .../sums-of-finite-families-of-elements-abelian-groups.lagda.md | 2 +- ...r-combinations-tuples-of-vectors-left-modules-rings.lagda.md | 2 +- src/metric-spaces/metrics-of-metric-spaces.lagda.md | 2 +- .../totally-bounded-subspaces-metric-spaces.lagda.md | 2 +- .../sums-of-finite-families-of-elements-semirings.lagda.md | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/analysis/convergent-series-metric-abelian-groups.lagda.md b/src/analysis/convergent-series-metric-abelian-groups.lagda.md index 167dcbcd09..aff454ff03 100644 --- a/src/analysis/convergent-series-metric-abelian-groups.lagda.md +++ b/src/analysis/convergent-series-metric-abelian-groups.lagda.md @@ -27,7 +27,7 @@ open import metric-spaces.limits-of-sequences-metric-spaces A [series](analysis.series-metric-abelian-groups.md) in a [metric abelian group](analysis.metric-abelian-groups.md) is -{{#concept "convergent" Disambiguation="series in a metric abelian group" Agda=converges-series-Metric-Ab WDID=Q1211057 WD="convergent series"}} +{{#concept "convergent" Disambiguation="series in a metric abelian group" Agda=is-convergent-series-Metric-Ab Agda=convergent-series-Metric-Ab WDID=Q1211057 WD="convergent series"}} if its [sequence](lists.sequences.md) of partial sums [converges](metric-spaces.convergent-sequences-metric-spaces.md) in the associated [metric space](metric-spaces.metric-spaces.md). diff --git a/src/group-theory/sums-of-finite-families-of-elements-abelian-groups.lagda.md b/src/group-theory/sums-of-finite-families-of-elements-abelian-groups.lagda.md index c5db30c52b..106ea3913e 100644 --- a/src/group-theory/sums-of-finite-families-of-elements-abelian-groups.lagda.md +++ b/src/group-theory/sums-of-finite-families-of-elements-abelian-groups.lagda.md @@ -36,7 +36,7 @@ open import univalent-combinatorics.standard-finite-types ## Idea The -{{#concept "sum operation" Disambiguation="of a finite family of elements of a abelian group" WD="sum" WDID=Q218005 Agda=sum-fin-sequence-type-Ab}} +{{#concept "sum operation" Disambiguation="of a finite family of elements of a abelian group" WD="sum" WDID=Q218005 Agda=sum-finite-Ab}} extends the binary addition operation on a [abelian group](ring-theory.semirings.md) `G` to any family of elements of `G` indexed by a [finite type](univalent-combinatorics.finite-types.md). diff --git a/src/linear-algebra/linear-combinations-tuples-of-vectors-left-modules-rings.lagda.md b/src/linear-algebra/linear-combinations-tuples-of-vectors-left-modules-rings.lagda.md index acaedba8a7..aa43326213 100644 --- a/src/linear-algebra/linear-combinations-tuples-of-vectors-left-modules-rings.lagda.md +++ b/src/linear-algebra/linear-combinations-tuples-of-vectors-left-modules-rings.lagda.md @@ -30,7 +30,7 @@ Let `M` be a [left module](linear-algebra.left-modules-rings.md) over a [ring](ring-theory.rings.md) `R`. For any `n`-tuple of vectors (elements of `M`) `(x_1, ..., x_n)` and any `n`-tuple of coefficients (elements of `R`) `(r_1, ..., r_n)`, we may form the -{{#concept "linear combination" Agda=linear-combination-left-module-Ring}} +{{#concept "linear combination" Agda=linear-combination-tuple-left-module-Ring}} `r_1 * x_1 + ... + r_n * x_n`. The proposition of _being_ a linear combination is formalized as being an diff --git a/src/metric-spaces/metrics-of-metric-spaces.lagda.md b/src/metric-spaces/metrics-of-metric-spaces.lagda.md index b4d0275b97..303e1da8e7 100644 --- a/src/metric-spaces/metrics-of-metric-spaces.lagda.md +++ b/src/metric-spaces/metrics-of-metric-spaces.lagda.md @@ -34,7 +34,7 @@ open import real-numbers.strict-inequality-real-numbers A function `ρ` from two elements of a [metric space](metric-spaces.metric-spaces.md) `M` to the [nonnegative real numbers](real-numbers.nonnegative-real-numbers.md) is a -{{#concept "metric" disambiguation="of a metric space" WD="metric function" WDID=Q865746 Agda=is-metric-Metric-Space}} +{{#concept "metric" disambiguation="of a metric space" WD="metric function" WDID=Q865746 Agda=is-metric-of-Metric-Space}} of `M` if for all [positive rational numbers](elementary-number-theory.positive-rational-numbers.md) `d` and all `x y : M`, `x` and `y` are in a `d`-neighborhood of each other in diff --git a/src/metric-spaces/totally-bounded-subspaces-metric-spaces.lagda.md b/src/metric-spaces/totally-bounded-subspaces-metric-spaces.lagda.md index 58cee39164..164752f38c 100644 --- a/src/metric-spaces/totally-bounded-subspaces-metric-spaces.lagda.md +++ b/src/metric-spaces/totally-bounded-subspaces-metric-spaces.lagda.md @@ -27,7 +27,7 @@ open import metric-spaces.uniformly-continuous-functions-metric-spaces ## Idea A -{{#concept "totally bounded" disambiguation="subspace of a metric space" WDID=Q1362228 WD="totally bounded space" Agda=is-totally-bounded-subset-Metric-Space}} +{{#concept "totally bounded" disambiguation="subspace of a metric space" WDID=Q1362228 WD="totally bounded space" Agda=totally-bounded-subspace-Metric-Space}} [subspace](metric-spaces.subspaces-metric-spaces.md) of a [metric space](metric-spaces.metric-spaces.md) is a subspace that is [totally bounded](metric-spaces.totally-bounded-metric-spaces.md). diff --git a/src/ring-theory/sums-of-finite-families-of-elements-semirings.lagda.md b/src/ring-theory/sums-of-finite-families-of-elements-semirings.lagda.md index 484bf0534e..19a6500ca4 100644 --- a/src/ring-theory/sums-of-finite-families-of-elements-semirings.lagda.md +++ b/src/ring-theory/sums-of-finite-families-of-elements-semirings.lagda.md @@ -38,7 +38,7 @@ open import univalent-combinatorics.standard-finite-types ## Idea The -{{#concept "sum operation" Disambiguation="of a finite family of elements of a semiring" WD="sum" WDID=Q218005 Agda=sum-fin-sequence-type-Semiring}} +{{#concept "sum operation" Disambiguation="of a finite family of elements of a semiring" WD="sum" WDID=Q218005 Agda=sum-finite-Semiring}} extends the binary addition operation on a [semiring](ring-theory.semirings.md) `R` to any family of elements of `R` indexed by a [finite type](univalent-combinatorics.finite-types.md). From 4da2a2684f4cfb4a390d732b3d0012f8a1e8afdc Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 24 Sep 2025 12:35:27 +0200 Subject: [PATCH 64/97] Only run `typecheck` on pull requests that are ready for review (#1493) #1514 --- .github/workflows/ci.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5af8e0bbb6..b19c9de296 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,6 +11,7 @@ on: push: branches: - master + pull_request: branches: - master @@ -27,6 +28,9 @@ concurrency: jobs: typecheck: + if: + ${{ github.event_name == 'workflow_dispatch' || (github.event_name == + 'pull_request' && github.event.pull_request.draft == false) }} runs-on: ${{ matrix.os }} strategy: matrix: From 02fb6d8415494a333d78d2aa6d37834755d738dd Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Thu, 25 Sep 2025 11:44:56 +0200 Subject: [PATCH 65/97] Fix some entries in `CONTRIBUTORS.toml` (#1518) Fixes #1501 and adds all but one of the missing contributors. --- CONTRIBUTORS.toml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.toml b/CONTRIBUTORS.toml index 83f0b1b6b2..7866c4bf0c 100644 --- a/CONTRIBUTORS.toml +++ b/CONTRIBUTORS.toml @@ -35,7 +35,7 @@ homotopy type theory and higher category theory. [[contributors]] displayName = "Elisabeth Stenholm" maintainer = true -usernames = [ "Elisabeth Stenholm", "Elisabeth Bonnevier" ] +usernames = [ "Elisabeth Stenholm", "Elisabeth Bonnevier", "elisabethstenholm" ] homepage = "https://elisabeth.stenholm.one" github = "elisabethstenholm" bio = ''' @@ -281,3 +281,25 @@ displayName = "Šimon Brandner" usernames = ["Šimon Brandner"] github = "SimonBrandner" homepage = "https://simonbrandner.cz/" + +[[contributors]] +displayName = "Viktor Yudov" +usernames = ["Viktor Yudov", "spcfox"] +github = "spcfox" + +[[contributors]] +displayName = "Pietro Monticone" +usernames = ["Pietro Monticone"] +github = "pitmonticone" + +[[contributors]] +displayName = "Lîm Tsú-thuàn" +usernames = ["Lîm Tsú-thuàn"] +github = "dannypsnl" +homepage = "https://dannypsnl.srht.site/" + + +[[contributors]] +displayName = "Bjarki" +usernames = ["Bjarki"] +github = "bjarki781" From 89a7901ae80e4a7c2b944d8ab0b12e1662866480 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Thu, 25 Sep 2025 15:45:25 +0200 Subject: [PATCH 66/97] pre-commit --- .github/workflows/ci.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b19c9de296..270e2fca24 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -28,8 +28,7 @@ concurrency: jobs: typecheck: - if: - ${{ github.event_name == 'workflow_dispatch' || (github.event_name == + if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false) }} runs-on: ${{ matrix.os }} strategy: From 84738ce8f0a790d7664ab24740b5e1f2026cbc56 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Fri, 3 Oct 2025 15:23:12 +0200 Subject: [PATCH 67/97] pre-commit --- .github/workflows/ci.yaml | 6 ++---- .github/workflows/clean-build.yaml | 3 +-- .github/workflows/pages.yaml | 3 +-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ee6d23c9fc..30cc58ec6b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,8 +24,7 @@ concurrency: jobs: typecheck: - if: - ${{ github.event_name == 'workflow_dispatch' || github.event_name == + if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false) }} runs-on: ubuntu-latest @@ -48,8 +47,7 @@ jobs: name: Restore Agda formalization cache with: path: repo/_build - key: - ${{ runner.os }}-check-${{ github.ref }}-${{ matrix.agda }}-${{ + key: ${{ runner.os }}-check-${{ github.ref }}-${{ matrix.agda }}-${{ hashFiles('repo/src/**') }} restore-keys: | ${{ runner.os }}-check-${{ github.ref }}-${{ matrix.agda }}- diff --git a/.github/workflows/clean-build.yaml b/.github/workflows/clean-build.yaml index 98b5fbe412..c2cecc9173 100644 --- a/.github/workflows/clean-build.yaml +++ b/.github/workflows/clean-build.yaml @@ -37,8 +37,7 @@ jobs: uses: actions/cache/save@v4 with: path: repo/_build - key: - ${{ runner.os }}-check-${{ github.ref }}-${{ matrix.agda }}-${{ + key: ${{ runner.os }}-check-${{ github.ref }}-${{ matrix.agda }}-${{ hashFiles('repo/src/**') }} - name: Download previous typechecking profile diff --git a/.github/workflows/pages.yaml b/.github/workflows/pages.yaml index aeb1face4c..7528b90247 100644 --- a/.github/workflows/pages.yaml +++ b/.github/workflows/pages.yaml @@ -48,8 +48,7 @@ jobs: name: Restore Agda formalization cache with: path: repo/_build - key: - ${{ runner.os }}-check-${{ github.ref }}-${{ matrix.agda }}-${{ + key: ${{ runner.os }}-check-${{ github.ref }}-${{ matrix.agda }}-${{ hashFiles('repo/src/**') }} restore-keys: | ${{ runner.os }}-check-${{ github.ref }}-${{ matrix.agda }}- From 06f0f6f052c0dee7e26e6e3c15ad5f8a96d8c354 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Fri, 3 Oct 2025 16:24:58 +0200 Subject: [PATCH 68/97] also remove everything file on clean --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a61ab064ca..2df3b1e90d 100644 --- a/Makefile +++ b/Makefile @@ -193,7 +193,7 @@ graph: $(MDBOOK_SRC)/dependency.dot .PHONY: clean clean: - @rm -Rf ./$(MDBOOK_DIR)/ ./$(AGDA_BUILD)/ ./$(AGDA_PROFILING_TEMP)/ + @rm -Rf ./$(MDBOOK_DIR)/ ./$(AGDA_BUILD)/ ./$(AGDA_PROFILING_TEMP)/ ./$(SOURCE_DIR)/everything.lagda.md .PHONY: pre-commit pre-commit: From 65ecad605b6bf7c0e9e2803da455b5e946f13a60 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Fri, 3 Oct 2025 17:11:49 +0200 Subject: [PATCH 69/97] fix weird error --- .gitignore | 3 --- Makefile | 3 ++- scripts/generate_mdbook_summary.py | 22 ++++++++++++++++++---- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 97eaa7a1d8..7e1546fb02 100644 --- a/.gitignore +++ b/.gitignore @@ -425,9 +425,6 @@ book/ temp/ src/temp/ src/everything.lagda.md -SUMMARY.md -CONTRIBUTORS.md -MAINTAINERS.md /website/css/Agda-highlight.css /website/images/agda_dependency_graph.svg /website/images/agda_dependency_graph_legend.html diff --git a/Makefile b/Makefile index 2df3b1e90d..2d59596e52 100644 --- a/Makefile +++ b/Makefile @@ -168,6 +168,7 @@ $(WEBSITE_IMAGES)/agda_dependency_graph.svg $(WEBSITE_IMAGES)/agda_dependency_gr .PHONY: website-prepare website-prepare: agda-html ./$(MDBOOK_SRC)/SUMMARY.md ./$(MDBOOK_SRC)/CONTRIBUTORS.md ./$(MDBOOK_SRC)/MAINTAINERS.md \ ./$(WEBSITE_CSS)/Agda-highlight.css $(AUX_TARGETS) + @rm -Rf ./docs/CONTRIBUTORS.md ./docs/MAINTAINERS.md ./docs/SUMMARY.md # Remove old autogenerated metafile copies @cp $(METAFILES) ./$(MDBOOK_SRC)/ @cp -r ./$(DOCS_DIR)/ ./$(MDBOOK_SRC) @mkdir -p ./$(MDBOOK_SRC)/website @@ -193,7 +194,7 @@ graph: $(MDBOOK_SRC)/dependency.dot .PHONY: clean clean: - @rm -Rf ./$(MDBOOK_DIR)/ ./$(AGDA_BUILD)/ ./$(AGDA_PROFILING_TEMP)/ ./$(SOURCE_DIR)/everything.lagda.md + @rm -Rf ./$(MDBOOK_DIR)/ ./$(AGDA_BUILD)/ ./$(AGDA_PROFILING_TEMP)/ ./$(SOURCE_DIR)/everything.lagda.md ./$(SCRIPTS_DIR)/__pycache__ ./docs/CONTRIBUTORS.md ./docs/MAINTAINERS.md ./docs/SUMMARY.md .PHONY: pre-commit pre-commit: diff --git a/scripts/generate_mdbook_summary.py b/scripts/generate_mdbook_summary.py index 5c770d4bc8..e220714f50 100755 --- a/scripts/generate_mdbook_summary.py +++ b/scripts/generate_mdbook_summary.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # Run this script: -# $ ./scripts/generate_mdbook_summary.py book/src/SUMMARY.md +# $ ./scripts/generate_mdbook_summary.py book/SUMMARY.md import argparse import sys @@ -11,6 +11,7 @@ STATUS_FLAG_GIT_ERROR = 1 STATUS_FLAG_NO_TITLE = 2 STATUS_FLAG_DUPLICATE_TITLE = 4 +STATUS_FAILED_OVERWRITE = 8 entry_template = '- [{title}]({mdfile})' @@ -148,7 +149,20 @@ def generate_index(root_path): literature_index=literature_index, module_index=module_index ) - with open(summary_path, 'w') as summary_file: - summary_file.write(summary_contents) - print(f'Wrote mdbook summary content to {summary_path}.') + summary_file_path = pathlib.Path(summary_path) + try: + if summary_file_path.exists(): + existing = summary_file_path.read_text() + if existing == summary_contents: + print(f'No changes to {summary_file_path}.') + else: + summary_file_path.write_text(summary_contents) + print(f'Updated mdbook summary content at {summary_file_path}.') + else: + summary_file_path.parent.mkdir(parents=True, exist_ok=True) + summary_file_path.write_text(summary_contents) + print(f'Wrote mdbook summary content to {summary_file_path}.') + except Exception as e: + utils.eprint(f'Failed to write summary file {summary_file_path}: {e}') + status |= STATUS_FAILED_OVERWRITE sys.exit(status) From accce3681d2d9e338d151086c5e38a50856cfe87 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Fri, 3 Oct 2025 16:59:19 +0200 Subject: [PATCH 70/97] Link styling tweaks (#1413) ## Summary - [X] ~Add dotted underlines under links that are adjacent making it possible to tell them apart, e.g.: ![image](https://github.com/user-attachments/assets/1a8c3c99-acaa-4bda-9f7f-da9890f09423) ![image](https://github.com/user-attachments/assets/07f83e2d-0031-419f-994e-5997d87ddcc4) The styling does not apply to code, or concept paragraph symbols, and it only applies to links with another link directly adjacent to it.~ - [X] Don't display underline on hover in code. New: ![image](https://github.com/user-attachments/assets/890b0200-4073-4e13-9260-af4cb3a8a6c6) vs old: ![image](https://github.com/user-attachments/assets/c90227d7-4461-4b4d-9fa0-883d3c086b73) - [X] Add external link indicator, e.g., the symbol after the first link below image --------- Co-authored-by: VojtechStep --- docs/HOME.md | 2 +- scripts/preprocessor_concepts.py | 2 +- website/css/print.css | 4 ++++ website/theme/css/general.css | 33 +++++++++++++++++++++++++++++++- 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/docs/HOME.md b/docs/HOME.md index 4d9f43bc11..271203e485 100644 --- a/docs/HOME.md +++ b/docs/HOME.md @@ -4,7 +4,7 @@ Welcome to the agda-unimath project. This is a community-driven effort aimed at formalizing mathematics from a univalent point of view using the dependently typed programming language [Agda](https://github.com/agda/agda). - + agda-unimath diff --git a/scripts/preprocessor_concepts.py b/scripts/preprocessor_concepts.py index 5a20171e02..071af982a6 100644 --- a/scripts/preprocessor_concepts.py +++ b/scripts/preprocessor_concepts.py @@ -112,7 +112,7 @@ def slugify_markdown(md): def sup_link_reference(href, content, brackets=True, new_tab=False): # f-strings can't contain backslashes, so we can't escape the quotes link_target = new_tab * ' target="_blank"' - return f'{brackets * "["}{content}{brackets * "]"}' + return f'{brackets * "["}{content}{brackets * "]"}' def sub_match_for_concept(m, mut_index, mut_error_locations, config, path, initial_content): diff --git a/website/css/print.css b/website/css/print.css index c9e997d80b..ca14ae1c57 100644 --- a/website/css/print.css +++ b/website/css/print.css @@ -47,6 +47,10 @@ a:hover { text-decoration: none; } +a[href^='http']::after { + display: none !important; +} + h1, h2, h3, diff --git a/website/theme/css/general.css b/website/theme/css/general.css index fd282066f5..b6c7fc2415 100644 --- a/website/theme/css/general.css +++ b/website/theme/css/general.css @@ -135,7 +135,38 @@ h6:target::before { text-decoration: none; } .content a:hover { - text-decoration: underline; + text-decoration: solid underline; +} + +pre.Agda a:hover { + text-decoration: none; +} + +a.concept { + text-decoration: none !important; +} + +/* External link indicator using inline SVG */ +.content a[href^='http']::after { + content: ''; + width: 11px; + height: 11px; + margin-left: 4px; + mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5z'/%3E%3Cpath fill-rule='evenodd' d='M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0v-5z'/%3E%3C/svg%3E"); + mask-position: center; + mask-repeat: no-repeat; + mask-size: contain; + display: inline-block; + background-color: var(--fg); +} + +:is( + nav.pagetoc a, + a:has(> img), + a.concept[href^='http'], + .hide-external-link + )::after { + display: none !important; } .content img, .content video { From e661bcc44aa0b0863bcdc15d8c33166a283db50d Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 6 Oct 2025 15:34:15 +0200 Subject: [PATCH 71/97] review --- .pre-commit-config.yaml | 2 +- .vscode/settings.json | 2 +- CONTRIBUTING.md | 4 ++-- Makefile | 6 +++--- config/{.codespellrc => codespellrc} | 0 config/{.prettierrc.json => prettierrc.json} | 0 scripts/preprocessor_git_metadata.py | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) rename config/{.codespellrc => codespellrc} (100%) rename config/{.prettierrc.json => prettierrc.json} (100%) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e5cbaa0c53..5cac0df2bd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: args: [ '--config', - 'config/.codespellrc', + 'config/codespellrc', '--builtin', 'clear,rare,informal,usage,code,names,en-GB_to_en-US', '--dictionary', diff --git a/.vscode/settings.json b/.vscode/settings.json index 75eaafe676..f235fc0bd0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -38,7 +38,7 @@ // Autoformatting "editor.defaultFormatter": "esbenp.prettier-vscode", - "prettier.configPath": "config/.prettierrc.json", + "prettier.configPath": "config/prettierrc.json", "editor.formatOnType": true, "editor.formatOnSave": true, diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8bacdf056a..a901081674 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,11 +43,11 @@ Below is a summary of the tasks this tool performs: permissible spellchecker that only reports known misspellings, rather than words it does not recognize. I.e., it is a blacklist based spellchecker. We maintain an additional library-defined dictionary of misspellings at: - [`config/codespell-dictionary.txt`](https://github.com/UniMath/agda-unimath/blob/master/codespell-dictionary.txt). + [`config/codespell-dictionary.txt`](https://github.com/UniMath/agda-unimath/blob/master/config/codespell-dictionary.txt). If you find a misspelled word in the library, it is good practice to add it to this dictionary in addition to correcting the mistake. If codespell erroneously reports a word as misspelled, please add it to - [`config/codespell-ignore.txt`](https://github.com/UniMath/agda-unimath/blob/master/codespell-ignore.txt). + [`config/codespell-ignore.txt`](https://github.com/UniMath/agda-unimath/blob/master/config/codespell-ignore.txt). - **Sort codespell dictionary and ignore files**: Sorts and formats the associated codespell dictionary and ignore files. diff --git a/Makefile b/Makefile index 2d59596e52..8c9e0708d7 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,7 @@ SKIPAUX ?= ifeq ($(SKIPAUX),1) AUX_TARGETS := else -AUX_TARGETS := ./$(WEBSITE_IMAGES_DIR)/agda_dependency_graph.svg ./$(WEBSITE_IMAGES_DIR)/agda_dependency_graph_legend.html +AUX_TARGETS := ./$(WEBSITE_IMAGES)/agda_dependency_graph.svg ./$(WEBSITE_IMAGES)/agda_dependency_graph_legend.html endif ifeq ($(CI),) @@ -151,7 +151,7 @@ agda-html: ./$(SOURCE_DIR)/everything.lagda.md fi ./$(MDBOOK_SRC)/SUMMARY.md: ${AGDAFILES} ./$(SCRIPTS_DIR)/generate_mdbook_summary.py - @python3 ./$(SCRIPTS_DIR)/generate_mdbook_summary.py ./$(MDBOOK_SRC)/SUMMARY.md + @python3 ./$(SCRIPTS_DIR)/generate_mdbook_summary.py $@ ./$(MDBOOK_SRC)/MAINTAINERS.md: ${CONTRIBUTORS_FILE} ./$(SCRIPTS_DIR)/generate_maintainers.py @python3 ./$(SCRIPTS_DIR)/generate_maintainers.py ${CONTRIBUTORS_FILE} ./$(MDBOOK_SRC)/MAINTAINERS.md @@ -168,7 +168,7 @@ $(WEBSITE_IMAGES)/agda_dependency_graph.svg $(WEBSITE_IMAGES)/agda_dependency_gr .PHONY: website-prepare website-prepare: agda-html ./$(MDBOOK_SRC)/SUMMARY.md ./$(MDBOOK_SRC)/CONTRIBUTORS.md ./$(MDBOOK_SRC)/MAINTAINERS.md \ ./$(WEBSITE_CSS)/Agda-highlight.css $(AUX_TARGETS) - @rm -Rf ./docs/CONTRIBUTORS.md ./docs/MAINTAINERS.md ./docs/SUMMARY.md # Remove old autogenerated metafile copies + @rm -f ./docs/CONTRIBUTORS.md ./docs/MAINTAINERS.md ./docs/SUMMARY.md # Remove old autogenerated metafile copies @cp $(METAFILES) ./$(MDBOOK_SRC)/ @cp -r ./$(DOCS_DIR)/ ./$(MDBOOK_SRC) @mkdir -p ./$(MDBOOK_SRC)/website diff --git a/config/.codespellrc b/config/codespellrc similarity index 100% rename from config/.codespellrc rename to config/codespellrc diff --git a/config/.prettierrc.json b/config/prettierrc.json similarity index 100% rename from config/.prettierrc.json rename to config/prettierrc.json diff --git a/scripts/preprocessor_git_metadata.py b/scripts/preprocessor_git_metadata.py index 3ca898075f..614d3528e8 100644 --- a/scripts/preprocessor_git_metadata.py +++ b/scripts/preprocessor_git_metadata.py @@ -161,7 +161,7 @@ def add_author_info_to_chapter_rec_mut(roots, chapter, contributors, config): header_info_element, footer_info_element = get_author_element_for_file( source_file_name, any((source_file_name.endswith(ext) - for ext in config['attribute-file-extensions'])), + for ext in config['attribute_file_extensions'])), contributors, config['contributors_file']) # Assumption: The title is the first header in the file From e51283b333a6143ff4ec353db97887017a1ef75c Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 6 Oct 2025 18:29:48 +0200 Subject: [PATCH 72/97] fix prettier config path --- .github/workflows/ci.yaml | 6 ++++-- .github/workflows/clean-build.yaml | 3 ++- .github/workflows/pages.yaml | 3 ++- .pre-commit-config.yaml | 1 + website/theme/pagetoc.js | 8 ++++---- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 30cc58ec6b..ee6d23c9fc 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,7 +24,8 @@ concurrency: jobs: typecheck: - if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == + if: + ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false) }} runs-on: ubuntu-latest @@ -47,7 +48,8 @@ jobs: name: Restore Agda formalization cache with: path: repo/_build - key: ${{ runner.os }}-check-${{ github.ref }}-${{ matrix.agda }}-${{ + key: + ${{ runner.os }}-check-${{ github.ref }}-${{ matrix.agda }}-${{ hashFiles('repo/src/**') }} restore-keys: | ${{ runner.os }}-check-${{ github.ref }}-${{ matrix.agda }}- diff --git a/.github/workflows/clean-build.yaml b/.github/workflows/clean-build.yaml index c2cecc9173..98b5fbe412 100644 --- a/.github/workflows/clean-build.yaml +++ b/.github/workflows/clean-build.yaml @@ -37,7 +37,8 @@ jobs: uses: actions/cache/save@v4 with: path: repo/_build - key: ${{ runner.os }}-check-${{ github.ref }}-${{ matrix.agda }}-${{ + key: + ${{ runner.os }}-check-${{ github.ref }}-${{ matrix.agda }}-${{ hashFiles('repo/src/**') }} - name: Download previous typechecking profile diff --git a/.github/workflows/pages.yaml b/.github/workflows/pages.yaml index 7528b90247..aeb1face4c 100644 --- a/.github/workflows/pages.yaml +++ b/.github/workflows/pages.yaml @@ -48,7 +48,8 @@ jobs: name: Restore Agda formalization cache with: path: repo/_build - key: ${{ runner.os }}-check-${{ github.ref }}-${{ matrix.agda }}-${{ + key: + ${{ runner.os }}-check-${{ github.ref }}-${{ matrix.agda }}-${{ hashFiles('repo/src/**') }} restore-keys: | ${{ runner.os }}-check-${{ github.ref }}-${{ matrix.agda }}- diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5cac0df2bd..b55ba602c7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -133,6 +133,7 @@ repos: - id: prettier name: CSS, JS, YAML and Markdown (no codeblocks) formatting types_or: [css, javascript, yaml, markdown] + args: ['--config', 'config/prettierrc.json'] - repo: https://github.com/FlamingTempura/bibtex-tidy rev: v1.14.0 diff --git a/website/theme/pagetoc.js b/website/theme/pagetoc.js index 7e6b74cb16..a5517cc8e1 100644 --- a/website/theme/pagetoc.js +++ b/website/theme/pagetoc.js @@ -7,11 +7,11 @@ Array.prototype.forEach.call( document.getElementsByClassName('pagetoc')[0].children, function (el) { el.classList.remove('active'); - }, + } ); el.classList.add('active'); }); - }, + } ); var updateFunction = function () { @@ -27,7 +27,7 @@ var updateFunction = function () { document.getElementsByClassName('pagetoc')[0].children, function (el) { el.classList.remove('active'); - }, + } ); if (!id) return; Array.prototype.forEach.call( @@ -36,7 +36,7 @@ var updateFunction = function () { if (id.href.localeCompare(el.href) == 0) { el.classList.add('active'); } - }, + } ); }; From 504e700cf35cf834a8cf2e9d8d0009361daa8411 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 6 Oct 2025 19:34:43 +0200 Subject: [PATCH 73/97] `$@` --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 8c9e0708d7..fe9be92c00 100644 --- a/Makefile +++ b/Makefile @@ -154,10 +154,10 @@ agda-html: ./$(SOURCE_DIR)/everything.lagda.md @python3 ./$(SCRIPTS_DIR)/generate_mdbook_summary.py $@ ./$(MDBOOK_SRC)/MAINTAINERS.md: ${CONTRIBUTORS_FILE} ./$(SCRIPTS_DIR)/generate_maintainers.py - @python3 ./$(SCRIPTS_DIR)/generate_maintainers.py ${CONTRIBUTORS_FILE} ./$(MDBOOK_SRC)/MAINTAINERS.md + @python3 ./$(SCRIPTS_DIR)/generate_maintainers.py ${CONTRIBUTORS_FILE} $@ ./$(MDBOOK_SRC)/CONTRIBUTORS.md: ${AGDAFILES} ${CONTRIBUTORS_FILE} ./$(SCRIPTS_DIR)/generate_contributors.py - @python3 ./$(SCRIPTS_DIR)/generate_contributors.py ${CONTRIBUTORS_FILE} ./$(MDBOOK_SRC)/CONTRIBUTORS.md + @python3 ./$(SCRIPTS_DIR)/generate_contributors.py ${CONTRIBUTORS_FILE} $@ $(WEBSITE_CSS)/Agda-highlight.css: ./$(SCRIPTS_DIR)/generate_agda_css.py ./$(WEBSITE_THEME)/catppuccin.css @python3 ./$(SCRIPTS_DIR)/generate_agda_css.py From c07707fcc6fedb24e6a81d4f447763efe51683f8 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 6 Oct 2025 23:04:54 +0200 Subject: [PATCH 74/97] fix `@cp -r` --- Makefile | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index fe9be92c00..fe7f0ff0bc 100644 --- a/Makefile +++ b/Makefile @@ -35,6 +35,17 @@ CONTRIBUTORS_FILE := CONTRIBUTORS.toml # added to the everything file as well. everythingOpts := --guardedness --cohesion --flat-split --rewriting +# Figure out which OS we are running +UNAME_S := $(strip $(shell uname -s)) + +ifeq ($(UNAME_S),Darwin) + OS := mac +else ifeq ($(UNAME_S),Linux) + OS := linux +else + OS := unknown +endif + # use "$ export SKIPAGDA=1" or "make SKIPAGDA=1 ..." to skip Agda processing # when building the website SKIPAGDA ?= @@ -169,12 +180,26 @@ $(WEBSITE_IMAGES)/agda_dependency_graph.svg $(WEBSITE_IMAGES)/agda_dependency_gr website-prepare: agda-html ./$(MDBOOK_SRC)/SUMMARY.md ./$(MDBOOK_SRC)/CONTRIBUTORS.md ./$(MDBOOK_SRC)/MAINTAINERS.md \ ./$(WEBSITE_CSS)/Agda-highlight.css $(AUX_TARGETS) @rm -f ./docs/CONTRIBUTORS.md ./docs/MAINTAINERS.md ./docs/SUMMARY.md # Remove old autogenerated metafile copies - @cp $(METAFILES) ./$(MDBOOK_SRC)/ - @cp -r ./$(DOCS_DIR)/ ./$(MDBOOK_SRC) + + @mkdir -p ./$(MDBOOK_SRC) @mkdir -p ./$(MDBOOK_SRC)/website - @cp -r ./$(WEBSITE_IMAGES) ./$(MDBOOK_SRC)/website/ - @cp -r ./$(WEBSITE_CSS) ./$(MDBOOK_SRC)/website/ - @cp -r ./$(WEBSITE_JS) ./$(MDBOOK_SRC)/website/ + + @cp $(METAFILES) ./$(MDBOOK_SRC)/ + + @bash -c '\ + if [ "$(OS)" = "linux" ]; then \ + cp -r ./$(DOCS_DIR)/. ./$(MDBOOK_SRC); \ + cp -r ./$(WEBSITE_IMAGES)/. ./$(MDBOOK_SRC)/website/; \ + cp -r ./$(WEBSITE_CSS)/. ./$(MDBOOK_SRC)/website/; \ + cp -r ./$(WEBSITE_JS)/. ./$(MDBOOK_SRC)/website/; \ + elif [ "$(OS)" = "mac" ]; then \ + cp -r ./$(DOCS_DIR) ./$(MDBOOK_SRC); \ + cp -r ./$(WEBSITE_IMAGES) ./$(MDBOOK_SRC)/website/; \ + cp -r ./$(WEBSITE_CSS) ./$(MDBOOK_SRC)/website/; \ + cp -r ./$(WEBSITE_JS) ./$(MDBOOK_SRC)/website/; \ + else \ + echo "Unsupported operating system: $(UNAME_S)" >&2; exit 1; \ + fi' .PHONY: website website: website-prepare From 128d4698d49d8a679790ddf41493c8a6ac62db10 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 6 Oct 2025 23:06:26 +0200 Subject: [PATCH 75/97] move `.prettierrc.json` back --- .pre-commit-config.yaml | 2 +- config/prettierrc.json => .prettierrc.json | 0 .vscode/settings.json | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename config/prettierrc.json => .prettierrc.json (100%) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b55ba602c7..d123890ea3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -133,7 +133,7 @@ repos: - id: prettier name: CSS, JS, YAML and Markdown (no codeblocks) formatting types_or: [css, javascript, yaml, markdown] - args: ['--config', 'config/prettierrc.json'] + args: ['--config', '.prettierrc.json'] - repo: https://github.com/FlamingTempura/bibtex-tidy rev: v1.14.0 diff --git a/config/prettierrc.json b/.prettierrc.json similarity index 100% rename from config/prettierrc.json rename to .prettierrc.json diff --git a/.vscode/settings.json b/.vscode/settings.json index f235fc0bd0..637fc489bd 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -38,7 +38,7 @@ // Autoformatting "editor.defaultFormatter": "esbenp.prettier-vscode", - "prettier.configPath": "config/prettierrc.json", + "prettier.configPath": ".prettierrc.json", "editor.formatOnType": true, "editor.formatOnSave": true, From f14bd199664f3e32da266cb1bc07be5185dd6ca6 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Tue, 7 Oct 2025 01:15:55 +0200 Subject: [PATCH 76/97] oopsie --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index fe7f0ff0bc..7077e19aaa 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ CONTRIBUTORS_FILE := CONTRIBUTORS.toml everythingOpts := --guardedness --cohesion --flat-split --rewriting # Figure out which OS we are running -UNAME_S := $(strip $(shell uname -s)) +UNAME_S := $(shell uname -s) ifeq ($(UNAME_S),Darwin) OS := mac @@ -193,7 +193,7 @@ website-prepare: agda-html ./$(MDBOOK_SRC)/SUMMARY.md ./$(MDBOOK_SRC)/CONTRIBUTO cp -r ./$(WEBSITE_CSS)/. ./$(MDBOOK_SRC)/website/; \ cp -r ./$(WEBSITE_JS)/. ./$(MDBOOK_SRC)/website/; \ elif [ "$(OS)" = "mac" ]; then \ - cp -r ./$(DOCS_DIR) ./$(MDBOOK_SRC); \ + cp -r ./$(DOCS_DIR)/ ./$(MDBOOK_SRC); \ cp -r ./$(WEBSITE_IMAGES) ./$(MDBOOK_SRC)/website/; \ cp -r ./$(WEBSITE_CSS) ./$(MDBOOK_SRC)/website/; \ cp -r ./$(WEBSITE_JS) ./$(MDBOOK_SRC)/website/; \ From fd515c49ced7bac0fe5aee28499955e1565906ba Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Tue, 7 Oct 2025 13:07:17 +0200 Subject: [PATCH 77/97] fix `.editorconfig` for Makefile --- .editorconfig | 5 +++++ .vscode/settings.json | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 057b59ea79..37bc73a4db 100644 --- a/.editorconfig +++ b/.editorconfig @@ -31,3 +31,8 @@ indent_size = 4 [*.{ya?ml,cff}] indent_size = 2 + +[Makefile] +indent_style = tab +indent_size = 2 +trim_trailing_whitespace = false diff --git a/.vscode/settings.json b/.vscode/settings.json index 637fc489bd..9ef0b61abe 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -94,7 +94,8 @@ "[makefile]": { "editor.insertSpaces": false, - "editor.detectIndentation": true + "editor.detectIndentation": false, + "editor.renderWhitespace": "boundary" }, "[markdown]": { From ef3cbe5aa87d826f9a47f49da734eb5b97ff3458 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Tue, 7 Oct 2025 13:07:48 +0200 Subject: [PATCH 78/97] add `make clean-website` --- Makefile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 7077e19aaa..98c2f4521b 100644 --- a/Makefile +++ b/Makefile @@ -204,12 +204,12 @@ website-prepare: agda-html ./$(MDBOOK_SRC)/SUMMARY.md ./$(MDBOOK_SRC)/CONTRIBUTO .PHONY: website website: website-prepare @MDBOOK_PREPROCESSOR__CONCEPTS__SKIP_AGDA=$(SKIPAGDA) \ - mdbook build + mdbook build .PHONY: serve-website serve-website: website-prepare @MDBOOK_PREPROCESSOR__CONCEPTS__SKIP_AGDA=$(SKIPAGDA) \ - mdbook serve -p 8080 --open -d ./$(MDBOOK_DIR)/html + mdbook serve -p 8080 --open -d ./$(MDBOOK_DIR)/html $(MDBOOK_SRC)/dependency.dot : ./$(SOURCE_DIR)/everything.lagda.md ${AGDAFILES} ${AGDA} ${AGDAHTMLFLAGS} --dependency-graph=$@ $< @@ -217,9 +217,13 @@ $(MDBOOK_SRC)/dependency.dot : ./$(SOURCE_DIR)/everything.lagda.md ${AGDAFILES} .PHONY: graph graph: $(MDBOOK_SRC)/dependency.dot +.PHONY: clean-website +clean-website: + @rm -Rf ./$(MDBOOK_DIR)/ ./docs/CONTRIBUTORS.md ./docs/MAINTAINERS.md ./docs/SUMMARY.md + .PHONY: clean -clean: - @rm -Rf ./$(MDBOOK_DIR)/ ./$(AGDA_BUILD)/ ./$(AGDA_PROFILING_TEMP)/ ./$(SOURCE_DIR)/everything.lagda.md ./$(SCRIPTS_DIR)/__pycache__ ./docs/CONTRIBUTORS.md ./docs/MAINTAINERS.md ./docs/SUMMARY.md +clean: clean-website + @rm -Rf ./$(AGDA_BUILD)/ ./$(AGDA_PROFILING_TEMP)/ ./$(SOURCE_DIR)/everything.lagda.md ./$(SCRIPTS_DIR)/__pycache__ .PHONY: pre-commit pre-commit: From 499395972a707c9fc22ea020cef0b170dda3f487 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 8 Oct 2025 00:17:12 +0200 Subject: [PATCH 79/97] fix --- Makefile | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 98c2f4521b..6fa2e15650 100644 --- a/Makefile +++ b/Makefile @@ -186,20 +186,10 @@ website-prepare: agda-html ./$(MDBOOK_SRC)/SUMMARY.md ./$(MDBOOK_SRC)/CONTRIBUTO @cp $(METAFILES) ./$(MDBOOK_SRC)/ - @bash -c '\ - if [ "$(OS)" = "linux" ]; then \ - cp -r ./$(DOCS_DIR)/. ./$(MDBOOK_SRC); \ - cp -r ./$(WEBSITE_IMAGES)/. ./$(MDBOOK_SRC)/website/; \ - cp -r ./$(WEBSITE_CSS)/. ./$(MDBOOK_SRC)/website/; \ - cp -r ./$(WEBSITE_JS)/. ./$(MDBOOK_SRC)/website/; \ - elif [ "$(OS)" = "mac" ]; then \ - cp -r ./$(DOCS_DIR)/ ./$(MDBOOK_SRC); \ - cp -r ./$(WEBSITE_IMAGES) ./$(MDBOOK_SRC)/website/; \ - cp -r ./$(WEBSITE_CSS) ./$(MDBOOK_SRC)/website/; \ - cp -r ./$(WEBSITE_JS) ./$(MDBOOK_SRC)/website/; \ - else \ - echo "Unsupported operating system: $(UNAME_S)" >&2; exit 1; \ - fi' + @cp -r ./$(DOCS_DIR)/* ./$(MDBOOK_SRC) + @cp -r ./$(WEBSITE_IMAGES)/. ./$(MDBOOK_SRC)/website/ + @cp -r ./$(WEBSITE_CSS)/. ./$(MDBOOK_SRC)/website/ + @cp -r ./$(WEBSITE_JS)/. ./$(MDBOOK_SRC)/website/ .PHONY: website website: website-prepare From 6f8b5cd3547c8e8c46857b08c069b61e89e6ac55 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 8 Oct 2025 00:38:24 +0200 Subject: [PATCH 80/97] fixiwixie --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 6fa2e15650..34faaccf10 100644 --- a/Makefile +++ b/Makefile @@ -187,9 +187,9 @@ website-prepare: agda-html ./$(MDBOOK_SRC)/SUMMARY.md ./$(MDBOOK_SRC)/CONTRIBUTO @cp $(METAFILES) ./$(MDBOOK_SRC)/ @cp -r ./$(DOCS_DIR)/* ./$(MDBOOK_SRC) - @cp -r ./$(WEBSITE_IMAGES)/. ./$(MDBOOK_SRC)/website/ - @cp -r ./$(WEBSITE_CSS)/. ./$(MDBOOK_SRC)/website/ - @cp -r ./$(WEBSITE_JS)/. ./$(MDBOOK_SRC)/website/ + @cp -r ./$(WEBSITE_IMAGES) ./$(MDBOOK_SRC)/website + @cp -r ./$(WEBSITE_CSS) ./$(MDBOOK_SRC)/website + @cp -r ./$(WEBSITE_JS) ./$(MDBOOK_SRC)/website .PHONY: website website: website-prepare From 3ff2c86a266588fd786dcbd5d3ddcc1125acc449 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 8 Oct 2025 01:04:15 +0200 Subject: [PATCH 81/97] fix --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 34faaccf10..43fc76bcd2 100644 --- a/Makefile +++ b/Makefile @@ -186,7 +186,7 @@ website-prepare: agda-html ./$(MDBOOK_SRC)/SUMMARY.md ./$(MDBOOK_SRC)/CONTRIBUTO @cp $(METAFILES) ./$(MDBOOK_SRC)/ - @cp -r ./$(DOCS_DIR)/* ./$(MDBOOK_SRC) + @cp -r ./$(DOCS_DIR)/. ./$(MDBOOK_SRC) @cp -r ./$(WEBSITE_IMAGES) ./$(MDBOOK_SRC)/website @cp -r ./$(WEBSITE_CSS) ./$(MDBOOK_SRC)/website @cp -r ./$(WEBSITE_JS) ./$(MDBOOK_SRC)/website From 683cb6ede04ef7dbda255056f75d672f287c0f04 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 8 Oct 2025 01:12:03 +0200 Subject: [PATCH 82/97] Update Makefile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Vojtěch Štěpančík --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index 43fc76bcd2..0c6c819d58 100644 --- a/Makefile +++ b/Makefile @@ -181,7 +181,6 @@ website-prepare: agda-html ./$(MDBOOK_SRC)/SUMMARY.md ./$(MDBOOK_SRC)/CONTRIBUTO ./$(WEBSITE_CSS)/Agda-highlight.css $(AUX_TARGETS) @rm -f ./docs/CONTRIBUTORS.md ./docs/MAINTAINERS.md ./docs/SUMMARY.md # Remove old autogenerated metafile copies - @mkdir -p ./$(MDBOOK_SRC) @mkdir -p ./$(MDBOOK_SRC)/website @cp $(METAFILES) ./$(MDBOOK_SRC)/ From 59654d666ab3d2c1c688dd2f8f1b11fd3671e348 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 8 Oct 2025 01:12:21 +0200 Subject: [PATCH 83/97] remove os code --- Makefile | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/Makefile b/Makefile index 0c6c819d58..b4bc1e01b3 100644 --- a/Makefile +++ b/Makefile @@ -35,17 +35,6 @@ CONTRIBUTORS_FILE := CONTRIBUTORS.toml # added to the everything file as well. everythingOpts := --guardedness --cohesion --flat-split --rewriting -# Figure out which OS we are running -UNAME_S := $(shell uname -s) - -ifeq ($(UNAME_S),Darwin) - OS := mac -else ifeq ($(UNAME_S),Linux) - OS := linux -else - OS := unknown -endif - # use "$ export SKIPAGDA=1" or "make SKIPAGDA=1 ..." to skip Agda processing # when building the website SKIPAGDA ?= From b25c5e325af3ee649fb0c4dcef55e4c3147b573c Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 8 Oct 2025 01:16:47 +0200 Subject: [PATCH 84/97] comment on BSD/GNU difference --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index b4bc1e01b3..eb4ceeb825 100644 --- a/Makefile +++ b/Makefile @@ -174,6 +174,8 @@ website-prepare: agda-html ./$(MDBOOK_SRC)/SUMMARY.md ./$(MDBOOK_SRC)/CONTRIBUTO @cp $(METAFILES) ./$(MDBOOK_SRC)/ + # The cp command works differently between BSD(MacOS) and GNU(Linux), but the following command works for both + # https://dev.to/ackshaey/macos-vs-linux-the-cp-command-will-trip-you-up-2p00 @cp -r ./$(DOCS_DIR)/. ./$(MDBOOK_SRC) @cp -r ./$(WEBSITE_IMAGES) ./$(MDBOOK_SRC)/website @cp -r ./$(WEBSITE_CSS) ./$(MDBOOK_SRC)/website From 1f192658f52a9d3206afa1422c7dce06f362d18e Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 8 Oct 2025 01:26:57 +0200 Subject: [PATCH 85/97] comment --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index eb4ceeb825..a83f8140c4 100644 --- a/Makefile +++ b/Makefile @@ -174,8 +174,8 @@ website-prepare: agda-html ./$(MDBOOK_SRC)/SUMMARY.md ./$(MDBOOK_SRC)/CONTRIBUTO @cp $(METAFILES) ./$(MDBOOK_SRC)/ - # The cp command works differently between BSD(MacOS) and GNU(Linux), but the following command works for both - # https://dev.to/ackshaey/macos-vs-linux-the-cp-command-will-trip-you-up-2p00 + # Copies the files from `$(DOCS_DIR)` to `$(MDBOOK_SRC)`, not just the literal `$(DOCS_DIR)` directory + # The following works consistently across BSD (MacOS) and GNU (Linux) @cp -r ./$(DOCS_DIR)/. ./$(MDBOOK_SRC) @cp -r ./$(WEBSITE_IMAGES) ./$(MDBOOK_SRC)/website @cp -r ./$(WEBSITE_CSS) ./$(MDBOOK_SRC)/website From 23c7b5a74ae10b7ae7fa928def20929e3c8ae63a Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 8 Oct 2025 12:55:54 +0200 Subject: [PATCH 86/97] fix some capitalization in `references` --- references.bib | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/references.bib b/references.bib index da0e6f65ee..6ae2b0fda6 100644 --- a/references.bib +++ b/references.bib @@ -12,7 +12,7 @@ @online{100theorems } @article{ABFJ20, - title = {A generalized {B}lakers-{M}assey theorem}, + title = {A generalized {{Blakers–Massey}} theorem}, author = {Anel, Mathieu and Biedermann, Georg and Finster, Eric and Joyal, Andr\'e}, year = 2020, journal = {J. Topol.}, @@ -91,7 +91,7 @@ @article{ANST25 } @misc{Awodey22, - title = {{On Hofmann-Streicher universes}}, + title = {On {{Hofmann–Streicher}} universes}, author = {Awodey, Steve}, year = 2022, month = may, @@ -102,7 +102,7 @@ @misc{Awodey22 } @article{BauerTaylor2009, - title = {The {D}edekind Reals in Abstract {S}tone Duality}, + title = {The {{Dedekind}} Reals in Abstract {{Stone}} Duality}, author = {Bauer, Andrej and Taylor, Paul}, year = 2009, journal = {Mathematical Structures in Computer Science}, @@ -115,7 +115,7 @@ @article{BauerTaylor2009 } @online{BCDE21, - title = {Free groups in HoTT/UF in Agda}, + title = {Free groups in {{HoTT/UF}} in Agda}, author = {Bezem, Marc and Coquand, Thierry and Dybjer, Peter and Escardó, Martín}, year = 2021, url = {https://www.cs.bham.ac.uk/~mhe/TypeTopology/Groups.Free.html}, @@ -238,7 +238,7 @@ @article{Cantor1890/91 } @article{Cheng07, - title = {An ω-Category with All {{Duals}} Is an ω-Groupoid}, + title = {An ω-Category with All Duals Is an ω-Groupoid}, author = {Cheng, Eugenia}, year = 2007, month = {08}, @@ -357,7 +357,7 @@ @inproceedings{dJKFX23 } @online{Dlicata335/Cohesion-Agda, - title = {Dlicata335/Cohesion-Agda}, + title = {{Dlicata335/Cohesion-Agda}}, author = {Licata, Dan}, date = {2017-11-06T03:09:02Z}, url = {https://github.com/dlicata335/cohesion-agda}, @@ -483,7 +483,7 @@ @book{FBL73 } @online{Felixwellen/DCHoTT-Agda, - title = {Felixwellen/{{DCHoTT-Agda}}}, + title = {{{Felixwellen/DCHoTT-Agda}}}, author = {Cherubini, Felix}, date = {2023-08-15T18:08:37Z}, url = {https://github.com/felixwellen/DCHoTT-Agda}, @@ -594,7 +594,7 @@ @inproceedings{KvR19 } @misc{Lavenir23, - title = {Hilton-Milnor's theorem in $\infty$-topoi}, + title = {{{Hilton–Milnor's}} theorem in $\infty$-topoi}, author = {Samuel Lavenir}, year = 2023, eprint = {2312.12370}, @@ -765,7 +765,7 @@ @online{oeis } @phdthesis{Qui16, - title = {Lawvere–Tierney sheafification in Homotopy Type Theory}, + title = {{{Lawvere–Tierney}} sheafification in Homotopy Type Theory}, author = {Quirin, Kevin}, year = 2016, month = dec, @@ -951,7 +951,7 @@ @article{Shu17 } @article{Shu18, - title = {Brouwer's Fixed-Point Theorem in Real-Cohesive Homotopy Type Theory}, + title = {{{Brouwer's}} Fixed-Point Theorem in Real-Cohesive Homotopy Type Theory}, author = {Shulman, Michael}, year = 2018, month = {06}, @@ -971,7 +971,7 @@ @article{Shu18 } @article{Sto87, - title = {Dedekind finiteness in topoi}, + title = {{{Dedekind}} finiteness in topoi}, author = {Lawrence Neff Stout}, year = 1987, journal = {Journal of Pure and Applied Algebra}, From d850543a2480ab1b2178ad03f17a4300cdeb47b9 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 8 Oct 2025 13:09:33 +0200 Subject: [PATCH 87/97] don't print comments --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a83f8140c4..b30308b4a9 100644 --- a/Makefile +++ b/Makefile @@ -174,8 +174,8 @@ website-prepare: agda-html ./$(MDBOOK_SRC)/SUMMARY.md ./$(MDBOOK_SRC)/CONTRIBUTO @cp $(METAFILES) ./$(MDBOOK_SRC)/ - # Copies the files from `$(DOCS_DIR)` to `$(MDBOOK_SRC)`, not just the literal `$(DOCS_DIR)` directory - # The following works consistently across BSD (MacOS) and GNU (Linux) + @# Copies the files from `$(DOCS_DIR)` to `$(MDBOOK_SRC)`, not just the literal `$(DOCS_DIR)` directory + @# The following works consistently across BSD (MacOS) and GNU (Linux) @cp -r ./$(DOCS_DIR)/. ./$(MDBOOK_SRC) @cp -r ./$(WEBSITE_IMAGES) ./$(MDBOOK_SRC)/website @cp -r ./$(WEBSITE_CSS) ./$(MDBOOK_SRC)/website From d4eaf88667743f64a02a2ff6f0c2f89cf40cb8d9 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 8 Oct 2025 13:15:10 +0200 Subject: [PATCH 88/97] add `'docs'` to `roots`, git metadata preprocessor --- scripts/preprocessor_git_metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/preprocessor_git_metadata.py b/scripts/preprocessor_git_metadata.py index 614d3528e8..827f99e275 100644 --- a/scripts/preprocessor_git_metadata.py +++ b/scripts/preprocessor_git_metadata.py @@ -227,7 +227,7 @@ def add_author_info_to_root_section(roots, section, contributors, config): # Split the work between PROCESS_COUNT processes with Pool(PROCESS_COUNT) as p: book['sections'] = p.starmap(add_author_info_to_root_section, [ - (['src', ''], section, contributors_data, metadata_config) + (['src', '', 'docs'], section, contributors_data, metadata_config) for section in book['sections'] ]) else: From 3a57da62ebe09d36c9ae8d79a1d2b85308dfe3c8 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 8 Oct 2025 14:04:17 +0200 Subject: [PATCH 89/97] a few echoes --- Makefile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b30308b4a9..ea8bd31d6b 100644 --- a/Makefile +++ b/Makefile @@ -163,6 +163,7 @@ $(WEBSITE_CSS)/Agda-highlight.css: ./$(SCRIPTS_DIR)/generate_agda_css.py ./$(WEB @python3 ./$(SCRIPTS_DIR)/generate_agda_css.py $(WEBSITE_IMAGES)/agda_dependency_graph.svg $(WEBSITE_IMAGES)/agda_dependency_graph_legend.html &: ${AGDAFILES} + @echo Generating dependency graph art by Fredrik @python3 ./$(SCRIPTS_DIR)/generate_dependency_graph_rendering.py $(WEBSITE_IMAGES)/agda_dependency_graph svg || true .PHONY: website-prepare @@ -214,6 +215,8 @@ pre-commit: # Keep versions in sync with .github/workflows/pages.yaml install-website-dev: + @echo + @echo Installing website dependencies @cargo install mdbook@0.4.34 @cargo install mdbook-linkcheck@0.7.7 @cargo install mdbook-katex@0.5.7 @@ -222,5 +225,9 @@ install-website-dev: .PHONY: unused-imports unused-imports: - python3 ./$(SCRIPTS_DIR)/remove_unused_imports.py - python3 ./$(SCRIPTS_DIR)/demote_foundation_imports.py + @echo + @echo Removing unused imports + @python3 ./$(SCRIPTS_DIR)/remove_unused_imports.py + @echo + @echo Demoting foundation imports + @python3 ./$(SCRIPTS_DIR)/demote_foundation_imports.py From 6bbbd64dac2bd3ba8ac6b8871d9267f10ab3886f Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 8 Oct 2025 14:05:21 +0200 Subject: [PATCH 90/97] be a little smarter about skipped authors --- scripts/generate_contributors.py | 10 +++++++--- scripts/preprocessor_git_metadata.py | 13 ++++++++++--- scripts/utils/contributors.py | 20 +++++++++++--------- 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/scripts/generate_contributors.py b/scripts/generate_contributors.py index af9cff1545..0ef5b7aa5c 100644 --- a/scripts/generate_contributors.py +++ b/scripts/generate_contributors.py @@ -7,7 +7,7 @@ import os import sys from utils import github_page_for_contributor -from utils.contributors import parse_contributors_file, sorted_authors_from_raw_shortlog_lines +from utils.contributors import parse_contributors_file, sorted_authors_from_raw_shortlog_lines, print_skipping_contributors_warning template = """\ @@ -58,8 +58,12 @@ def format_contributor(contributor): 'HEAD' ], capture_output=True, text=True, check=True).stdout.splitlines() - sorted_authors = sorted_authors_from_raw_shortlog_lines( - git_log_output, contributors_data, args.contributors_file) + sorted_authors, skipped_authors = sorted_authors_from_raw_shortlog_lines( + git_log_output, contributors_data) + + if skipped_authors: + print_skipping_contributors_warning(skipped_authors, args.contributors_file) + output = template.format( names='\n'.join((format_contributor(c) for c in sorted_authors)), CONTRIBUTORS_FILE=args.contributors_file diff --git a/scripts/preprocessor_git_metadata.py b/scripts/preprocessor_git_metadata.py index 827f99e275..5801441eaf 100644 --- a/scripts/preprocessor_git_metadata.py +++ b/scripts/preprocessor_git_metadata.py @@ -10,7 +10,7 @@ import subprocess import sys from utils import github_page_for_commit, eprint -from utils.contributors import parse_contributors_file, format_multiple_authors_attribution, get_real_author_index, sorted_authors_from_raw_shortlog_lines, print_skipping_contributor_warning +from utils.contributors import parse_contributors_file, format_multiple_authors_attribution, get_real_author_index, sorted_authors_from_raw_shortlog_lines, print_skipping_contributors_warning PROCESS_COUNT = 4 SOURCE_EXTS = ['.md', '.lagda.md'] @@ -67,6 +67,8 @@ def get_author_element_for_file(filename, include_contributors, contributors, co # but alas I haven't found anything to that effect attribution_text = '' + skipped_authors = set() + if include_contributors: # Arguments mostly copied from the 1lab pipeline raw_authors_git_output = subprocess.run([ @@ -84,9 +86,11 @@ def get_author_element_for_file(filename, include_contributors, contributors, co # If all commits to a file are chore commits, then there are no authors if raw_authors_git_output: # Collect authors and sort by number of commits + sorted_authors, __skipped_authors = sorted_authors_from_raw_shortlog_lines(raw_authors_git_output, contributors) + skipped_authors.update(__skipped_authors) author_names = [ author['displayName'] - for author in sorted_authors_from_raw_shortlog_lines(raw_authors_git_output, contributors, contributors_file) + for author in sorted_authors ] attribution_text = f'

Content created by {format_multiple_authors_attribution(author_names)}.

' @@ -121,7 +125,7 @@ def get_author_element_for_file(filename, include_contributors, contributors, co continue author_index = get_real_author_index(raw_author, contributors) if author_index is None: - print_skipping_contributor_warning(raw_author,contributors_file) + skipped_authors.add(raw_author) continue author_indices.append(author_index) if len(author_indices) == 0: @@ -131,6 +135,9 @@ def get_author_element_for_file(filename, include_contributors, contributors, co ]) recent_changes += f'- {date}. {formatted_authors}. {message}.\n' + if skipped_authors: + print_skipping_contributors_warning(skipped_authors, contributors_file) + return ( f'{attribution_text}

{nobreak_span("Created on " + created_date)}.
{nobreak_span("Last modified on " + modified_date)}.

', recent_changes diff --git a/scripts/utils/contributors.py b/scripts/utils/contributors.py index f95916ba23..3a7089125a 100644 --- a/scripts/utils/contributors.py +++ b/scripts/utils/contributors.py @@ -14,28 +14,30 @@ def parse_contributors_file(contributors_file): def print_skipping_contributor_warning(contributor, contributors_file): - print('Warning: not attributing changes to ', - contributor, - '. If you want your work to be attributed to you, add yourself to ', - contributors_file, - '.', - file=sys.stderr, sep='') + print(f'Warning: not attributing changes to {contributor}. If you want your work to be attributed to you, add yourself to {contributors_file}.', + file=sys.stderr) +def print_skipping_contributors_warning(contributors, contributors_file): + for contributor in sorted(contributors): + print_skipping_contributor_warning(contributor, contributors_file) def get_real_author_index(raw_username, contributors): return next((index for (index, c) in enumerate(contributors) if raw_username in c['usernames']), None) -def sorted_authors_from_raw_shortlog_lines(shortlog, contributors, contributors_file): +def sorted_authors_from_raw_shortlog_lines(shortlog, contributors): author_commits = defaultdict(int) + skipped_authors = set() for raw_author_line in shortlog: commit_count_str, raw_author = raw_author_line.split('\t') commit_count = int(commit_count_str.strip()) author_index = get_real_author_index(raw_author, contributors) if author_index is None: - print_skipping_contributor_warning(raw_author, contributors_file) + skipped_authors.add(raw_author) continue author_commits[author_index] += commit_count + # for raw_author in sorted(skipped_authors): + # print_skipping_contributor_warning(raw_author, contributors_file) sorted_author_indices = sorted( author_commits, key=author_commits.get, reverse=True) - return [contributors[author_index] for author_index in sorted_author_indices] + return [contributors[author_index] for author_index in sorted_author_indices] , skipped_authors From 25950430b571c25e7ce894239f6804cbc441acbf Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 8 Oct 2025 14:06:05 +0200 Subject: [PATCH 91/97] pre-commit --- references.bib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/references.bib b/references.bib index 6ae2b0fda6..5283620161 100644 --- a/references.bib +++ b/references.bib @@ -483,7 +483,7 @@ @book{FBL73 } @online{Felixwellen/DCHoTT-Agda, - title = {{{Felixwellen/DCHoTT-Agda}}}, + title = {{Felixwellen/DCHoTT-Agda}}, author = {Cherubini, Felix}, date = {2023-08-15T18:08:37Z}, url = {https://github.com/felixwellen/DCHoTT-Agda}, From ab8751cdee75d461053f7a836077511f9add830e Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 8 Oct 2025 17:43:06 +0200 Subject: [PATCH 92/97] fix `suppress_preprocessing` --- book.toml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/book.toml b/book.toml index 0748b35dd7..2808d16152 100644 --- a/book.toml +++ b/book.toml @@ -46,15 +46,15 @@ attribute_file_extensions = [ ".lagda.md" ] # Don't add anything to the "non-content" pages, # i.e. top-level markdown files which aren't guides suppress_processing = [ - "ART.md", - "CONTRIBUTORS.md", - "GRANT-ACKNOWLEDGMENTS.md", - "HOME.md", - "MAINTAINERS.md", - "PROJECTS.md", - "STATEMENT-OF-INCLUSIVITY.md", - "SUMMARY.md", - "VISUALIZATION.md" + "docs/ART.md", + "docs/CONTRIBUTORS.md", + "docs/GRANT-ACKNOWLEDGMENTS.md", + "docs/HOME.md", + "docs/MAINTAINERS.md", + "docs/PROJECTS.md", + "docs/STATEMENT-OF-INCLUSIVITY.md", + "docs/SUMMARY.md", + "docs/VISUALIZATION.md" ] [preprocessor.concepts] From ad57ab3835aec60bc3c7d2f9b63d76ecee1197b9 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 8 Oct 2025 17:47:07 +0200 Subject: [PATCH 93/97] comments --- book.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book.toml b/book.toml index 2808d16152..11b31a9986 100644 --- a/book.toml +++ b/book.toml @@ -32,7 +32,7 @@ inline-delimiter = {left = "$", right = "$"} macros = "config/latex-macros.txt" [preprocessor.catppuccin] -assets_version = "1.2.0" # DO NOT EDIT: Managed by `mdbook-catppuccin install` +assets_version = "1.2.0" # ! DO NOT EDIT: Managed by `mdbook-catppuccin install` [preprocessor.git-metadata] command = "python3 ./scripts/preprocessor_git_metadata.py" @@ -106,7 +106,7 @@ enable = false [output.html.fold] enable = true # whether or not to enable section folding -level = 0 # the depth to start folding +level = 0 # the depth to start folding [output.html.search] enable = true # enables the search feature From 22ac83a19c97c121d7353b831ec2a284478c8018 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 8 Oct 2025 19:03:56 +0200 Subject: [PATCH 94/97] fix `custom.js` --- website/js/custom.js | 51 ++++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/website/js/custom.js b/website/js/custom.js index 486224fbec..0ab983693b 100644 --- a/website/js/custom.js +++ b/website/js/custom.js @@ -1,40 +1,59 @@ +// This script generates the GitHub link for the edit button on each page of the website const link = document.querySelector('.href-git-edit-button'); if (link) { // console.log(link); var filename = link.getAttribute('href'); - const fileList = [ + const excludeList = [ + 'SUMMARY.md', + ]; + const rootFileList = [ + 'CONTRIBUTING.md', + 'LICENSE.md', + 'README.md', + ] + const docsFileList = [ 'ART.md', 'CITE-THIS-LIBRARY.md', 'CITING-SOURCES.md', 'CODINGSTYLE.md', - 'CONTRIBUTING.md', - 'CONTRIBUTORS.md', 'DESIGN-PRINCIPLES.md', 'FILE-CONVENTIONS.md', 'GRANT-ACKNOWLEDGMENTS.md', 'HOME.md', 'HOWTO-INSTALL.md', - 'LICENSE.md', - 'MAINTAINERS.md', 'MIXFIX-OPERATORS.md', - 'README.md', - 'STATEMENT-OF-INCLUSIVITY.md', - 'SUMMARY.md', 'PROJECTS.md', + 'STATEMENT-OF-INCLUSIVITY.md', + 'TEMPLATE.lagda.md', 'VISUALIZATION.md', - 'index.md', - ]; - if (!fileList.includes(filename)) { + ] + if (filename === 'index.md') { + filename = 'docs/HOME.md'; + } else if (filename === 'CONTRIBUTORS.md' || filename === 'MAINTAINERS.md') { + filename = 'CONTRIBUTORS.toml' + } + else if (rootFileList.includes(filename)) { + filename = filename + } + else if (docsFileList.includes(filename)) { + filename = "docs/" + filename + } + else { const dotIndex = filename.lastIndexOf('.'); let name = filename.slice(0, dotIndex); // const extension = filename.slice(dotIndex + 1); filename = 'src/' + name.replace(/\./g, '/') + '.lagda.md'; - } else if (filename === 'index.md') { - filename = 'HOME.md'; } - const prefixedHref = - 'https://github.com/UniMath/agda-unimath/edit/master/' + filename; - link.setAttribute('href', prefixedHref); + + if (excludeList.includes(filename)) { + // Default to the main GitHub page for excluded pages + link.setAttribute('href', 'https://github.com/UniMath/agda-unimath'); + } + else { + const prefixedHref = + 'https://github.com/UniMath/agda-unimath/edit/master/' + filename; + link.setAttribute('href', prefixedHref); + } } else { console.error('Could not find a link with the class href-git-edit-button'); } From be873416491b79b80e56ec0805e7ebaf66545066 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 8 Oct 2025 19:10:31 +0200 Subject: [PATCH 95/97] introduce intermediate variable `path` --- website/js/custom.js | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/website/js/custom.js b/website/js/custom.js index 0ab983693b..2ac1990273 100644 --- a/website/js/custom.js +++ b/website/js/custom.js @@ -10,7 +10,7 @@ if (link) { 'CONTRIBUTING.md', 'LICENSE.md', 'README.md', - ] + ]; const docsFileList = [ 'ART.md', 'CITE-THIS-LIBRARY.md', @@ -26,32 +26,35 @@ if (link) { 'STATEMENT-OF-INCLUSIVITY.md', 'TEMPLATE.lagda.md', 'VISUALIZATION.md', - ] - if (filename === 'index.md') { - filename = 'docs/HOME.md'; - } else if (filename === 'CONTRIBUTORS.md' || filename === 'MAINTAINERS.md') { - filename = 'CONTRIBUTORS.toml' - } - else if (rootFileList.includes(filename)) { - filename = filename - } - else if (docsFileList.includes(filename)) { - filename = "docs/" + filename - } - else { - const dotIndex = filename.lastIndexOf('.'); - let name = filename.slice(0, dotIndex); - // const extension = filename.slice(dotIndex + 1); - filename = 'src/' + name.replace(/\./g, '/') + '.lagda.md'; - } + ]; if (excludeList.includes(filename)) { // Default to the main GitHub page for excluded pages link.setAttribute('href', 'https://github.com/UniMath/agda-unimath'); } else { + // Generate the correct file path on the repo side + var path = ''; + if (filename === 'index.md') { + path = 'docs/HOME.md'; + } else if (filename === 'CONTRIBUTORS.md' || filename === 'MAINTAINERS.md') { + path = 'CONTRIBUTORS.toml' + } + else if (rootFileList.includes(filename)) { + path = filename + } + else if (docsFileList.includes(filename)) { + path = "docs/" + filename + } + else { + const dotIndex = filename.lastIndexOf('.'); + let name = filename.slice(0, dotIndex); + // const extension = filename.slice(dotIndex + 1); + path = 'src/' + name.replace(/\./g, '/') + '.lagda.md'; + } + const prefixedHref = - 'https://github.com/UniMath/agda-unimath/edit/master/' + filename; + 'https://github.com/UniMath/agda-unimath/edit/master/' + path; link.setAttribute('href', prefixedHref); } } else { From b70bd7092167b158947733a60e71d5ec83305f0b Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 8 Oct 2025 19:11:58 +0200 Subject: [PATCH 96/97] pre-commit --- website/js/custom.js | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/website/js/custom.js b/website/js/custom.js index 2ac1990273..94ce763b82 100644 --- a/website/js/custom.js +++ b/website/js/custom.js @@ -3,14 +3,8 @@ const link = document.querySelector('.href-git-edit-button'); if (link) { // console.log(link); var filename = link.getAttribute('href'); - const excludeList = [ - 'SUMMARY.md', - ]; - const rootFileList = [ - 'CONTRIBUTING.md', - 'LICENSE.md', - 'README.md', - ]; + const excludeList = ['SUMMARY.md']; + const rootFileList = ['CONTRIBUTING.md', 'LICENSE.md', 'README.md']; const docsFileList = [ 'ART.md', 'CITE-THIS-LIBRARY.md', @@ -31,22 +25,21 @@ if (link) { if (excludeList.includes(filename)) { // Default to the main GitHub page for excluded pages link.setAttribute('href', 'https://github.com/UniMath/agda-unimath'); - } - else { + } else { // Generate the correct file path on the repo side var path = ''; if (filename === 'index.md') { path = 'docs/HOME.md'; - } else if (filename === 'CONTRIBUTORS.md' || filename === 'MAINTAINERS.md') { - path = 'CONTRIBUTORS.toml' - } - else if (rootFileList.includes(filename)) { - path = filename - } - else if (docsFileList.includes(filename)) { - path = "docs/" + filename - } - else { + } else if ( + filename === 'CONTRIBUTORS.md' || + filename === 'MAINTAINERS.md' + ) { + path = 'CONTRIBUTORS.toml'; + } else if (rootFileList.includes(filename)) { + path = filename; + } else if (docsFileList.includes(filename)) { + path = 'docs/' + filename; + } else { const dotIndex = filename.lastIndexOf('.'); let name = filename.slice(0, dotIndex); // const extension = filename.slice(dotIndex + 1); From a457f4d60a2f703e76891e4be95d338a28f454ab Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 8 Oct 2025 19:18:30 +0200 Subject: [PATCH 97/97] revert a change --- docs/CODINGSTYLE.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/CODINGSTYLE.md b/docs/CODINGSTYLE.md index e71c06428a..b753b16f31 100644 --- a/docs/CODINGSTYLE.md +++ b/docs/CODINGSTYLE.md @@ -212,7 +212,6 @@ module _ (I : radical-ideal-Commutative-Ring l2 A) {U : UU l3} (J : U → radical-ideal-Commutative-Ring l4 A) where -``` ```` The use of descriptive section headers, coupled with comprehensive markdown