s([Def],[Temp,Mod,vz]) -->
    np([Def1,3,_Gen1],[Num,nom]),
    { (member(Def1,[def,indef,quant]), Def = def)
    ; (Def1 = qu, Def = qu) },
    v([sein],[3,Num,Temp,Mod]),
    np([Def2,3,_Gen2],[Num,nom]),
    { Def2 = indef ; Def2 = def }.

s([qu],[Temp,Mod,ve]) -->
    v([sein],[3,Num,Temp,Mod]),
    np([Def1,3,_Gen1],[Num,nom]),
    { Def1 = def ; Def1 = indef ; Def1 = quant },
    np([Def2,3,_Gen2],[Num,nom]), % ,['?'],
    { Def2 = indef ; Def2 = def }. 

s([rel(Gen,Num)],[Temp,Mod,vl]) -->
    np([rel(Gen,Num),3,_Gen1],[Num2,nom]),
    np([Def2,3,_Gen2],[Num2,nom]),
    { member(Def2,[def,indef]) }, % quant?
    v([sein],[3,Num2,Temp,Mod]).
    
s([Def1],[Temp,Mod,vz]) -->
    np([Def1,3,_Gen1],[Num,nom]),
    { member(Def1,[def,indef,quant,qu]) },
    v([sein],[3,Num,Temp,Mod]),
    ap([def],[komp]).

s([qu],[Temp,Mod,ve]) -->
    v([sein],[3,Num,Temp,Mod]),
    np([Def1,3,_Gen1],[Num,nom]),
    { member(Def1,[def,indef,quant,qu]) },
    ap([def],[komp]).

s([Def1],[Temp,Mod,vl]) -->
    np([Def1,3,_Gen1],[Num,nom]),
    { member(Def1,[def,indef,quant,qu,rel(_,_)]) },
    ap([def],[komp]),
    v([sein],[3,Num,Temp,Mod]).

ap([def],[komp]) -->  
    a([als(nom)],[komp]), [als],
    np([Def2,3,_Gen2],[_Num,nom]),
    { Def2 = indef ; Def2 = def ; Def2 = quant}.

s([Def],[Temp,Mod,vz]) -->
    np([Def1,3,_Gen1],[Num1,Kas1]),
    { member(Def1,[def,indef,quant,qu]) },
    v([nom,akk],[3,Num,Temp,Mod]),
    np([Def2,3,_Gen2],[Num2,Kas2]),
    { member(Def2,[def,indef,quant]) }, % kein qu!
    { ( [Num,nom,akk] = [Num1,Kas1,Kas2]
      ; [Num,nom,akk] = [Num2,Kas2,Kas1]
      ), (qu = Def1 -> Def = qu ; Def = def)
    }.

s([qu],[Temp,Mod,ve]) -->
    v([nom,akk],[3,Num,Temp,Mod]),
    { member(Def1,[def,indef,quant]) },
    np([Def1,3,_Gen1],[Num1,Kas1]),
    { member(Def2,[def,indef,quant]) },
    np([Def2,3,_Gen2],[Num2,Kas2]),
    { ( [Num,nom,akk] = [Num1,Kas1,Kas2]
      ; [Num,nom,akk] = [Num2,Kas2,Kas1] )
    }.

s([rel(GenR,NumR)],[Temp,Mod,vl]) -->
    np([rel(GenR,NumR),3,_Gen1],[Num1,Kas1]),
    np([Def2,3,_Gen2],[Num2,Kas2]),
    { member(Def2,[def,indef,quant]) },
    v([nom,akk],[3,Num,Temp,Mod]),
    { ( [Num,nom,akk] = [Num1,Kas1,Kas2]
      ; [Num,nom,akk] = [Num2,Kas2,Kas1] )
    }.

s([qu],[Temp,Mod,ve]) -->
    v([werden],[3,Num,Temp,Mod]),
    np([_Def,3,_Gen],[Num,nom]),
    ([] ; [von], np([_Def2,_Pers2,_Gen2],[_Num2,dat])),
    v([nom,akk],[part2]).

s([Def],[Temp,Mod,vz]) -->
    np([Def,3,_Gen],[Num,nom]),
    v([werden],[3,Num,Temp,Mod]), 
    ([] ; [von], np([_Def2,_Pers2,_Gen2],[_Num2,dat])),
    v([nom,akk],[part2]).

s([Def],[Temp,Mod,vl]) -->
    np([Def,3,_Gen],[Num,nom]), 
    { Def = rel(_GenR,_NumR) },
    ([] ; [von], np([_Def2,_Pers2,_Gen2],[_Num2,dat])),
    v([nom,akk],[part2]),
    v([werden],[3,Num,Temp,Mod]).
