incr-set prlevel 1
if #0=1 START
incr-set prlevel -1
;;; Usage:
;;; 	<projective_plane i
;;;
;;; sets i equal to the monomial ideal corresponding to the minimal triangulation
;;; of the projective plane (Reisner's example of a monomial ideal whose 
;;; resolution depends on the characteristic)
;;; over the current ring.  Requires >= 6 variables.
;;;    The triangulation of P^2_R:
;;;
;;;                            d
;;;						   
;;;						   
;;;                   f                  e
;;;                            a
;;;
;;;                         b      c
;;;                   e                  f
;;;
;;;
;;;                            d
;;;
;;; Here each pair of next neighbors is joined by an edge, and the outside hexagon is
;;; identified to itself by the antipodal map, so there are 6 vertices (variables)
;;; 15 edges and 10 faces.  The faces are the ten triangles composed
;;; of triples of neighboring points.  
;;; (The edge graph is the complete graph on 6 vertices;
;;; the only "interesting" part is the selection of the 
;;; 10 faces out of 20 possibilities).
;;; 
;;; The ideal is composed of the cubic monomials corresponding
;;; to the  10 non-faces.
incr-set prlevel 1
jump END
;;; Parameters:
;;;
;;; Output values:
;;;
;;; (discussion)
;;;
;;; Caveats:
;;;
; created ...
START:
<getvars @vars
ncols @vars @n
if @n>=6 continue
shout echo *********** NOT ENOUGH VARIABLES -- need at least 6 ***********
kill @vars @n
jump END
continue:

<ring 6 a-z @r
<ideal #1 abd abe acd acf aef bce bcf bdf cde def

;An alternate method:
;The facets are the complements of the following sets of variables:
;<ideal i1 d e f
;<ideal i2 c d e
;<ideal i3 a c d
;<ideal i4 a c f
;<ideal i5 a e f
;<ideal i6 a b e
;<ideal i7 a b d
;<ideal i8 b d f
;<ideal i9 b c f
;<ideal i10 b c e
;intersect i1 i2 i3 i4 i5 i6 i7 i8 i9 i10 i11 #1

ev @vars #1 #1
kill @vars @n @r @r'zero
END:
incr-set prlevel -1

$;;;;;;;; EXAMPLE SECTION ;;;;;;;;;;;;;;;;;;;;;;;;;
<ring 7 uvwxyzp r    
<projective_plane i
type i               ;changes variables correctly
std i i
degree i
res i ii
betti ii
; total:      1    10    15     6 
; --------------------------------
;     0:      1     -     -     - 
;     1:      -     -     -     - 
;     2:      -    10    15     6 
listvars

ring s
2
6
a-z
;
;

<projective_plane i
res i ii
betti ii
; total:      1    10    15     7     1 
; --------------------------------------
;     0:      1     -     -     -     - 
;     1:      -     -     -     -     - 
;     2:      -    10    15     6     1 
;     3:      -     -     -     1     - 
