-- Copyright (c) 2008, David Amos. All rights reserved.


-- |A module for constructing and working with combinatorial designs.

--

-- Given integers t \< k \< v and lambda > 0, a t-design or t-(v,k,lambda) design is an incidence structure of points X and blocks B,

-- where X is a set of v points, B is a collection of k-subsets of X, with the property that any t points are contained

-- in exactly lambda blocks. If lambda = 1 and t >= 2, then a t-design is also called a Steiner system S(t,k,v).

--

-- Many designs are highly symmetric structures, having large automorphism groups. In particular, the Mathieu groups,

-- which were the first discovered sporadic finite simple groups, turn up as the automorphism groups of the Witt designs.

module Math.Combinatorics.Design where

import Data.Maybe (fromJust, isJust)
import qualified Data.List as L
import qualified Data.Map as M
import qualified Data.Set as S

import Math.Common.ListSet (intersect, symDiff)
import Math.Core.Utils (combinationsOf)

import Math.Algebra.Field.Base
import Math.Algebra.Field.Extension
import Math.Algebra.Group.PermutationGroup hiding (elts, order, isMember)
import Math.Algebra.Group.SchreierSims as SS
import Math.Combinatorics.Graph as G hiding (to1n, incidenceMatrix)
import Math.Combinatorics.GraphAuts (graphAuts, incidenceAuts) -- , removeGens)

import Math.Combinatorics.FiniteGeometry

-- Cameron & van Lint, Designs, Graphs, Codes and their Links



