Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
| Download
GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
Project: cocalc-sagemath-dev-slelievre
Views: 418346<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->1<!-- %% -->2<!-- %A blist.msk GAP documentation Martin Schönert -->3<!-- %% -->4<!-- %A @(#)<M>Id: blist.msk,v 1.9 2002/04/15 10:02:27 sal Exp </M> -->5<!-- %% -->6<!-- %Y (C) 1998 School Math and Comp. Sci., University of St Andrews, Scotland -->7<!-- %Y Copyright (C) 2002 The GAP Group -->8<!-- %% -->9<Chapter Label="Boolean Lists">10<Heading>Boolean Lists</Heading>1112This chapter describes boolean lists.13A <E>boolean list</E> is a list that has no holes and contains only14the boolean values <K>true</K> and <K>false</K>15(see Chapter <Ref Chap="Booleans"/>).16In function names we call boolean lists <E>blists</E> for brevity.171819<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->20<Section Label="sect:IsBlist">21<Heading>IsBlist (Filter)</Heading>2223<#Include Label="IsBlist">2425</Section>262728<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->29<Section Label="Boolean Lists Representing Subsets">30<Heading>Boolean Lists Representing Subsets</Heading>3132<#Include Label="BlistList">33<#Include Label="ListBlist">34<#Include Label="SizeBlist">35<#Include Label="IsSubsetBlist">3637</Section>383940<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->41<Section Label="Set Operations via Boolean Lists">42<Heading>Set Operations via Boolean Lists</Heading>4344<#Include Label="UnionBlist">45<#Include Label="IntersectionBlist">46<#Include Label="DifferenceBlist">4748</Section>495051<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->52<Section Label="Function that Modify Boolean Lists">53<Heading>Function that Modify Boolean Lists</Heading>5455<#Include Label="UniteBlist">56<#Include Label="UniteBlistList">57<#Include Label="IntersectBlist">58<#Include Label="SubtractBlist">5960</Section>616263<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->64<Section Label="More about Boolean Lists">65<Heading>More about Boolean Lists</Heading>6667We defined a boolean list as a list that has no holes and contains only68<K>true</K> and <K>false</K>.69There is a special internal representation for boolean lists that needs70only 1 bit for each entry.71This bit is set if the entry is <K>true</K> and reset if the entry is72<K>false</K>.73This representation is of course much more compact than the ordinary74representation of lists, which needs 32 or 64 bits per entry.75<P/>76<!-- %T Add a note about internal representation of plain lists (preferably in -->77<!-- %T the chapter <Q>Lists</Q>), -->78<!-- %T in order to allow a user to estimate the space needed for -->79<!-- %T computations with lists; -->80<!-- %T then add cross-references from and to the other available list -->81<!-- %T representations! -->82<P/>83Not every boolean list is represented in this compact representation. It84would be too much work to test every time a list is changed, whether this85list has become a boolean list. This section tells you under which86circumstances a boolean list is represented in the compact87representation, so you can write your functions in such a way that you make88best use of the compact representation.89<P/>90If a dense list containing only <K>true</K> and <K>false</K> is read, it91is stored in the compact representation. Furthermore,92the results of <Ref Func="BlistList"/>,93<Ref Func="UnionBlist" Label="for a list"/>,94<Ref Func="IntersectionBlist" Label="for a list"/>95and <Ref Func="DifferenceBlist"/> are known96to be boolean lists by construction, and thus97are represented in the compact representation upon creation.98<P/>99If an argument of <Ref Func="IsSubsetBlist"/>,100<Ref Func="ListBlist"/>, <Ref Func="UnionBlist" Label="for a list"/>,101<Ref Func="IntersectionBlist" Label="for a list"/>,102<Ref Func="DifferenceBlist"/>,103<Ref Func="UniteBlist"/>, <Ref Func="IntersectBlist"/> and104<Ref Func="SubtractBlist"/> is a list represented in the ordinary105representation, it is106tested to see if it is in fact a boolean list.107If it is not, an error is signalled. If it is, the108representation of the list is changed to the compact representation.109<P/>110If you change a boolean list that is represented in the compact111representation by assignment (see <Ref Sect="List Assignment"/>) or112<Ref Func="Add"/>113in such a way that the list remains a boolean list it will remain114represented in the compact representation. Note that changing a list115that is not represented in the compact representation, whether it is a116boolean list or not, in such a way that the resulting list becomes a117boolean list, will never change the representation of the list.118119<#Include Label="IsBlistRep">120121</Section>122</Chapter>123124125126127