## example 1
data(Yamasaki,package="QCA")
ans0 <- reduce(Yamasaki,"AGENDA",names(Yamasaki)[1:5],"negative","include") ## 5 solutions
ans1 <- reduce(Yamasaki,"AGENDA",names(Yamasaki)[1:5],"positive","include")
(csa2 <- CSA(ans0[2],ans1)) ## get and show CSAs
(ans02 <- constrReduce(ans0[2],exclude=csa2$solutions[[1]]))
## impose constraint
CSA(ans02,ans1) ## no CSA now

ans02b <- excludeCSA(ans0[2],csa2)
CSA(ans02b,ans1) ## no CSA
## note that ans02b is more parsimonious than ans02
## since ans02b includes further reminders.

## example 2
data(Osa,package="QCA") ## QCA package is required to run this example
conditions <- c("DYNA","ACCES","INFLU","ELITE","SOCIAL")
Osa$OUT2 <- Osa$OUT ## OUT is reserved word in QCA3.
a <- reduce(Osa, outcome = "OUT2", conditions = conditions, explain = "negative", remainders = "ex", contradictions = "negative")
b <- reduce(Osa, outcome = "OUT2", conditions = conditions, explain = "negative", remainders = "include", contradictions = "negative")

# there are two solutions in b, let's focus on the first only.
b1 <- b[1]
sa <- SA(b1) ## simplifying assumptions
constrReduce(a,inc=sa$solutions[[1]]) ## == b1
constrReduce(b1,exc=sa$solutions[[1]]) ## ==a1