 Let us look at an example of how this is constructed, how a simple case can be constructed. Yeah, as always I rely on my double integrator example. Yeah, I am going to look at a control problem by the way, although we were looking at this, I am going to do a control problem. Yeah, does not matter, you can I mean the notions are same, okay. So, this is a control problem, I want to do stabilization. So, I want to go to x1, x2, that is my target, that is an equilibrium. So, I can always target to go there and I want to make sure that want x1 less than equal to 5 and x2 less than equal to 3, okay. Is this a good enough or x2 say greater than equal to minus 3, okay. I am trying to see if this is a good specification or not, not too nice I guess. Yeah, I will just say, yeah, let us just do this, okay. We will just try this, I have no idea how it goes, we will see, okay, alright. So, great, great, great. So, I want this, okay in the transient. So, of course I will give x1 0, x2 0, I would like to start within of course, does not make sense for me to start outside. So, I will start within this set which is say, you know, x1 I will take as 4 and x2 as you know, minus 2, okay. Not that this matters, but we will do that, right. Now, how have would I design a control for this system anybody? How would I design a control or a Lyapunov candidate or CLF for this? What would be a good Lyapunov function, okay. You said x1 square plus x2 square, some said back stepping. So, in this case let us start with x1 square plus x2 square, see what happens. It is not a strictly Lyapunov function, you all understand that. But let us start and see. So, this is of course positive definite and all that, candidate Lyapunov function, all the nice things. If I took v dot, I will get x1 x2 plus x2 times u and I would basically choose control as what? What would be a good control here? Minus x1 minus x2, fair enough because I will get v dot as minus x2 square, negative semi-definite only, then of course I will try Lassal and it will work out, yeah. It will be a stabilizing control, okay. Not a strictly Lyapunov function, let us see if we land in trouble because of that unclear, but we will try. Now, as you can imagine this is not necessarily going to keep me inside this set, I did not, no guarantees. I mean if I simulate it for different initial conditions, maybe suppose I start with, I change the initial condition to the boundary pretty much, 5 comma 3, that is the boundary. What will happen? I will get a control which is negative but that is fine, that is fine because I will get us minus 8 units and that is fine. No, that is not what I want. I want to be on the boundary of this guy and I want to be, give it a positive, so I want to have minus 4. I am just playing so that it does not, it gets out somehow at this boundary, okay. What am I trying? I think you understand what I am trying. So, this is where I start suppose, this is well within the set, right? I started within the set, no problem. What is the control at this point? U0 is what? It is 4 minus 3 equal to plus 1, okay, at that instant, right? So, it is a positive value, right? So, I got x2 dot is, is a positive number, right? I am already on the boundary of x2, right? So, I am going to get out, okay? I just, this worked hard to get a case which will happen, okay? So, basically it is obvious, right? I mean I did not really work or try to do anything to make sure that it remains inside the set. So, obviously I did not use it to do any designs, obviously you cannot expect that anything good will come out of it. I mean you will get out of the set, okay? Even if you start in the set. So, this is in the set, way I have defined it, okay? So, yeah. So, sure I escaped, I can get out of the set, okay? So, that is the basic point, will not stop set escape. As is obvious because we worked, we did not do anything to actually help stop it. What I will do is, I will modify this v now, yeah? x1 squared over x1 square minus 25 plus x2 square, okay? Alright? Very ugly looking, weird looking thing, yeah? And this is what is called a reciprocal barrier function, okay? We have done some reciprocal construction. So, what exactly is happening here? Let us see. If, did I actually get this correct or should I flip the sign? I should have flipped the sign, no? This is not correct, correct? So, now whenever x2 is within plus minus 3, right? The way I sort, then this is positive, right? Again x1 is within plus minus 5, this is positive, right? So, this is positive definite in this region. In, let me call this region C, in the set C, okay? Which is this x1 within plus minus, it is a square region, right? x1 within plus minus 5, x2 between plus minus 3, okay? It is positive in C, okay? What else, what else happens? A positive, I would say actually in C0 or interior of C. Do you understand the notion of interior of a set? Everything but the boundary, in this case plus minus 5 plus minus 3 is the boundary, everything inside is the, so basically if I change the inequality to the, to a strict inequality here, right? Here if these become strict inequalities, that is the interior of the set, okay? So, in the interior of the set, this is positive definite behaves exactly like your standard Lyapunov function, no problem, okay? What happens at the boundary? Blows up, goes to infinity, right? So, goes to infinity at delta C, delta C is the notation for the boundary or, okay? Weird function, weird, ugly, okay? So, continue that it is not nice looking, all right? Great. Now, I am going to do standard whatever I do Lyapunov like analysis with this function now, yeah? Because I know that inside once I am, as long as I mean the interior, things are okay, yeah? Notice that this was not, this is the interior by the way, yeah? This is interior point, this is the boundary, right? Because it is a square, right? This is the boundary, okay? Fine, that is okay, that is not a worry. I could have done this with 2.99999999 and proven the same thing, yeah? So, I could have proven this with the interior point also, not a big deal, yeah? It is not worry about that, okay? I start with this. How do I do the analysis? Take a v dot, okay? Do the painful process of taking derivatives, okay? Can somebody help me now? First I have x1, x1 dot divided by 25 minus x1 squared. That is the first good piece. Then I take the derivative of the denominator, right? What is it, okay? All right? Big mess, whatever that is. I do not know. I am trying if this will work or not, but okay. Then I do the second term x2 x2 dot divided by 9 minus x2 squared, right? Plus or minus again x2 squared divided by times x2 x2 dot, this will become plus divided by 9 minus x2 squared whole square actually, yes? Yeah? Whatever this mess is, okay? All right? So, I substitute for the derivatives, yeah? So, this is x1 x2 minus x1 cubed x2 divided by 25 minus x1 squared divided by 25 minus x1 squared whole square. This will become a plus, yeah? I am just doing the computation here and just substitute for the derivatives, okay? Plus, I will take the x2 dot common because that is the control. So, I will get x2 divided by 9 minus x2 squared plus x2 cubed divided by 9 minus x2 square whole square times the control, okay? Yeah? So, this is if I take, if I sort of actually sum them up, so I will get 9 x2 minus x2 cubed plus x2 cubed divided by 9 minus x2 squared times u, yeah? So, this, okay? Yeah, thank you. First term is x1 x2 not x2 squared, I agree. Second term is fine I think, fine, no? Say that again, I did know, where else? Here now, last step, correct? Similarly, this guy will reduce to 25 minus x1 squared whole squared and you will get 25 x1 x2, yeah? Is that clear? What? Not clear? This addition subtraction, nothing much, okay? Alright? Whatever, messy but it is, okay? Now, what is the good thing that happened in the control? This is the denominator, right? It will go up, right? So, now what should I specify my controllers? Can somebody tell me choice of control now? You can, I am sure you can, please tell me. What is the control? I just try to cancel this guy, no first, for the first term and I will just try to cancel the first term, okay? So, what is it? Minus 9 minus x2 square whole squared divided by 9, right? Because that will leave x2 out here. Then I will take, I want to get 25 x1 out here divided by 25 minus x1 squared whole squared, okay? Whatever this mess is, it is something, yeah? It is a big mess, yeah? And this is going to basically cancel this guy, correct? And then, I will take minus kx2, whatever, I do not care, yeah? Because it will give me negative definite term here, right? Give me nice negative definite term here, okay? So, this will leave me with v dot as minus kx2 squared, sorry. I will make my life simple and probably multiply. I am going to do that, yeah? I will make my life simple. I did not need to do it, but okay, yeah? This, huh? This gives me what? I mean, I will just go bobbler's lemma out. It will go x2 gives me 0, x2 going to be 0, x2 dot going to be 0, okay? x2 dot going to be 0 implies control going to be 0. Because x2 dot is the control, right? Control going to be 0, so I have to just check this guy, yeah? In here, I have already proved x2 is going to 0, right? So, this term is 0. Only left with this guy, yeah? Only way this can go to 0 is if x1 goes to 0, yeah? Because x2 is already gone to 0. So, this guy is not contributing, it is positive term, right? x2 is already 0. So, this is, yeah? Positive term. So, this is just a constant. This is not, obviously, this going cannot go to infinity. Do not want it to go to infinity. It makes no sense, right? So, this is basically x1 has to go to 0, right? So, from this I can prove that x1 is also going to go to 0, right? But even if before I prove any of this, notice, before I even went to this step, I have already proved this. Forget all of this mess. To prove everything goes to 0, I have already proved that v dot is negative semi-definite, which means what? Which means v of x of t is less than equal to v of x of t0, right? Now, notice whatever initial condition you started with was inside, right? So, x t0 belongs to c, right? Or c interior, yeah? I am going to say c interior. So, you started in the interior of the set, right? Of this set. I started in the interior of this set c, okay? So, obviously, you can see from my v construction that in the interior it is nice positive definite function and end of finite value, most important. Yeah? If x1 and x2 are in the interior of c, are in c0, c0, then this is a finite value, right? at initial time, yeah? So, therefore, at future time also it is finite value, correct? So, that is the argument. x t0 in c0 implies v x t0 is finite and this implies v of x of t is finite. Implies x of t does not belong to the boundary. That is, you will never hit the boundary, yeah? Because you started at the finite value of v, you prove that v dot is less than equal to 0. Therefore, v always remains finite, yeah? And the only way for v to become infinite is you are at the boundary, okay? There is no question of going beyond, beyond though there is no question, okay? So, you see by making this small change in the v, of course, I chose a different complicated control also corresponding to the v. This is the leapon of redesign. But I was able to ensure that the trajectories remain inside the set and you can verify in this case. You will never, you can try all these tricks that I tried, but you will never get out of the set, okay? So, this gave me a safe control. This is what is called a safe control, right? And it remained inside a set that you decide. It is a set C, right? But also notice that as you get to the boundary, the control here that you see, right? Also does bad things. Control also explodes, at least on one boundary, if not on the other, okay? So, of course, you are never going to go to the boundary. You have already proved it, but the point is if you started close to the boundary of the set, okay? You started at 4.99. So, you can see the denominator here in the first term of control is very small. Then control is big, huh? So, if you start closer and closer to the boundary, you are required to exert more very, very large values of control. Yes, you can. This may also be somehow intuitive to you. You are saying that I am already working at the corner of my operating region. So, I have to work really hard to push it back inside. Might make intuitive sense, right? If you are sort of working at the edge, and you want to push it inside as fast as possible, as quickly as possible. But this is not always required, okay? The system dynamics may be such that, for example, right? That you are naturally going back. For example, if I think, I mean, this is one of the nice example. If you think a pendulum, think a pendulum. And suppose I do not want the pendulum to go out of this by doing my control. At the, my control is at the tip. I do not, I do not want it to go out here, okay? At this edge, right? So, at, but when I come here, notice, this control, my barrier, this kind of reciprocal function-based control will push it really hard back, really back, really hard. But think about the dynamics of the system. If I actually started here at the boundary, I have to do 0, nothing. I have to do nothing because gravity will push it down, right? But my control is agnostic to that. It is going to really give it a real go here. And it will probably hit at the other edge. The fact is the dynamics is such that I did not have to, it falls, no? And have to do anything. At the edge, it falls. I do not have to work. So, these are not the best choice of barrier functions. So, that is what we will see, how to sort of create better barrier functions, okay?