This file is indexed.

/usr/share/gap/pkg/openmath/hasse/hasse.g is in gap-openmath 11.2.0+ds-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
###########################################################################
##
#W  hasse/hasse.g       OpenMath Package                     Andrew Solomon
#W                                                         Marco Costantini
##
#Y  Copyright (C) 1999, 2000, 2001, 2006
#Y  School Math and Comp. Sci., University of St.  Andrews, Scotland
#Y  Copyright (C) 2004, 2005, 2006 Marco Costantini
##
##  This file contains the function for drawing Hasse diagrams
##


###########################################################################
##
#P IsHasseDiagram
##
## Hasse diagram GAP definitions.
##

DeclareProperty("IsHasseDiagram", IsBinaryRelation);

###########################################################################
## Return the Hasse Diagram of a partial order.
##

HasseDiagram := function(rel)
	local h;
	h :=  HasseDiagramBinaryRelation(rel);
	SetIsHasseDiagram(h,true);
	return h;
end;



# f is a list of elements, le is the comparison function
CreateHasseDiagram := function(f, le)
  local rel, lc, tups, i, j, IsMinimalInList, MinElts, EltCovers, ListCovers;


 # true iff x is the only element of list which divides x
 IsMinimalInList := function(x, list, le)
   local i;

   for i in list do
     if le(i, x) and x <> i then
       return false;
     fi;
   od;
   return true;
 end;


 ## return the minimal elements of a list under le
 MinElts := function(list, le)
   local i;

   return Filtered(list, x->IsMinimalInList(x, list, le));
 end;


 ## for x in list, return the elements which cover it under le
 EltCovers := function(list, x, le)
   local xunder;

   xunder := Filtered(list, y->le(x,y) and y <> x);
   return MinElts(xunder,le);
 end;


 ## for a list, return the set of pairs, x, covers(x)
 ListCovers := function(list,le)
   return List(list, x->[x, EltCovers(list, x, le)]);
 end;


  lc := ListCovers(f, le);
  tups := [];
  for i in lc do
    for j in i[2] do
      Append(tups, [DirectProductElement([i[1], j])]);
    od;
  od;
  rel := BinaryRelationByElements(Domain(f), tups);
  SetIsHasseDiagram(rel, true);
  return rel;
end;


BindGlobal( "OMDirectoryTemporary", DirectoryTemporary() );


BindGlobal("DrawHasse", function(h)

	local output, filename;

	filename := Filename( OMDirectoryTemporary, "nsinput.html" );
	RemoveFile( filename );

	output := OutputTextFile( filename, false ); #append
	SetPrintFormattingStatus( output, false );
	AppendTo(output, TOP_HTML);

	OMPutObject(output,h);
	AppendTo(output, BOTTOM_HTML);
	CloseStream(output);

	Exec(Concatenation(BROWSER_COMMAND, " ", filename, " &"));
end);


###########################################################################
#E