{-
set xs = map head $ group $ sort xs
-}
isSubset :: t a -> t a -> Bool
isSubset xs :: t a
xs ys :: t a
ys = (a -> Bool) -> t a -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all (a -> t a -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` t a
ys) t a
xs


-- DESIGNS


data Design a = D [a] [[a]] deriving (Design a -> Design a -> Bool
(Design a -> Design a -> Bool)
-> (Design a -> Design a -> Bool) -> Eq (Design a)
forall a. Eq a => Design a -> Design a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Design a -> Design a -> Bool
$c/= :: forall a. Eq a => Design a -> Design a -> Bool
== :: Design a -> Design a -> Bool
$c== :: forall a. Eq a => Design a -> Design a -> Bool
Eq,Eq (Design a)
Eq (Design a) =>
(Design a -> Design a -> Ordering)
-> (Design a -> Design a -> Bool)
-> (Design a -> Design a -> Bool)
-> (Design a -> Design a -> Bool)
-> (Design a -> Design a -> Bool)
-> (Design a -> Design a -> Design a)
-> (Design a -> Design a -> Design a)
-> Ord (Design a)
Design a -> Design a -> Bool
Design a -> Design a -> Ordering
Design a -> Design a -> Design a
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall a. Ord a => Eq (Design a)
forall a. Ord a => Design a -> Design a -> Bool
forall a. Ord a => Design a -> Design a -> Ordering
forall a. Ord a => Design a -> Design a -> Design a
min :: Design a -> Design a -> Design a
$cmin :: forall a. Ord a => Design a -> Design a -> Design a
max :: Design a -> Design a -> Design a
$cmax :: forall a. Ord a => Design a -> Design a -> Design a
>= :: Design a -> Design a -> Bool
$c>= :: forall a. Ord a => Design a -> Design a -> Bool
> :: Design a -> Design a -> Bool
$c> :: forall a. Ord a => Design a -> Design a -> Bool
<= :: Design a -> Design a -> Bool
$c<= :: forall a. Ord a => Design a -> Design a -> Bool
< :: Design a -> Design a -> Bool
$c< :: forall a. Ord a => Design a -> Design a -> Bool
compare :: Design a -> Design a -> Ordering
$ccompare :: forall a. Ord a => Design a -> Design a -> Ordering
$cp1Ord :: forall a. Ord a => Eq (Design a)
Ord,Int -> Design a ->"local-6QOC586621679255158">)  a  

Methods

Vect k Mat2' -> k Source VectMat2' -ink">SoGroupAlgebra">Group4">Group4">Ord a<(0an class="hs-special">) a = Group4">Ord a<*3pan><(0an class="hs-speypecial">, aan>vs :: [v] = NSym -> m NSym forall (m :: * -> *) a. Monad m => a -> m a return . (SymH -> Vect k ()) -> Vect k SymH -> Vect k () forall k b a. (Eq k, k SymH -> Vect k () forall k b a. (Eq k, k SymH -> Vect k () forall k b a. (Eq k, k SymH -> Vect k () forall k b a. (Eq k, k SymH -> Vect k () forall k b a-var hs-vunnottext">[([a], [a])] -> [([a], [a])] -> [([a], [a])] reduce k = (<_pan class="annottext">OBas_t"><_pan class="annottext">OBas_t"><_pan class="annottext">OBas_t"><_pan class="annottext">OBas_t"><_pan class="annottext">OBas_t"><_pan class="annottext">OBas_t"><_pan class="annottext">OBas_t"><_pan class="annottext">OBas_t"> OBas_t"><_pan class="annottext">OBas_t"zs ::xt">OBas_t"><_pan class="annvttext">OBas_t"><_pan class= class="hs-identifier hs-var">zsOBas_t"><_pan class="annottext">OBas_t"zs ::xt">OBas_t"><_pan class="annvttext">OBas_t"><_pan class= class="hs-identifier hs-var">z]OBas_t"><_pan class="annottexass="annottext">Permu="annottext">[Int] [Int] [Int] SSymF -> m SSymF-identifier hs-var">z]OBas_t"ttext">[Int] [Int] [In="hs-glyph">= a aa -> a -> a forall a. Num a => a -> a -ref="#local-6989586621679247581">= [([a], [a])] -> [([a], [a])] -> [([a], [a])] ( -- This map between bases SSymF -> QSymF turns out to induce a morphism of Hopf algebras.<1ptext">[Int] xs, [Int] vs :: [v] trees 0 = [ = [ = ,[Int] vs :: [v] OBas_t" a -> a , [Int] vs :: [v] = [ = ,symH :: >[Int] vs :: [v] = Vect k (Permutation Int) -> Vect k (Permutation Int) forall k b. (Eq k, Num k, Ord b) => Vect k b -> Vect k b instance instance ombinatorialHopfAlgebra.html'SCymF">SSym> Num ">[[">[[<- [Int] Vect k (Permutation Int) -> Van>fmap <>fmap <>fmap omt">Vect k (Permutation Int) -> Van>OBas_t"ttext">[Int] [Int] [In="hs-glyph">= a [[Int] [[Int] [[Int] [[Int] -- |A basis for the shuffle algebra. As a vector space, the shuffle algebra is identical to the tensor algebra. -- HowanInt] [[Int] -- |Given a field k, (Vect k) is a functor, the \"free k-vector space\" functor. l'' :oupAlgebra.html">Math.Algebras.GroupAlpan>l'' :oupAlgebra.html">Math.Algebras.GroupAlpan>l'' :oupAlgebra.html">Math.Algebras.GroupAlpan>l'' :oupAldentifier hs-var">descendingTree<(oupAlgebra.html">Math.Algebras.GroupAlpan>l'' :oupAldentifier hs-var">descendingTree<(oupAlgebra.html">Math.Algebras.GroupAlpan>l'' :oupAldentifier hs-var">descendingTreel'' :oupAldentifier hs-var">descendingTreel'' :oupAldentifier hs-var">descendingTreel'' :oupAldentifier hs-var">descendingTreex0)[( -- |A module for constructing and working with combinatorial designs. E Ecounit :: Vect k QSymF -> k counit = Ecounit :: Vect k QSymF -> k Egs symE :: [Int] -> Vect Q SymE [Int] lambdss="hs-identifier hs-vartifier hs-var">g9247688">lambdss="hs-identifier hs-vartifier h05">symE :: [ass="hs-identifier hs-v586621679248135"><="hs-identifier">graphAutsPBT a PBT a gsunitInspan> unitInspan> unitInspan> ) wherean> symE :: [Int] -> Vect Q SymE [Int] lambdss="hs-identifier hs-vartifi79247688">symE :: [Int] -> Vect Q SymE reduce k ) => a ) =>