module ExampleCT1 where import Sequenic.CTy.Types inp :: Input inp = [age,gender,studentType,nationality,pc,os,height,weight,occupation,status] where age :: Category age = Cat "Age" [Leaf "<18", Leaf "18-40", Leaf ">40"] gender :: Category gender = Cat "Gender" [Leaf "Male",Leaf "Female"] studentType :: Category studentType = Cat "sType" [master,Leaf "Bachelor",Leaf "PhD"] where master :: Partition master = Node "Master" [Leaf "fullMaster", Leaf "Mixed"] nationality :: Category nationality = Cat "Nationality" [foreign, Leaf "Dutch"] where foreign :: Partition foreign = Node "Foreign" [Leaf "EU",Leaf "non-EU"] pc :: Category pc = Cat "PC" [laptop,Leaf "DeskPC"] where laptop :: Partition laptop = Node "Laptop" [macLaptop,winLaptop] macLaptop :: Partition macLaptop = Node "macLaptop" [Leaf "MacBook", Leaf "Powerbook"] winLaptop :: Partition winLaptop = Node "winLaptop" [Leaf "Asus", Leaf "HP", Leaf "Toshiba"] os :: Category os = Cat "OS" [linux,windows,Leaf "MacOS"] where linux :: Partition linux = Node "Linux" [Leaf "Ubuntu", Leaf "Debian", Leaf "RedHat"] windows :: Partition windows = Node "Windows" [Leaf "WinXP", Leaf "WinVista", Leaf "Win7"] height :: Category height = Cat "Height" [Leaf "<1,60", Leaf "1,60-1,74", Leaf "1,75-1,90", Leaf ">1,90"] weight :: Category weight = Cat "Weight" [Leaf "<60", Leaf "60-74", Leaf "75-90", Leaf ">90"] occupation :: Category occupation = Cat "Occupation" [Leaf "Just Student", Leaf "Part-Time Worker", Leaf "Full-time Worker"] status :: Category status = Cat "Status" [Leaf "Single", Leaf "Married", Leaf "Divorced", Leaf "Widow"] r1 :: Rule r1 = include ["winLaptop"] r2 :: Rule r2 = include ["18-40"] |*| ((["Foreign"] `imp_` ["Mixed"]) |+| include ["Male"]) r3 :: Rule r3 = (["Laptop"] `or_` ["Windows"]) |+| ([">90"] `nor_` [">1,90"]) r4 :: Rule r4 = (["Laptop"] `or_` ["Windows"]) |+| ([">90"] `nor_` [">1,90"]) `suchthat` ["Laptop"] `or_` ["MacOS"] r5 :: Rule r5 = ["Windows"] `imp_` ["winLaptop"] r6 :: Rule r6 = include ["<18",">40"] |*| include ["Just Student"] rules :: [Rule] rules = [r1,r2,r3,r4,r5,r6]