# BettiTally -- the class of all Betti tallies

## Description

A Betti tally is a special type of Tally that is printed as a display of graded Betti numbers. The class was created so the function betti could return something that both prints nicely and from which information can be extracted. The keys are triples (i,d,h), where i is the homological degree, d is a list of integers giving a multidegree, and h is the result of applying a weight covector to d. Only i and h are used in printing.
 ```i1 : t = new BettiTally from { (0,{0},0) => 1, (1,{1},1) => 2, (2,{3},3) => 3, (2,{4},4) => 4 } 0 1 2 o1 = total: 1 2 7 0: 1 2 . 1: . . 3 2: . . 4 o1 : BettiTally``` ```i2 : peek oo o2 = BettiTally{(0, {0}, 0) => 1} (1, {1}, 1) => 2 (2, {3}, 3) => 3 (2, {4}, 4) => 4```
For convenience, the operations of direct sum (++), tensor product (**), codim, degree, dual, hilbertPolynomial, hilbertSeries, pdim, poincare, regularity, and degree shifting (numbers in brackets or parentheses), have been implemented for Betti tallies. These operations mimic the corresponding operations on chain complexes.
 ```i3 : t(5) 0 1 2 o3 = total: 1 2 7 -5: 1 2 . -4: . . 3 -3: . . 4 o3 : BettiTally``` ```i4 : t[-5] 5 6 7 o4 = total: 1 2 7 -5: 1 2 . -4: . . 3 -3: . . 4 o4 : BettiTally``` ```i5 : t ++ oo 0 1 2 3 4 5 6 7 o5 = total: 1 2 7 . . 1 2 7 -5: . . . . . 1 2 . -4: . . . . . . . 3 -3: . . . . . . . 4 -2: . . . . . . . . -1: . . . . . . . . 0: 1 2 . . . . . . 1: . . 3 . . . . . 2: . . 4 . . . . . o5 : BettiTally``` ```i6 : t ** t 0 1 2 3 4 o6 = total: 1 4 18 28 49 0: 1 4 4 . . 1: . . 6 12 . 2: . . 8 16 9 3: . . . . 24 4: . . . . 16 o6 : BettiTally``` ```i7 : dual t -2 -1 0 o7 = total: 7 2 1 -2: 4 . . -1: 3 . . 0: . 2 1 o7 : BettiTally``` ```i8 : regularity t o8 = 2```
A Betti tally can be multiplied by an integer or by a rational number, and the values can be lifted to integers, when possible.
 ```i9 : (1/2) * t 0 1 2 o9 = total: 1/2 1 7/2 0: 1/2 1 . 1: . . 3/2 2: . . 2 o9 : BettiTally``` ```i10 : 2 * oo 0 1 2 o10 = total: 1 2 7 0: 1 2 . 1: . . 3 2: . . 4 o10 : BettiTally``` ```i11 : lift(oo,ZZ) 0 1 2 o11 = total: 1 2 7 0: 1 2 . 1: . . 3 2: . . 4 o11 : BettiTally```
Various combinations of the degree vectors can be displayed by using betti(BettiTally).

## Functions and methods returning a Betti tally :

• betti -- display degrees

## Methods that use a Betti tally :

• BettiTally == BettiTally, see == -- equality
• betti(BettiTally) -- view and set the weights of a betti display
• BettiTally ** BettiTally
• BettiTally ++ BettiTally
• BettiTally Array
• BettiTally ZZ
• codim(BettiTally)
• degree(BettiTally)
• dual(BettiTally)
• hilbertPolynomial(ZZ,BettiTally)
• hilbertSeries(ZZ,BettiTally)
• lift(BettiTally,type of ZZ)
• pdim(BettiTally)
• poincare(BettiTally)
• QQ * BettiTally
• regularity(BettiTally)
• ZZ * BettiTally
• decompose(BettiTally) (missing documentation) -- write a Betti diagram as a positive combination of pure integral diagrams
• matrix(BettiTally) (missing documentation) -- Betti diagram to matrix
• matrix(BettiTally,ZZ) (missing documentation) -- Betti diagram to matrix
• matrix(BettiTally,ZZ,ZZ) (missing documentation) -- Betti diagram to matrix

## For the programmer

The object BettiTally is a type, with ancestor classes VirtualTally < Tally < HashTable < Thing.