ATermAppl arg = (ATermAppl) arg1;
if( isNot( arg ) ) {
simp = simplify( (ATermAppl) arg.getArgument( 0 ) );
}
else if( isMin( arg ) ) {
ATermInt n = (ATermInt) arg.getArgument( 1 );
if( n.getInt() == 0 ) {
simp = BOTTOM;
}
}
}
else if( fun.equals( ANDFUN ) ) {
ATermList conjuncts = (ATermList) arg1;
if( conjuncts.isEmpty() ) {
simp = TOP;
}
else {
Set<ATermAppl> set = new HashSet<ATermAppl>();
List<ATermAppl> negations = new ArrayList<ATermAppl>();
MultiListIterator i = new MultiListIterator( conjuncts );
while( i.hasNext() ) {
ATermAppl c = i.next();
if( c.equals( TOP ) ) {
continue;
}
else if( c.equals( BOTTOM ) ) {
return BOTTOM;
}
else if( isAnd( c ) ) {
i.append( (ATermList) c.getArgument( 0 ) );
}
else if( isNot( c ) ) {
negations.add( c );
}
else {
set.add( c );
}
}
for( ATermAppl notC : negations ) {
ATermAppl c = (ATermAppl) notC.getArgument( 0 );
if( set.contains( c ) ) {
return BOTTOM;
}
}
if( set.isEmpty() ) {
if( negations.isEmpty() ) {
return TOP;
}
else if( negations.size() == 1 ) {
return negations.get( 0 );
}
}
else if( set.size() == 1 && negations.isEmpty() ) {
return set.iterator().next();
}
negations.addAll( set );
int size = negations.size();
ATermAppl[] terms = new ATermAppl[size];
negations.toArray( terms );
simp = makeAnd( toSet( terms, size ) );
}
}
else if( fun.equals( ALLFUN ) ) {
if( arg2.equals( TOP ) ) {
simp = TOP;
}
}
else if( fun.equals( MINFUN ) ) {
ATermInt n = (ATermInt) arg2;
if( n.getInt() == 0 ) {
simp = TOP;
}
if( arg3.equals( ATermUtils.BOTTOM ) ) {
simp = BOTTOM;
}
}
else if( fun.equals( MAXFUN ) ) {
ATermInt n = (ATermInt) arg2;
if( n.getInt() > 0 && arg3.equals( ATermUtils.BOTTOM ) ) {
simp = TOP;
}
}
else {
throw new InternalReasonerException( "Unknown term type: " + term );