Use the NatSolver for natural numbers
masterNatSolver instead of CommRingSolver. You can find the implementation in Cubical/Algebra/NatSolver and view usage patterns in Cubical/Algebra/NatSolver/Examples.agda.repository·master·Indexed 20 days ago
https://github.com/agda/cubicalA standard library for Cubical Agda providing implementations for univalence and higher inductive types using a variation of cubical type theory. It includes algebraic tools such as the CommRingSolver for commutative rings and NatSolver for natural numbers, as well as comprehensive naming conventions for algebraic operations and structures.
NatSolver instead of CommRingSolver. You can find the implementation in Cubical/Algebra/NatSolver and view usage patterns in Cubical/Algebra/NatSolver/Examples.agda.Cubical Agda implements a variation of cubical type theory. Key theoretical references include:
The CommRingSolver is a tactic used to prove equalities of the form x = y in a commutative ring. The solver follows a three-step approach:
x and y into Expressions (syntax trees) using reflection.For a practical demonstration of how to use the solver, refer to the Examples.agda file in the repository.
To learn how to use the library, you can access several resources:
The Cubical Agda library requires specific versions of Agda to function correctly. For detailed installation instructions, refer to the INSTALL.md file in the repository.
If you are using a specific version of Agda, you should check out the corresponding tag of the cubical library. For example, if you are using Agda v2.6.2.2, you should use version v0.4 of the library.
git checkout v0.4To use the cubical library as a dependency in your own Agda projects, you must register it in your Agda configuration files.
On Linux/Mac, update the following files:
.agda/defaults: Add cubical to the list..agda/libraries: Add the absolute path to the cubical.agda-lib file.# .agda/defaults
cubical
# .agda/libraries
/path/to/cubical.agda-libWhen naming a property of an operation in the Algebra folder, use the name of the operation first, followed by the property name. For example, use +Comm or ·Assoc.
Common abbreviations for properties include:
Assoc: AssociativityComm: CommutativityDist: DistributivityId: Unit laws (identity)Inv: Inverse lawsAbsorb: AbsorptionInvol: InvolutionCancel: CancellationAnnihil: AnnihilationIdem: IdempotencyFor laws with left and right versions, append the suffix L or R.
·Assoc : x · (y · z) ≡ (x · y) · z
·Comm : x · y ≡ y · x
·CommL : x · (y · z) ≡ y · (x · z)
·CommR : (x · y) · z ≡ (x · z) · y
·DistR+ : x · (y + z) ≡ (x · y) + (x · z)
·DistL+ : (x + y) · z ≡ (x · z) + (y · z)
·IdL : 1 · x ≡ x
-Id : (- 0) ≡ 0
+InvL : (- x) + x ≡ 0
∧AbsorbL∨ : x ∧ (x ∨ y) ≡ x
-Invol : - (- x) ≡ x
·CancelL : x · a ≡ x · b → a ≡ b
·AnnihilL : 0 · x ≡ 0
∧Idem : x ∧ x ≡ xTo prevent Agda from interfering with other Haskell packages, you can install it in a local sandbox.
RELEASE tag.cabal sandbox init (or cabal v1-sandbox init if using cabal v2).make to build.agda/.cabal-sandbox/bin) to your $PATH.agda --version and run agda-mode setup for Emacs.git clone https://github.com/agda/agda
cd agda
git checkout RELEASE
cabal sandbox init
cabal update
make
# Add to ~/.bashrc or ~/.bash_profile
export PATH=/path/to/agda/.cabal-sandbox/bin:$PATH
source ~/.bashrc
agda --version
agda-mode setupYou can install Agda using stack by specifying a suitable GHC version via a stack-VERSION.yaml file.
RELEASE tag.stack build --stack-yaml stack-VERSION.yaml.agda/.stack-work/install/.../bin. Add this path to your $PATH.stack install to copy agda and agda-mode to ~/.local/bin.agda --version and run agda-mode setup for Emacs.git clone https://github.com/agda/agda
cd agda
git checkout RELEASE
stack build --stack-yaml stack-VERSION.yaml
# Or to install to ~/.local/bin
stack install
# Add to PATH if using stack build
export PATH=/path/to/agda/.stack-work/install/.../.../.../bin:$PATH
source ~/.bashrc
agda --version
agda-mode setupYou can use Nix flakes to create an environment containing both Agda and the cubical library.
flake.nix using the provided template.nix shell to enter the environment.test.agda file that imports Cubical.Foundations.Prelude and running Agda with the -l cubical flag.# flake.nix
{
inputs.cubical = {
url = "github:agda/cubical";
inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, cubical }:
let
system = "x86_64-linux";
cub-packages = cubical.packages.${system};
cubical-lbry = cub-packages.cubical;
in
with import nixpkgs { system = system; };
rec {
packages.${system} = {
cubical = cubical-lbry;
agda = agda.withPackages [cubical-lbry];
};
defaultPackage.${system} = packages.${system}.agda;
};
}-- test.agda
{-# OPTIONS --cubical #-}
open import Cubical.Foundations.Preludenix --extra-experimental-features "nix-command flakes" shell
agda -l cubical -i . test.agdaTo install the development version of Agda using cabal v2-build, you must have cabal-install version 2.4 or later. This method installs Agda into a mode where projects do not interfere with each other.
RELEASE tag (e.g., v2.6.2.2).cabal v2-install agda agda-mode.$PATH to include ~/.cabal/bin.agda --version.agda-mode setup.cabal v2-update
git clone https://github.com/agda/agda
cd agda
git checkout RELEASE
touch doc/user-manual.pdf
cabal v2-install agda agda-mode
# Add to ~/.bashrc or ~/.bash_profile
export PATH=$HOME/.cabal/bin:$PATH
source ~/.bashrc
agda --version
agda-mode setupFollow these conventions for naming homomorphisms and structure instances:
pres· where · is the operation.UnitGroup or ℤGroup).DirectSum instead of Coproduct).