AONTrees[e_,1]=e;AONTrees[e_,n_]:=Flatten[{Function[{xxx},Table[Outer[xxx,AONTrees[e,n-r-1],AONTrees[e,r]],{r,n-2}]]/@{and,or},Outer[not,AONTrees[e,n-1]]}]ToAONCode[expr_,m_]:=Module[{fn},fn=Apply[Function,{expr}];Block[{and=Times,or=(Sign[(#1+#2)]&),not=(1-#1&)},FromDigits[fn@@@Tuples[{1,0},m],2]]]FindAONTheorems[max_,nvar_]:=(Map[Last,Split[Sort[{ToAONCode[#,nvar],#}&/@Flatten[Table[AONTrees[Slot/@Range[nvar],i],{i,max}],1]],First[#1]==First[#2]&],{2}]/.{#1->a,#2->b,#3->c})FindAONTheoremsList[max_,nvar_]:=Flatten[Module[{u={ToAONCode[#,nvar],#}&/@DepthLeafSort[Flatten[Table[AONTrees[Slot/@Range[nvar],i],{i,max}],1]]},Table[Thread[Last/@u[[Flatten[Position[First/@Take[u,n-1],u[[n,1]]]]]]==u[[n,2]]],{n,Length[u]}]]/.{#1->a,#2->b,#3->c,and->Wedge,or->Vee,not->Square}]DepthLeafSort[list_List]:=Flatten[Map[SortBy[#1,{Cases[#,_?AtomQ,{0,∞}]&}]&,(SplitBy[SortBy[#1,{LeafCount}],{LeafCount}]&)/@SplitBy[SortBy[list,{Depth}],{Depth}],{2}],3]DepthLeafSortArray[arr_]:=With[{list=DepthLeafSort/@arr},Flatten[Map[Sort[#1,OrderedQ[{Cases[#1[[1]],_?AtomQ,{0,∞}],Cases[#2[[1]],_?AtomQ,{0,∞}]}]&]&,(Split[Sort[#1,LeafCount[First@#1]<LeafCount[First@#2]&],LeafCount[#1[[1]]]==LeafCount[#1[[1]]]&]&)/@Split[Sort[DepthLeafSort/@list,Depth[First@#1]<Depth[First@#2]&],Depth[First@#1]==Depth[First@#2]&],{2}],2]]LowestQ[expr_,vars_]:=(First[DepthLeafSort[expr/.(Thread[vars->#]&/@Permutations[vars])]]===expr)data53=Select[FindAONTheoremsList[5,3],LowestQ[#,{a,b,c}]&];FindAONTheoremsListX[max_,nvar_]:=Flatten[Table[#[[i]]==#[[j]],{i,Length[#]},{j,i+1,Length[#]}]&/@DepthLeafSort/@FindAONTheorems[max,nvar]]/.{not->Square,and->Wedge,or->Vee}FindAllAON[max_,nvar_]:=Flatten[Module[{u={0,#}&/@DepthLeafSort[Flatten[Table[AONTrees[Slot/@Range[nvar],i],{i,max}],1]]},Table[Thread[Last/@u[[Flatten[Position[First/@Take[u,n-1],u[[n,1]]]]]]==u[[n,2]]],{n,Length[u]}]]/.{#1->a,#2->b,#3->c,and->Wedge,or->Vee,not->Square}]LogicFormat[expr_]:=HoldForm[expr]/.{Square->Not,Vee->Or,Wedge->And,a.->a,b.->b,c.->c}