function test(){ var i,j; valid=true; let sh=["","",""]; let neg=[false,false,false]; let negs=[false,false,false]; let op=["","",""]; for(i=1;i<=3;i++) { let o1=document.getElementById("s"+i+"o1").value ; let o2=document.getElementById("s"+i+"o2").value; let o3=document.getElementById("s"+i+"o3").value; let o4= document.getElementById("s"+i+"o4").value ; if(o1=="n") { o1="a"; o3=(o3=="i" ? "n": "i"); } op[i-1]=">"; if(o1=="s") op[i-1]="I"; sh[i-1]="C"+o2+""; if(op[i-1]=="I") sh[i-1]+=" ∩ "; else sh[i-1]+= ""; if(o3=="n") sh[i-1]+="C"+o4+""; else sh[i-1]+=" C"+o4+""; op[i-1]=o2+op[i-1]+o4; negs[i-1]=(o3=="n"); if(negs[i-1]) op[i-1]+="/"; document.getElementById("s"+i).innerHTML=" S"+i+" = ("+sh[i-1] +") "; } for(i=1;i<=3;i++) { neg[i-1]=false; for(j=0;j<3;j++) { let op1=op[j]; if(negs[j] && op1[2]==i) neg[i-1]=true; } } console.log(sh); console.log(op); console.log(neg); let result=document.getElementById("results"); var table=""; table+=""; for(i=1;i<=3;i++) table+=""; for(i=1;i<=3;i++) if(neg[i-1]) table+=""; for(i=1;i<=3;i++) table+=""; table+=""; table+=""; table+=""; for(j=0;j<=7;j++) { let f=j.toString(2).padStart(3,'0'); table+=""; for(i=1;i<=3;i++) table+=""; for(i=1;i<=3;i++) if(neg[i-1]) table+=""; let s1r=[0,0,0]; for(i=1;i<=3;i++) { let opi=op[i-1]; let vc1=1*opi[0]; let vc2=1*opi[2]; let dbg="="+opi; let c1=f[vc1-1]; let c2=opi.length==4 ? ( f[vc2-1]==0 ?1:0) : f[vc2-1]; dbg=dbg + "~"+c1+","+c2+":"+neg[vc1]+","+neg[vc2]; if(opi[1]==">") { s1r[i-1]=1; if(c1==1 && c2==0) s1r[i-1]=0; } else if (opi[1]=="I") { s1r[i-1]=0; if(c1==1 && c1==c2) s1r[i-1]=1; } else s1r[i-1]=20; table+=""; } let s1Is2=0; if(s1r[0] == 1 && s1r[0]==s1r[1]) s1Is2=1; table+=""; let s=1; if(s1Is2==1 && s1r[2]==0) s=0; if(s==0) { table+=""; valid=false; } else table+=""; table+=""; } table+="
  C"+i+"  C"+i+"   S"+i+" = ("+sh[i-1] +")  S1 ∩ S2  S = (S1 ∩ S2) S3  
"+f[i-1]+" "+(f[i-1] == 0 ? 1 : 0 ) +" "+s1r[i-1]+" "+s1Is2+""+s+""+s+"
"; if(valid )table+="

Given that each element of the column that corresponds to S is a '1', we conclude that S = U (universal set). Therefore, the categorical syllogism considered is valid.

"; else table+="

Given that in the column of Sthere is a membership value equal to zero (0), SU. Therefore, the categorical syllogism considered is not valid.

"; result.innerHTML=table; }