<jupyter_start><jupyter_text>Intro to Mathematical logic, Jupyter Notebook Installation* pip install pyDatalog Tasks* Extend rules for the salary at your own company. Namely add progressive tax rate depending on salary tax_rate=f(salary)* Add working time and calculate the total salary for every employee* Make filter form for employees<jupyter_code>from pyDatalog import pyDatalog
def twice(a):
    return a+a
pyDatalog.create_terms('X,Y,Z,Arr')

print('Set the X var to 1')
print(X==1)
print()
print('Assignment of 2 Vars')
print((X==True) & (Y==False))
print()

print('Assignment n times, to n values')
print(Arr.in_((0,1,2,3,4)))
print()

print('Just another case N assignment')
print(Arr.in_(range(5)))
print()

print('Filtering')
print(X.in_(range(5)) & (X<2))
print()

print('Term of function')
pyDatalog.create_terms('twice')
print((X==2) & (Y==twice(X)))
print()
print('Combination Assignment and Filtering')
print(X.in_(range(5)) & 
     Y.in_(range(5)) & 
     (Z==X*Y))
print(len(Z))
from ipywidgets import interact_manual
from pyDatalog import pyDatalog
pyDatalog.create_terms('employee, net_salary, tax_rate, month, total_salary, min_salary')
@interact_manual
def get_input(name='User', salary=50000, month = 12):
    min_salary = 24459
    employee[name]=salary
    tax_rate =  employee[X] * 0.1 + min_salary *0.1
    net_salary[X] =  employee[X] -tax_rate 
    total_salary[X] = (employee[X] - tax_rate) * month
    print((net_salary[X]==Y) & (total_salary[X]==Z) & (Y > 20000) & (Z > 240000))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14805194805194805, 'fraction_numerical': 0.026623376623376622, 'mean_word_length': 5.910313901345291, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '195051', 'license': 'Apache-2.0', 'n_tokens_mistral': 591, 'n_tokens_neox': 566, 'n_words': 143, 'path': 'lab1/.ipynb_checkpoints/lab1-checkpoint.ipynb', 'repo_name': 'nurzhaussyn/IntroMachineLearning', 'size': '1540'}