# phyloToricFP -- Compute the invariants of a group-based phylogenetic tree model using the toric fiber product structure

## Synopsis

• Usage:
I = phyloToricFP(T,M)
I = phyloToricFP(n,E,M)
• Inputs:
• T, an instance of the type LeafTree, A tree
• n, an integer, The number of leaves
• E, an instance of the type LeafTree, The internal edges of the tree, given by one part of the bipartition on leaves
• M, an instance of the type Model, The model (CNFmodel, JCmodel, etc)
• Optional inputs:
• Outputs:
• I, an ideal, The ideal of the generators computed

## Description

This function computes the invariants of a group-based phylogenetic tree model based on theorem 24 of the paper Toric Ideals of Phylogenetic Invariants by Sturmfels and Sullivant.

Invariants are formed in three different ways. The linear and quadratic invariants are computed as in phyloToricLinears and phyloToricQuads respectively. Finally higher degree invariants are built using a fiber product construction from the invariants of claw trees.

In particular, the neighborhood of any internal vertex of a tree is a claw tree. The invariants on this claw tree tree subgraph are extended to invariants on the entire graph in various ways.

 ```i1 : T = leafTree(4, {{0,1}}) o1 = {{0, 1, 2, 3}, {set {0, 1}, set {0}, set {1}, set {2}, set {3}}} o1 : LeafTree``` ```i2 : phyloToricFP(T, CFNmodel) o2 = ideal (- q q + q q , q q - 0,0,1,1 1,1,0,0 0,0,0,0 1,1,1,1 0,0,1,1 1,1,0,0 ------------------------------------------------------------------------ q q , q q - q q , - 0,0,0,0 1,1,1,1 0,0,1,1 1,1,0,0 0,0,0,0 1,1,1,1 ------------------------------------------------------------------------ q q + q q , - q q + 0,0,1,1 1,1,0,0 0,0,0,0 1,1,1,1 0,1,1,0 1,0,0,1 ------------------------------------------------------------------------ q q , q q - q q , q q 0,1,0,1 1,0,1,0 0,1,1,0 1,0,0,1 0,1,0,1 1,0,1,0 0,1,1,0 1,0,0,1 ------------------------------------------------------------------------ - q q , - q q + q q ) 0,1,0,1 1,0,1,0 0,1,1,0 1,0,0,1 0,1,0,1 1,0,1,0 o2 : Ideal of QQ[q , q , q , q , q , q , q , q ] 0,0,0,0 0,0,1,1 0,1,0,1 0,1,1,0 1,0,0,1 1,0,1,0 1,1,0,0 1,1,1,1```