<jupyter_start><jupyter_text>Sylvester.AbstractAlgebraThe Sylvester abstract algebra library contains types and operations for rigorously defining abstract algebra structures and concepts. The F language is both functional and object-oriented with infinite sequences as first-class objects, which make it really great at representing mathematical structures like groups which have natural inheritance relations, as well as infinite sequences of objects like the natural numbers and other enumerable sets. The language features of F together with Sylvester types allow the user to write mathematical expressions that are very close to what you will find in print.  Morphisms<jupyter_code>open System 
open System.Linq
open Sylvester
open Sylvester.Arithmetic
// Define a custom symbol type S with a (+) operator and zero
// We could just also use plain strings
type S = S of string with
    static member (+) (S l, S r) = S (l + r)
    static member Zero = S ""

// Define an infinite sequence of S strings
let Sym = infiniteSeq ofType<S> ((+) 65 >> Char.ConvertFromUtf32 >> S)
Sym
// Define a monoid using our set and + operator and zero element
let L = Monoid(Sym, (+), S.Zero)
L
// Create 2 S values
let a, b = S "Nancy", S "Drew"
a + b
// Create an L morphism using the PadLeft string function
let Pad = Morph(L, fun l -> let (S s) = l in S(s.PadLeft 20))
let pad = Pad.Map
pad a
// Is pad a homomorphism?
pad a + pad b
pad (a + b)
pad a + pad b = pad (a + b)
let s1 = seq{1..6} |> Seq
let s2 = Seq [5] 
let c = s1 |-| s2

c.Powerset.Length
Nz<jupyter_output><empty_output><jupyter_text>Lattices<jupyter_code>let c1 = infiniteSeq (fun x -> x % 2 = 0) (fun n -> n * 2)
c1
let dice = seq {1..6} |> Seq
let outcomes = dice * dice
outcomes
dice.Powerset
let setal = SetAlgebra(dice)
setal.Set.Length
Z.Set.Prod
Z.Set.Prod |>| fun (x,y) -> x > 16 && x % 2 = 0 && y % 3 = 0<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09368421052631579, 'fraction_numerical': 0.014210526315789474, 'mean_word_length': 3.886889460154242, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '509904', 'license': 'MIT', 'n_tokens_mistral': 631, 'n_tokens_neox': 596, 'n_words': 275, 'path': 'examples/math/Abstract Algebra.ipynb', 'repo_name': 'gitter-badger/bob2021', 'size': '1900'}