-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Types and functions to work with braids and Khovanov homology. -- -- A library to work with braids and Khovanov homology. The -- main focus of the package is computing (the braid invariant -- kappa)[http:/arxiv.orgabs1507.06263] defined by (the package -- author)[adamsaltz.com] and (Diana -- Hubbard)[https:sites.google.comsitedianadhubbard]. -- Braids are encoded by their indexwidth and a word in the standard -- [Artin -- generators](https:en.wikipedia.orgwiki/Braid_group#Generators_and_relations). -- To represent the 4-strand braid sigma_1sigma_2sigma^(-1)_3 use -- --
--   Braid [1,2,-3] 4
--   
-- -- The function computeKappa in the module Kappa returns -- 'Just kappa' if kappa is finite and Nothing otherwise. More -- helper functions for working with Khovanov homology and reduced -- Khovanov homology will be included soon. -- -- The module Braiddiagrams creates diagrams for braids, their -- closures, and their resolutions. E.g. to dra -- -- The executable KappaView draws the pre-images of the -- (transverse invariant -- psi)[http:/arxiv.orgabsmath0412184] with lowest -- k-grading. The minus-labeled components are indicated by dots. @package braid @version 0.1.0.0 module Util deleteAt :: Int -> [a] -> [a] maybeTuple :: Maybe (a, b) -> (Maybe a, Maybe b) compose :: [(a -> a)] -> (a -> a) graph :: (a -> b) -> a -> (a, b) isNotASubsetOf :: Ord k => Set k -> Set k -> Bool getSubmap :: (Ord k, Foldable f) => Map k a -> f k -> Map k a deleteKeys :: (Ord k, Foldable f) => Map k a -> f k -> Map k a cartesian :: [a] -> [b] -> [(a, b)] exp :: Monoid a => a -> Int -> a -- | Longer description to come. module Braids -- | A Braid is a width and word. Integers in the word represent -- Artin generators and their invereses. E.g. [1,3,-2] -- represents the word sigma_1sigma_3sigma_2^{-1}. data Braid Braid :: Int -> [Int] -> Braid [braidWidth] :: Braid -> Int [braidWord] :: Braid -> [Int] -- | A braid can also be written as a collection of Nodes. See -- knotatlas for more info on Cross and Join. data Node a Cross :: a -> a -> a -> a -> Node a Join :: a -> a -> Node a -- | A Resolution is a collection of integers. These should all be 0 -- or 1. At some point I will change this to type Resolution = -- [Resolution'] and data Resolution' = One | Zero deriving -- (Show, Eq, Ord) or somesuch. type Resolution = [Int] -- | A Component is represented by a set of integer labels for its -- arcs. type Component = Set Int -- | A resolved BDiagram has a Resolution and a set of -- Components. data BDiagram BDiagram :: Resolution -> Set Component -> BDiagram [resolution'] :: BDiagram -> Resolution [components'] :: BDiagram -> Set Component -- | Turn a Braid into a PD. braidToPD :: Braid -> PD -- | Turn a crossing into a Node. crossingToNodes :: Int -> Int -> Int -> [Node Int] -- | Take a PD and a Resolution and returns the resolved -- PD. Note that the output is always a list of Joins. resolve :: PD -> Resolution -> PD -- | Compute all resolutions of a PD. resolutions :: PD -> [PD] -- | This is the only use for Data.Graph. resolutionToComponents :: PD -> Set Component -- | Take a PD and returns a list of all the BDiagrams of its -- Resolutions. cubeOfResolutions :: PD -> [BDiagram] -- | The total cube of resolutions for a braid. braidCube :: Braid -> [BDiagram] -- | Returns the mirror of b. mirror :: Braid -> Braid -- | Utility function to return all the resolutions of a planar diagram. -- This amounts to all sequences of 0s and 1s of some length. allRes :: PD -> [Resolution] instance GHC.Show.Show Braids.BDiagram instance GHC.Classes.Eq Braids.BDiagram instance GHC.Classes.Eq a => GHC.Classes.Eq (Braids.Node a) instance Data.Foldable.Foldable Braids.Node instance GHC.Classes.Ord a => GHC.Classes.Ord (Braids.Node a) instance GHC.Read.Read a => GHC.Read.Read (Braids.Node a) instance GHC.Show.Show a => GHC.Show.Show (Braids.Node a) instance GHC.Read.Read Braids.Braid instance GHC.Show.Show Braids.Braid instance GHC.Classes.Eq Braids.Braid module ExampleBraids -- | Construct a family of braids from and Khandawit's paper -- http://www.math.duke.edu/~ng/math/papers/nonsimple.pdf. This will -- fail if either input is negative. ngkLeft :: (Int, Int) -> Braid ngkRight :: (Int, Int) -> Braid -- | Longer description to come. module Complex -- | A Generator is a Set of Components labled with -- Signs. Strictly speaking, we could make do without components, -- as components = Data.Set.fromList . Data.Map.keys $ signs. -- kgrade depends totally on signs, so it should be taken out too. data Generator Generator :: Resolution -> Set Component -> Map Component Sign -> Int -> Generator [resolution] :: Generator -> Resolution [components] :: Generator -> Set Component [signs] :: Generator -> Map Component Sign [kgrade] :: Generator -> Int -- | These stand for v_+ and v_- in Khovanov homology. We could include -- some more algebra here, but | for now I don't see a reason to. data Sign Plus :: Sign Minus :: Sign signToNum :: Sign -> Int -- | Stands for sums of generators modulo 2. wrapGen wraps a single -- generator. | Should be a type synonym instead? | This is something -- like an implementation of mod 2 vector spaces. Could this be done -- better with vector-spaces or linear? newtype AlgGen AlgGen :: (Set Generator) -> AlgGen wrapGen :: Generator -> AlgGen toSet :: AlgGen -> Set Generator -- | Morphisms is a map from (a linear combination of) -- Generators to a set of (linear combinations of) -- Generators. type Morphisms = Map AlgGen (Set AlgGen) -- | The next three functions implement mod 2 addition at the level of -- Sets and Maps. addMod2 :: (Eq a, Ord a) => a -> Set a -> Set a addMod2Set :: (Eq a, Ord a) => Set a -> Set a -> Set a addMod2Map :: (Ord a, Ord k) => Map k (Set a) -> Map k (Set a) -> Map k (Set a) -- | Adds a x to the key key (but only if key is a key of mors). addToKey :: (Ord k, Monoid k, Monoid a) => k -> k -> Map k a -> Map k a -- | Generates all arrows from elements of s to elements of -- s' with the latter wrapped as singleton Sets. This is -- purely algebraic -- the function doesn't check if their ought to be -- any such arrows. fromTo :: Set AlgGen -> Set AlgGen -> [(AlgGen, Set AlgGen)] instance GHC.Classes.Eq Complex.AlgGen instance GHC.Classes.Ord Complex.AlgGen instance GHC.Show.Show Complex.AlgGen instance GHC.Show.Show Complex.Generator instance GHC.Classes.Ord Complex.Generator instance GHC.Classes.Eq Complex.Generator instance GHC.Classes.Ord Complex.Sign instance GHC.Show.Show Complex.Sign instance GHC.Classes.Eq Complex.Sign instance GHC.Base.Monoid Complex.AlgGen -- | Longer description to come. module Kh -- | Return the diagram underlying a Generator. gToD :: Generator -> BDiagram -- | Compute the homological grading of a Generator. homGrading :: Generator -> Int -- | Compute the q-grading of a Generator. In this convention, the -- Khovanov differential *lowers* the q-grading by 1. qGrading :: Generator -> Int -- | Data type to represent whether a circle is trivial or not. Used to be -- Bool' but I got confused about which was True and which was -- False. data Triviality Trivial :: Triviality NonTrivial :: Triviality -- | Determine if a component is non-trivial. To compute the mod 2 winding -- number about the braid axis, check how many of the 'top arcs' live in -- a component. nonTrivialCircle :: Int -> Component -> Triviality -- | Compute the k-grading of a Generator. kGrading :: (Resolution, Set Component, Map Component Sign) -> Int -> Int -- | "Apply the filtered Khovanov functor to a diagram." We still need the -- braid width as input to get the k-grading. khovanov :: Int -> BDiagram -> [Generator] -- | The next three functions apply the Khovanov functor to the vertices of -- a cube of resolutions. khovanovComplex :: Int -> [BDiagram] -> Map Int (Set Generator) -- | An elementary morphism is determined by Components. We -- distinguish between Merge and Split ElMos data ElMo -- | merges the first set to the second Merge :: (Set Component) -> (Set Component) -> ElMo -- | splits the first set into the second Split :: (Set Component) -> (Set Component) -> ElMo -- | Take two diagrams and returns the ElMos between them, if there -- is one. whichMorphism :: BDiagram -> BDiagram -> Maybe ElMo -- | Take a morphism and two generators and returns True if there -- should be a 'Morphism from one to the other. morphismAction :: Maybe ElMo -> Generator -> Generator -> Bool -- | Compute the difference in k-grading between two Generators. kDrop :: Generator -> Generator -> Int -- | Compute the filtration level of an AlgGen. kgrade' :: AlgGen -> Int kDrop' :: AlgGen -> AlgGen -> Int -- | Like morphismAction, but only connects two Generators -- if the drop in k-grading from one to the other is less than or equal -- to a. filteredMorphismAction :: Int -> Maybe ElMo -> Generator -> Generator -> Bool -- | Return Morphisms from the Generator into the set with -- kDrop less than or equal to k. filteredMorphismsFrom :: Int -> Generator -> Set Generator -> Morphisms -- | Applies filteredMorphismsFrom to every Generator in a -- list into the same list. filteredComplexLevel :: Int -> Map Int (Set Generator) -> Int -> Morphisms -- | Produces the Generator corresponding to the transverse -- invariant of a braid. psi :: Braid -> Generator -- | Produces the portion of the cube of resolutions of a braid which is -- relevant for computing kappa. This means only using resolutions whose -- weights are less than or equal to psi's. Note that this only uses the -- homological grading of psi, so we don't need a separate function for -- the quotient. psiCube :: Braid -> [BDiagram] instance GHC.Show.Show Kh.ElMo instance GHC.Show.Show Kh.Triviality instance GHC.Classes.Eq Kh.Triviality instance GHC.Classes.Ord Kh.Triviality -- | Longer description to come. module Cancellation -- | Compute all morphisms which change the k-grading by less than k. kFilteredMorphisms :: Int -> Morphisms -> Morphisms -- | Compute all Generators which map to psi'. whoHasPsi :: AlgGen -> Morphisms -> Set AlgGen -- | Compute all Generators which map to psi' with kDrop less -- than k. (I've tried to stick to this pattern throughout: the k-version -- of a function just filters by kDrop.) kWhoHasPsi :: Int -> AlgGen -> Morphisms -> Set AlgGen -- | Determine which generators have single arrows to psi'. psiKillers :: AlgGen -> Morphisms -> Set AlgGen -- | Same as psiKillers but only checks for arrows which shift the -- filtration by k or less. kPsiKillers :: Int -> AlgGen -> Morphisms -> Set AlgGen -- | Cancel g in mors while dodging psi'. cancelKey :: AlgGen -> Morphisms -> AlgGen -> Morphisms -- | Simplify the complex at filtration k while dodging psi' Uses the -- Writer monad to keep track of what's canceled (but that information -- isn't used, presently) kSimplify :: Int -> AlgGen -> Morphisms -> Morphisms -- | Simplify the complex up to filtration k while dodging psi'. kSimplifyComplex :: Int -> AlgGen -> Morphisms -> Morphisms -- | Test whether psi' dies at filtration k. kDoesPsiVanish :: Int -> AlgGen -> Morphisms -> Bool -- | Longer description to come. module Kappa -- | Return (Maybe kappa, Maybe the simplified complex). computeKappa' :: Braid -> Maybe (Int, Morphisms) -- | Returns Just kappa if kappa is finite. Otherwise, returns -- Nothing. computeKappa :: Braid -> Maybe Int -- | Longer description to come. module Parse -- | Parse command line input into a braid. | e.g. @Parse "[1,2,-2,-3] 4" -- == Braid [1,2,-2,-3] 4f parse :: [String] -> Braid -- | Prints kappa in a nice way. showKappa' :: Maybe (Int, Morphisms) -> [String] -- | Prints Morphisms nicely. showMorphisms :: Morphisms -> [String] -- | Prints a single morphism nicely. showMorphism :: (AlgGen, Set AlgGen) -> (String, Int) -- | Longer description to come. module Braiddiagrams type ArcLabel = Int type Height = Int type BraidIndex = Int type ArtinGen = Int -- | A newtype wrapper for Node to create an IsName -- instance. newtype NameNode NameNode :: (Node ArcLabel) -> NameNode -- | The identity braid of index index. identity :: BraidIndex -> Diagram B -- | The identity braid of index index with arc names starting at -- lastlabel + 1. identityAt :: BraidIndex -> ArcLabel -> Diagram B -- | A negative crossing. negativeCrossing :: Diagram B -- | Draws a positive crossing. positiveCrossing :: Diagram B -- | A cup-cap combo. cupCap :: Diagram B -- | A cup-cap combo with names starting at lastLabel + 1. cupCapLevelAt :: BraidIndex -> ArcLabel -> ArtinGen -> Diagram B -- | The kth Artin generator of the braid group on n -- strands. To draw the inverse of the kth generator, use -- -k. artin :: BraidIndex -> ArtinGen -> Diagram B -- | Draws a braid. drawBraid :: Braid -> Diagram B -- | Draws a braid closure. drawBraidClosure :: Braid -> Diagram B -- | Draws the r resolution of the kth Artin generator in -- the n strand braid group. To draw the inverse of the -- kth generator, use -k. resolutionD :: Int -> BraidIndex -> ArtinGen -> Diagram B -- | Draws the r resolution of the kth Artin generator in -- the n strand braid group with names starting at lastLabel -- + 1. To draw the inverse of the kth generator, use -- -k. resolutionAt :: Int -> BraidIndex -> ArtinGen -> Height -> Diagram B -- | Draws the braid b resolved according to rs. resolveD :: Resolution -> Braid -> Diagram B -- | Draws the closure of the braid b resolved according to -- rs. resolveClosureD :: Resolution -> Braid -> Diagram B -- | A Map from Resolutions to a diagram of the -- corresponding resolution of the braid b. cubeOfResolutionsD :: Braid -> Map Resolution (Diagram B) -- | A Map from Resolutions to a diagram of the -- corresponding resolution of the closure of the braid b. cubeOfResolutionsClosureD :: Braid -> Map Resolution (Diagram B) -- | Prints Maps like the output of cubeOfResolutionsD and -- `cubeOfResolutionsClosureD.` printCube :: Map [Int] (Diagram B) -> Diagram B -- | Diagrams for an AlgGen indexed by their resolutions. bigGeneratorD :: Braid -> AlgGen -> Map [Int] (Diagram B) -- | Diagram for a single Generator -- mostly exists to be called by -- bigGeneratorD. generatorD :: Braid -> Generator -> Diagram B -- | Marks a component of diagram. markIn :: Diagram B -> Component -> Sign -> (Diagram B -> Diagram B) instance GHC.Show.Show Braiddiagrams.NameNode instance GHC.Classes.Eq Braiddiagrams.NameNode instance GHC.Classes.Ord Braiddiagrams.NameNode instance Diagrams.Core.Names.IsName Braiddiagrams.NameNode