#!/usr/bin/env python3 def greater_than(Model): prods = [] greater_done = Model.productionstring( name="greater_done", string=""" =g> isa math_goal op greater_done result ~None result =result arg1 =arg1 arg2 =arg2 ==> =g> isa math_goal op done +imaginal> isa math_op op greater result =result arg1 =arg1 arg2 =arg2 """ ) arg1_greater = Model.productionstring( name="arg1_greater", string=""" =g> isa math_goal op greater_arg1 hundreds1 =hun1 tens1 =ten1 ones1 =one1 ==> =g> isa math_goal op greater_done hundreds_ans =hun1 tens_ans =ten1 ones_ans =one1 ~retrieval> """, ) prods.append(arg1_greater) arg2_greater = Model.productionstring( name="arg2_greater", string=""" =g> isa math_goal op greater_arg2 hundreds2 =hun2 tens2 =ten2 ones2 =one2 ==> =g> isa math_goal op greater_done hundreds_ans =hun2 tens_ans =ten2 ones_ans =one2 ~retrieval> """, ) prods.append(arg2_greater) start_greater_hun = Model.productionstring( name="start_greater_hun", string=""" =g> isa math_goal op greater hundreds1 =hun1 hundreds2 ~=hun1 hundreds2 =hun2 hundreds_ans None ?retrieval> state free buffer empty ==> =g> isa math_goal +retrieval> isa math_op op greater arg1 =hun1 arg2 =hun2 """, ) prods.append(start_greater_hun) start_greater_ten = Model.productionstring( name="start_greater_ten", string=""" =g> isa math_goal op greater hundreds1 =hun1 hundreds2 =hun1 tens1 =ten1 tens2 ~=ten1 tens2 =ten2 ?retrieval> state free buffer empty ==> =g> isa math_goal +retrieval> isa math_op op greater arg1 =ten1 arg2 =ten2 """, ) prods.append(start_greater_ten) start_greater_one = Model.productionstring( name="start_greater_one", string=""" =g> isa math_goal op greater hundreds1 =hun1 hundreds2 =hun1 tens1 =ten1 tens2 =ten1 ones1 =one1 ones2 =one2 ?retrieval> state free buffer empty ==> =g> isa math_goal +retrieval> isa math_op op greater arg1 =one1 arg2 =one2 """, ) prods.append(start_greater_one) comp_result_hun_greater_arg1 = Model.productionstring( name="comp_result_hun_greater_arg1", string=""" =g> isa math_goal op greater hundreds1 =hun1 hundreds2 =hun2 =retrieval> isa math_op op greater arg1 =hun1 arg2 =hun2 result =hun1 ==> =g> isa math_goal op greater_arg1 """, ) prods.append(comp_result_hun_greater_arg1) comp_result_hun_greater_arg2 = Model.productionstring( name="comp_result_hun_greater_arg2", string=""" =g> isa math_goal op greater hundreds1 =hun1 hundreds2 =hun2 =retrieval> isa math_op op greater arg1 =hun1 arg2 =hun2 result =hun2 ==> =g> isa math_goal op greater_arg2 """, ) prods.append(comp_result_hun_greater_arg2) comp_result_ten_greater_arg1 = Model.productionstring( name="comp_result_ten_greater_arg1", string=""" =g> isa math_goal op greater tens1 =ten1 tens2 =ten2 =retrieval> isa math_op op greater arg1 =ten1 arg2 =ten2 result =ten1 ==> =g> isa math_goal op greater_arg1 """, ) prods.append(comp_result_ten_greater_arg1) comp_result_ten_greater_arg2 = Model.productionstring( name="comp_result_ten_greater_arg2", string=""" =g> isa math_goal op greater tens1 =ten1 tens2 =ten2 =retrieval> isa math_op op greater arg1 =ten1 arg2 =ten2 result =ten2 ==> =g> isa math_goal op greater_arg2 """, ) prods.append(comp_result_ten_greater_arg2) comp_result_one_greater_arg1 = Model.productionstring( name="comp_result_one_greater_arg1", string=""" =g> isa math_goal op greater ones1 =one1 ones2 =one2 =retrieval> isa math_op op greater arg1 =one1 arg2 =one2 result =one1 ==> =g> isa math_goal op greater_arg1 """, ) prods.append(comp_result_one_greater_arg1) comp_result_one_greater_arg2 = Model.productionstring( name="comp_result_one_greater_arg2", string=""" =g> isa math_goal op greater ones1 =one1 ones2 =one2 =retrieval> isa math_op op greater arg1 =one1 arg2 =one2 result =one2 ==> =g> isa math_goal op greater_arg2 """, ) prods.append(comp_result_one_greater_arg2) return prods def lesser_than(Model): prods = [] lesser_done = Model.productionstring( name="lesser_done", string=""" =g> isa math_goal op lesser_done result ~None result =result arg1 =arg1 arg2 =arg2 ==> =g> isa math_goal op done +imaginal> isa math_op op lesser result =result arg1 =arg1 arg2 =arg2 """ ) arg1_lesser = Model.productionstring( name="arg1_lesser", string=""" =g> isa math_goal op lesser_arg1 hundreds1 =hun1 tens1 =ten1 ones1 =one1 ==> =g> isa math_goal op lesser_done hundreds_ans =hun1 tens_ans =ten1 ones_ans =one1 ~retrieval> """, ) prods.append(arg1_lesser) arg2_lesser = Model.productionstring( name="arg2_lesser", string=""" =g> isa math_goal op lesser_arg2 hundreds2 =hun2 tens2 =ten2 ones2 =one2 ==> =g> isa math_goal op lesser_done hundreds_ans =hun2 tens_ans =ten2 ones_ans =one2 ~retrieval> """, ) prods.append(arg2_lesser) start_lesser_hun = Model.productionstring( name="start_lesser_hun", string=""" =g> isa math_goal op lesser hundreds1 =hun1 hundreds2 ~=hun1 hundreds2 =hun2 hundreds_ans None ?retrieval> state free buffer empty ==> =g> isa math_goal +retrieval> isa math_op op greater arg1 =hun1 arg2 =hun2 """, ) prods.append(start_lesser_hun) start_lesser_ten = Model.productionstring( name="start_lesser_ten", string=""" =g> isa math_goal op lesser hundreds1 =hun1 hundreds2 =hun1 tens1 =ten1 tens2 ~=ten1 tens2 =ten2 ?retrieval> state free buffer empty ==> =g> isa math_goal +retrieval> isa math_op op greater arg1 =ten1 arg2 =ten2 """, ) prods.append(start_lesser_ten) start_lesser_one = Model.productionstring( name="start_lesser_one", string=""" =g> isa math_goal op lesser hundreds1 =hun1 hundreds2 =hun1 tens1 =ten1 tens2 =ten1 ones1 =one1 ones2 =one2 ?retrieval> state free buffer empty ==> =g> isa math_goal +retrieval> isa math_op op greater arg1 =one1 arg2 =one2 """, ) prods.append(start_lesser_one) comp_result_hun_lesser_arg1 = Model.productionstring( name="comp_result_hun_lesser_arg1", string=""" =g> isa math_goal op lesser hundreds1 =hun1 hundreds2 =hun2 =retrieval> isa math_op op greater arg1 =hun1 arg2 =hun2 result =hun2 ==> =g> isa math_goal op lesser_arg1 """, ) prods.append(comp_result_hun_lesser_arg1) comp_result_hun_lesser_arg2 = Model.productionstring( name="comp_result_hun_lesser_arg2", string=""" =g> isa math_goal op lesser hundreds1 =hun1 hundreds2 =hun2 =retrieval> isa math_op op greater arg1 =hun1 arg2 =hun2 result =hun1 ==> =g> isa math_goal op lesser_arg2 """, ) prods.append(comp_result_hun_lesser_arg2) comp_result_ten_lesser_arg1 = Model.productionstring( name="comp_result_ten_lesser_arg1", string=""" =g> isa math_goal op lesser tens1 =ten1 tens2 =ten2 =retrieval> isa math_op op greater arg1 =ten1 arg2 =ten2 result =ten2 ==> =g> isa math_goal op lesser_arg1 """, ) prods.append(comp_result_ten_lesser_arg1) comp_result_ten_lesser_arg2 = Model.productionstring( name="comp_result_ten_lesser_arg2", string=""" =g> isa math_goal op lesser tens1 =ten1 tens2 =ten2 =retrieval> isa math_op op greater arg1 =ten1 arg2 =ten2 result =ten1 ==> =g> isa math_goal op lesser_arg2 """, ) prods.append(comp_result_ten_lesser_arg2) comp_result_one_lesser_arg1 = Model.productionstring( name="comp_result_one_lesser_arg1", string=""" =g> isa math_goal op lesser ones1 =one1 ones2 =one2 =retrieval> isa math_op op greater arg1 =one1 arg2 =one2 result =one2 ==> =g> isa math_goal op lesser_arg1 """, ) prods.append(comp_result_one_lesser_arg1) comp_result_one_lesser_arg2 = Model.productionstring( name="comp_result_one_lesser_arg2", string=""" =g> isa math_goal op lesser ones1 =one1 ones2 =one2 =retrieval> isa math_op op greater arg1 =one1 arg2 =one2 result =one1 ==> =g> isa math_goal op lesser_arg2 """, ) prods.append(comp_result_one_lesser_arg2) return prods