.include common

parent_noswitch( p:node, c:node )
parent_noswitch( p, c ) :- \
    !switchS( p, *, * ), \
    !switchS( c, *, * ), \
    se(p), se(c), \
    parent( p, c ).
    
anc_noswitch( a:node, c:node )
anc_noswitch( a, c ) :- parent_noswitch( a, c ).
anc_noswitch( a, c ) :- anc_noswitch( a, b ), parent_noswitch( b, c ).

switch_with_default( s:node )
switch_with_default( s ) :- \
    switchS( s, _, _ ), \
    defaultS( d, _ ), \
    parent( s, c ), \
    anc_noswitch( c, d ).

switch_without_default( s:node )
switch_without_default( s ) :- \
    switchS( s, _, _ ), \
    !switch_with_default( s ).
    
switch_without_default( S )?

