%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%Model LUMP SUMP TAXES%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

beta_l=0.9925;
beta_b=0.97;
alpha=0.35;
phi_h=0.12;
delta=0.025;
Xss=1.25;
m=0.9;
G_sur_PIB=0.195;
Dette_sur_PIB=0.358;
varphi_l=4; 
varphi_b=4;
theta=0.667;
phi_y=0.375;
mu=0.65;
rho_G=0.8;
sigma_A=0.01;
sigma_R=0.01;
sigma_G=0.01;
rR = 0.73;
rPi = 0.27;
rY = 0;
sR = 0.29;
sA = 0.01;
epsilon_p=5;


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Interest rates%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

r=(1/beta_l)-1;
r_k=(1/beta_l)-1+delta;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Consommation%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%% C_b%%%%%%%%%


theta_1= 1/(1+((1-beta_l)*m*phi_h)/(1-beta_b-m*(beta_l-beta_b)))

theta_2= (1-mu)*(1-alpha)/Xss


c_b= theta_1*(theta_2-(1-mu)*(G_sur_PIB+r*Dette_sur_PIB))

%%%%%%% C_l%%%%%%%%%

%%%%%%%K%%%%%

K= alpha/(Xss*r_k)

I=delta*K

c_l=1-c_b-I-G_sur_PIB


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Houses%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



h_b=1/((1+ (c_l/c_b)*(1-beta_b-m*(beta_l-beta_b))/(1-beta_l)))


h_l=1-h_b

q=phi_h*c_l/(h_l*(1-beta_l))



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Wages and labor%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

N_l= (mu*(1-alpha)/(Xss*c_l))^(1/5)
w_l=mu*(1-alpha)/(Xss*N_l)

N_b= ((1-mu)*(1-alpha)/(Xss*c_b))^(1/5)
w_b=(1-mu)*(1-alpha)/(Xss*N_b)

%A To have Y=1
A= 1/(K^(alpha)*(N_l^mu *N_b^(1-mu))^(1-alpha))
A*K^(alpha)*(N_l^mu *N_b^(1-mu))^(1-alpha)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Debt%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

b_b= m*q*h_b*beta_l
b_l=-b_b

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Taxe%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

T= G_sur_PIB +r*Dette_sur_PIB
%%%%%%%%%%%%%%%%%%%%%%%%%%Z1 et Z2%%%%%%%%%%%%%%%%%%%%%%%%%

Z_1=((1/Xss))/(1-theta*beta_l)
Z_2=1/(1-theta*beta_l)

%%%%%%%%%%%%%%%%%%%%%%%%%%Lagrange multipliers%%%%%%%%%%%%%%%%%%%%%%%%%

lambda_b=1/c_b
lambda_l=1/c_l
psi=(1/c_b)*(beta_l-beta_b)