Skip to content

Commit

Permalink
Lattice declaration (#69)
Browse files Browse the repository at this point in the history
* Define separate packages for orders on sets.
* Add definition of lattice and semilattice.
  • Loading branch information
vincentk authored Oct 24, 2024
1 parent 9f1d3e0 commit 150396a
Show file tree
Hide file tree
Showing 58 changed files with 268 additions and 153 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

import com.github.vincentk.dedekind.algebra.numbers.B;
import com.github.vincentk.dedekind.arrays.RandomAccess;
import com.github.vincentk.dedekind.relation.binary.SemiModule;
import com.github.vincentk.dedekind.relation.binary.Transposed;
import com.github.vincentk.dedekind.relation.binary.Bracket.Bra;
import com.github.vincentk.dedekind.sets.Cardinality;
import com.github.vincentk.dedekind.sets.relation.binary.SemiModule;
import com.github.vincentk.dedekind.sets.relation.binary.Transposed;
import com.github.vincentk.dedekind.sets.relation.binary.Bracket.Bra;

public record Booleans
<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
*/
package com.github.vincentk.dedekind.algebra.numbers;

import com.github.vincentk.dedekind.relation.binary.homogeneous.Ring;
import com.github.vincentk.dedekind.sets.Cardinality;
import com.github.vincentk.dedekind.algebra.sets.SemiRings.Booleans;
import com.github.vincentk.dedekind.sets.Set;
import com.github.vincentk.dedekind.sets.ordered.TotallyOrdered;
import com.github.vincentk.dedekind.sets.relation.binary.homogeneous.Ring;

/**
* Boolean values. Roughly speaking 0 <=> false, 1 <=> true.
*/
public interface B extends
Number<B>, Ring<B>,
Set.Finite<B>,
Set.TotallyOrdered<Cardinality.Finite, B>,
TotallyOrdered<Cardinality.Finite, B>,
Booleans {

public boolean bool();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.vincentk.dedekind.algebra.numbers;

import com.github.vincentk.dedekind.relation.binary.homogeneous.Field;
import com.github.vincentk.dedekind.sets.relation.binary.homogeneous.Field;

/**
* The set of complex numbers.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.vincentk.dedekind.algebra.numbers;

import com.github.vincentk.dedekind.relation.binary.homogeneous.Field;
import com.github.vincentk.dedekind.sets.relation.binary.homogeneous.Field;

/**
* The set of dual numbers.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*/
package com.github.vincentk.dedekind.algebra.numbers;

import com.github.vincentk.dedekind.relation.binary.homogeneous.Monoid;
import com.github.vincentk.dedekind.algebra.sets.Fields;
import com.github.vincentk.dedekind.sets.Set;
import com.github.vincentk.dedekind.sets.relation.binary.homogeneous.Monoid;

/**
* @see https://en.wikipedia.org/wiki/Metric_space
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
*/
package com.github.vincentk.dedekind.algebra.numbers;

import com.github.vincentk.dedekind.relation.binary.homogeneous.SemiRing;
import com.github.vincentk.dedekind.sets.Cardinality;
import com.github.vincentk.dedekind.sets.Set;
import com.github.vincentk.dedekind.sets.ordered.TotallyOrdered;
import com.github.vincentk.dedekind.sets.relation.binary.homogeneous.SemiRing;

/**
* The natural numbers.
*/
public interface N
extends
Number<N>,
Set.TotallyOrdered<Cardinality.Finite, N>,
TotallyOrdered<Cardinality.Finite, N>,
Set.Finite<N>,
SemiRing.Natural<N>,
MetricSpace<N, N>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
*/
package com.github.vincentk.dedekind.algebra.numbers;

import com.github.vincentk.dedekind.relation.binary.homogeneous.SemiRing;
import com.github.vincentk.dedekind.sets.Set;
import com.github.vincentk.dedekind.sets.relation.binary.homogeneous.SemiRing;

/**
* In this context, a number is a member of a set with at least
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
*/
package com.github.vincentk.dedekind.algebra.numbers;

import com.github.vincentk.dedekind.relation.binary.homogeneous.Ring;
import com.github.vincentk.dedekind.relation.binary.homogeneous.SemiRing;
import com.github.vincentk.dedekind.sets.Cardinality;
import com.github.vincentk.dedekind.sets.ordered.TotallyOrdered;
import com.github.vincentk.dedekind.algebra.sets.Fields;
import com.github.vincentk.dedekind.sets.Set.TotallyOrdered;
import com.github.vincentk.dedekind.sets.relation.binary.homogeneous.Ring;
import com.github.vincentk.dedekind.sets.relation.binary.homogeneous.SemiRing;

/**
* A specialization of the {@link MetricSpace} to sets of {@link Number} with a total order.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.github.vincentk.dedekind.algebra.numbers;

import com.github.vincentk.dedekind.relation.binary.homogeneous.Equality;
import com.github.vincentk.dedekind.relation.binary.homogeneous.Field;
import com.github.vincentk.dedekind.sets.Cardinality;
import com.github.vincentk.dedekind.sets.relation.binary.homogeneous.Equality;
import com.github.vincentk.dedekind.sets.relation.binary.homogeneous.Field;

/**
* An implementation of rational numbers.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.vincentk.dedekind.algebra.numbers;

import com.github.vincentk.dedekind.relation.binary.homogeneous.Field;
import com.github.vincentk.dedekind.sets.Cardinality;
import com.github.vincentk.dedekind.sets.relation.binary.homogeneous.Field;

/**
* The set of real numbers.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import static java.lang.Long.compare;

import com.github.vincentk.dedekind.relation.binary.homogeneous.Ring;
import com.github.vincentk.dedekind.sets.Cardinality;
import com.github.vincentk.dedekind.sets.relation.binary.homogeneous.Ring;

/**
* The integer numbers.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.vincentk.dedekind.algebra.peano;

import com.github.vincentk.dedekind.relation.binary.homogeneous.SemiRing.Natural;
import com.github.vincentk.dedekind.sets.Cardinality;
import com.github.vincentk.dedekind.sets.relation.binary.homogeneous.SemiRing.Natural;

/**
* Implementation of Peano Numbers / Axioms.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.github.vincentk.dedekind.bilinear;

import com.github.vincentk.dedekind.linear.matrix.Matrix;
import com.github.vincentk.dedekind.relation.binary.Bracket.Bra;
import com.github.vincentk.dedekind.relation.binary.Bracket.Ket;
import com.github.vincentk.dedekind.relation.binary.homogeneous.SemiRing;
import com.github.vincentk.dedekind.sets.relation.binary.Bracket.Bra;
import com.github.vincentk.dedekind.sets.relation.binary.Bracket.Ket;
import com.github.vincentk.dedekind.sets.relation.binary.homogeneous.SemiRing;

/**
* Outer product / tensor product implementation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.Optional;

import com.github.vincentk.dedekind.relation.binary.Pair;
import com.github.vincentk.dedekind.sets.relation.binary.Pair;

@FunctionalInterface
public interface Enumeration<T, E extends Enumeration<T, E>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package com.github.vincentk.dedekind.families;

import com.github.vincentk.dedekind.sets.Cardinality;
import com.github.vincentk.dedekind.sets.Set;
import com.github.vincentk.dedekind.sets.ordered.Directed;

/**
* @see https://en.wikipedia.org/wiki/Net_(mathematics)
Expand All @@ -13,7 +13,7 @@
public interface Net<
T,
C extends Cardinality.Countable,
D extends Set.Directed<C, D>
D extends Directed<C, D>
>
{
T at(D d);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.github.vincentk.dedekind.algebra.numbers.N;
import com.github.vincentk.dedekind.algebra.sets.SemiRings;
import com.github.vincentk.dedekind.sets.Set;
import com.github.vincentk.dedekind.sets.ordered.Directed;

/**
* @see https://en.wikipedia.org/wiki/Sequence
Expand All @@ -15,7 +16,7 @@
public interface Sequence<
T,
C extends Cardinality.Countable,
D extends Set.Countable<C, D> & Set.Directed<C, D> & SemiRings.Naturals
D extends Set.Countable<C, D> & Directed<C, D> & SemiRings.Naturals
>
extends Net<T, C, D>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
import java.util.List;
import java.util.stream.Collectors;

import com.github.vincentk.dedekind.relation.binary.Pair;
import com.github.vincentk.dedekind.relation.binary.SemiModule;
import com.github.vincentk.dedekind.relation.binary.homogeneous.SemiRing;
import com.github.vincentk.dedekind.sets.Cardinality;
import com.github.vincentk.dedekind.algebra.numbers.B;
import com.github.vincentk.dedekind.algebra.numbers.N;
import com.github.vincentk.dedekind.algebra.numbers.Number;
import com.github.vincentk.dedekind.algebra.sets.SemiRings;
import com.github.vincentk.dedekind.sets.Set;
import com.github.vincentk.dedekind.sets.ordered.Directed;
import com.github.vincentk.dedekind.sets.relation.binary.Pair;
import com.github.vincentk.dedekind.sets.relation.binary.SemiModule;
import com.github.vincentk.dedekind.sets.relation.binary.homogeneous.SemiRing;

/**
* Tuple ~ a finite sequence of number-like things.
Expand All @@ -22,7 +23,7 @@
*/
public interface Tuple<
T extends Number<T>,
D extends Set.Finite<D> & Set.Directed<Cardinality.Finite, D> & SemiRings.Naturals,
D extends Set.Finite<D> & Directed<Cardinality.Finite, D> & SemiRings.Naturals,
I extends Tuple<T, D, I>
>
extends
Expand All @@ -33,7 +34,7 @@ public interface Tuple<

public interface Tuple2<
T extends Number<T>,
D extends Set.Finite<D> & Set.Directed<Cardinality.Finite, D> & SemiRings.Booleans
D extends Set.Finite<D> & Directed<Cardinality.Finite, D> & SemiRings.Booleans
>
extends
Tuple<T, D, Tuple2<T, D>>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*/
package com.github.vincentk.dedekind.linear;

import com.github.vincentk.dedekind.relation.binary.Vector;
import com.github.vincentk.dedekind.relation.binary.homogeneous.Field;
import com.github.vincentk.dedekind.sets.Cardinality;
import com.github.vincentk.dedekind.sets.relation.binary.Vector;
import com.github.vincentk.dedekind.sets.relation.binary.homogeneous.Field;

/**
* An appropriate way to model the notion of a basis would appear to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*/
package com.github.vincentk.dedekind.linear;

import com.github.vincentk.dedekind.relation.binary.Vector;
import com.github.vincentk.dedekind.relation.binary.homogeneous.Field;
import com.github.vincentk.dedekind.sets.Cardinality;
import com.github.vincentk.dedekind.sets.relation.binary.Vector;
import com.github.vincentk.dedekind.sets.relation.binary.homogeneous.Field;

/**
* @https://en.wikipedia.org/wiki/Vector_space#Function_spaces
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import java.util.function.Function;

import com.github.vincentk.dedekind.relation.binary.SemiModule;
import com.github.vincentk.dedekind.relation.binary.Bracket.Ket;
import com.github.vincentk.dedekind.relation.binary.homogeneous.SemiRing;
import com.github.vincentk.dedekind.sets.relation.binary.SemiModule;
import com.github.vincentk.dedekind.sets.relation.binary.Bracket.Ket;
import com.github.vincentk.dedekind.sets.relation.binary.homogeneous.SemiRing;

/**
* @see https://en.wikipedia.org/wiki/Linear_map
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import com.github.vincentk.dedekind.algebra.peano.Peano.Succ;
import com.github.vincentk.dedekind.algebra.peano.Peano.Zero;
import com.github.vincentk.dedekind.relation.binary.Module;
import com.github.vincentk.dedekind.relation.binary.Transposed;
import com.github.vincentk.dedekind.relation.binary.Bracket.Bra;
import com.github.vincentk.dedekind.relation.binary.homogeneous.Ring;
import com.github.vincentk.dedekind.sets.relation.binary.Module;
import com.github.vincentk.dedekind.sets.relation.binary.Transposed;
import com.github.vincentk.dedekind.sets.relation.binary.Bracket.Bra;
import com.github.vincentk.dedekind.sets.relation.binary.homogeneous.Ring;

/**
* Vector with just one element.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import com.github.vincentk.dedekind.algebra.peano.Peano.Succ;
import com.github.vincentk.dedekind.algebra.peano.Peano.Zero;
import com.github.vincentk.dedekind.relation.binary.Bracket.Bra;
import com.github.vincentk.dedekind.relation.binary.Module;
import com.github.vincentk.dedekind.relation.binary.Pair;
import com.github.vincentk.dedekind.relation.binary.Transposed;
import com.github.vincentk.dedekind.relation.binary.homogeneous.Ring;
import com.github.vincentk.dedekind.sets.relation.binary.Module;
import com.github.vincentk.dedekind.sets.relation.binary.Pair;
import com.github.vincentk.dedekind.sets.relation.binary.Transposed;
import com.github.vincentk.dedekind.sets.relation.binary.Bracket.Bra;
import com.github.vincentk.dedekind.sets.relation.binary.homogeneous.Ring;

/**
* Vector with exactly two elements.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import java.util.function.Function;

import com.github.vincentk.dedekind.linear.LinearMap;
import com.github.vincentk.dedekind.relation.binary.Dual;
import com.github.vincentk.dedekind.relation.binary.Bracket.Bra;
import com.github.vincentk.dedekind.relation.binary.Bracket.Ket;
import com.github.vincentk.dedekind.relation.binary.homogeneous.SemiRing;
import com.github.vincentk.dedekind.sets.relation.binary.Dual;
import com.github.vincentk.dedekind.sets.relation.binary.Bracket.Bra;
import com.github.vincentk.dedekind.sets.relation.binary.Bracket.Ket;
import com.github.vincentk.dedekind.sets.relation.binary.homogeneous.SemiRing;

/**
* @see https://en.wikipedia.org/wiki/Matrix_(mathematics)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.vincentk.dedekind.linear.matrix;

import com.github.vincentk.dedekind.relation.binary.Bracket.Ket;
import com.github.vincentk.dedekind.relation.binary.homogeneous.SemiRing;
import com.github.vincentk.dedekind.sets.relation.binary.Bracket.Ket;
import com.github.vincentk.dedekind.sets.relation.binary.homogeneous.SemiRing;

/**
* A lazy / symbolic implementation of matrix addition.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.vincentk.dedekind.linear.matrix;

import com.github.vincentk.dedekind.relation.binary.Bracket.Ket;
import com.github.vincentk.dedekind.relation.binary.homogeneous.SemiRing;
import com.github.vincentk.dedekind.sets.relation.binary.Bracket.Ket;
import com.github.vincentk.dedekind.sets.relation.binary.homogeneous.SemiRing;

/**
* A lazy / symbolic implementation of matrix multiplication.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.github.vincentk.dedekind.linear.matrix;

import com.github.vincentk.dedekind.linear.finite.One;
import com.github.vincentk.dedekind.relation.binary.Transposed;
import com.github.vincentk.dedekind.relation.binary.homogeneous.Ring;
import com.github.vincentk.dedekind.sets.relation.binary.Transposed;
import com.github.vincentk.dedekind.sets.relation.binary.homogeneous.Ring;

/**
* 1 x 1 matrix.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
*/
package com.github.vincentk.dedekind.linear.matrix;

import com.github.vincentk.dedekind.relation.binary.Bracket.Ket;
import com.github.vincentk.dedekind.relation.binary.homogeneous.SemiRing;
import com.github.vincentk.dedekind.sets.relation.binary.Bracket.Ket;
import com.github.vincentk.dedekind.sets.relation.binary.homogeneous.SemiRing;

/**
* A square matrix domain and range are essentially the same.
Expand Down
Loading

0 comments on commit 150396a

Please sign in to comment.