np([Def,3,Gen],[Num,Kas]) -->
    det([Def],[Gen,Num,Kas]),
    n([Gen],[Num,Kas]),
    { member(Def,[indef,def,qu,quant]) }.

np([Def,3,Gen],[Num,Kas]) -->
    pron([DefP],[Gen,Num,Kas]),
    { DefP = rel, Def = rel(Gen,Num)
    ; DefP = qu, Def = qu }.

np([def,3,Gen],[Num,Kas]) -->
    en([Gen],[Num,Kas]).

np([def,3,Gen],[Num,Kas]) -->
    det([def],[Gen,Num,Kas]),
    ( n([Gen1],[Num,Kas]), {Gen1 = Gen}
    ; [], {Gen2 = Gen} ),
    en([Gen2],[Num,nom]),
    (s([rel(Gen,Num)],[_Temp,_Mod,vl]) ; []).

np([def,3,Gen],[Num,Kas]) -->
    en([Gen],[Num,Kas]),
    s([rel(Gen,Num)],[_Temp,_Mod,vl]).  

np([Def,3,Gen],[Num,Kas]) -->
    det([Def],[Gen,Num,Kas]),
    n([Gen],[Num,Kas]),
    s([rel(Gen,Num)],[_Temp,_Mod,vl]).

np([indef,3,Gen],[pl,Kas]) -->
    n([Gen],[pl,Kas]), { member(Kas,[nom,dat,akk]) }.
np([indef,3,Gen],[pl,Kas]) -->
    rn([Gen],[pl,Kas]), { member(Kas,[nom,dat,akk]) },
    np([Def2,3,_Gen2],[_Num2,gen]), 
    { member(Def2,[def,indef]) }.

np([Def,3,Gen],[Num,Kas]) -->
    det([Def],[Gen,Num,Kas]), 
    rn([Gen],[Num,Kas]),
    np([Def2,3,_Gen2],[_Num2,gen]), 
      { member(Def2,[def,indef]) },
    { member(Def,[indef,def,qu,quant]) }.

np([rel(Gen2,Num2),3,Gen],[Num,Kas]) -->
    poss([rel],[Gen2,Num2,gen]),
    rn([Gen],[Num,Kas]).

% rektion(+DetDef,-Adekl)
rektion(Def,sw) :- Def = def ; Def = qu ; Def = quant, !.
rektion(Def,ge) :- Def = indef, !.
rektion(poss,ge).  % ??

np([Def,3,Gen],[Num,Kas]) -->
    det([Def],[Gen,Num,Kas]),
    { rektion(Def,Adekl) },
    ap([Def2],[_Komp,Adekl,Gen,Num,Kas]),
    { Def2 = def ; Def2 = indef },
    n([Gen],[Num,Kas]),
    { member(Def,[indef,def,qu,quant]) }.

np([Def,3,Gen],[Num,Kas]) -->
    det([Def],[Gen,Num,Kas]),
    { rektion(Def,Adekl) },
    ap([Def2],[_Komp,Adekl,Gen,Num,Kas]),
    { Def2 = def ; Def2 = indef },
    n([Gen],[Num,Kas]),
    s([rel(Gen,Num)],[_Temp,_Mod,vl]).

np([indef,3,Gen],[pl,Kas]) -->
    { rektion(indef,Adekl) },
    ap([Def2],[_Komp,Adekl,Gen,pl,Kas]),
    { Def2 = def ; Def2 = indef },
    n([Gen],[pl,Kas]), { member(Kas,[nom,dat,akk]) }.
np([indef,3,Gen],[pl,Kas]) -->
    { rektion(indef,Adekl) },
    ap([Def2],[_Komp,Adekl,Gen,pl,Kas]),
    { Def2 = def ; Def2 = indef },
    rn([Gen],[pl,Kas]), { member(Kas,[nom,dat,akk]) },
    np([Def2,3,_Gen2],[_Num2,gen]), 
    { member(Def2,[def,indef]) }.

np([Def,3,Gen],[Num,Kas]) -->
    det([Def],[Gen,Num,Kas]), 
    { rektion(Def,Adekl) },
    ap([Def1],[_Komp,Adekl,Gen,Num,Kas]),
    { Def1 = def ; Def1 = indef },
    rn([Gen],[Num,Kas]),
    np([Def2,3,_Gen2],[_Num2,gen]), 
      { member(Def2,[def,indef]) },
    { member(Def,[indef,def,qu,quant]) }.

np([rel(Gen2,Num2),3,Gen],[Num,Kas]) -->
    poss([rel],[Gen2,Num2,gen]),
    ap([Def1],[_Komp,_Adekl,Gen,Num,Kas]), % Adekl = gem?
    { Def1 = def ; Def1 = indef },
    rn([Gen],[Num,Kas]).

np([Def,3,Gen],[Num,Kas]) -->
    det([Def],[Gen,Num,Kas]),
    { rektion(Def,Adekl) },
    ap([def],[komp,Adekl,Gen,Num,Kas])/als_vgl,
    n([Gen],[Num,Kas]),
    { member(Def,[indef,def,qu,quant]) },
    [als],
    ( np([Def2,3,_Gen2],[_Num,nom]),
        { Def2 = indef ; Def2 = def ; Def2 = quant}
    ; s([def],[_Temp,_Mod,vl]) % nur APpos-Praedikative
    ).

np([Def,3,Gen],[Num,Kas]) -->
    det([Def],[Gen,Num,Kas]),
    ap([def],[pos,Adekl,Gen,Num,Kas])/wie_vgl,
    { rektion(Def,Adekl) },
    n([Gen],[Num,Kas]),
    { member(Def,[indef,def,qu,quant]) },
    [wie],
    ( np([Def2,3,_Gen2],[_Num,nom]),
        { Def2 = indef ; Def2 = def ; Def2 = quant}
    ; s([def],[_Temp,_Mod,vl]) % nur APpos-Praedikative
    ).
    
