So, now I am going to talk about some theory right. So, I am going to define what my what would I call a some safe set or forward invariant set yeah. And this is defined as C equal to say suppose I define my set using some notice that I have defined it the other way around right here if you see my no I think this is fine right I have also defined it using 25 minus x 1 square greater than equal to 0 9 minus x 2 square greater than equal to 0 same thing h can be an amalgamation of 25 minus x 1 square 9 minus x 2 square right same thing that is the set C the boundary like I said is basically where h x is exactly equal to 0 and then I have C naught I would say the interior of C is the set of x in R n strictly greater than ok great. Now, so typically if you if you see the way we have been defining these is that we have sort of I mean yeah that is fine I mean particular cases. So, the reciprocal barrier function that is what we have just looked at is basically something like say B x is equal to you know something like I guess 1 over h x right this is how we have been using it right it is like 1 over 25 minus x 1 square or 1 over 9 minus x 2 square ok this is how we have been doing right and what we the condition we sort of imposed was that B dot is less than equal to 0 ok this is the sort of condition we were imposing however we do not need this it is too restrictive yeah it can be shown that this is again going back to the same idea that everything inside is also being made invariant in some sense ok. So, we do not particularly need this alright. So, if you go back to our example also again if you go back here if you even in this example what did we do we said that V dot is less than equal to 0 same thing that we do with our typical Lyapunov analysis right not exactly the barrier function, but the Lyapunov analysis right. So, what does this mean? This means that this set is a square right. So, if I start inside this square right if I started close to the boundary ok what will it do it will make some kind of a set that this V is now complicated by the way I cannot really make a shape out of it, but this V is complicated what it will do is it will make a set which is something like this say for example, we will try to get close to a continuous version of a square basically. If you started here somewhere right, but if you started smaller it will make a smaller square right because that is how the invariant set for the V dot less than equal to 0 works right we already saw this. If you start in the inside ellipse you will remain inside the inside ellipse only right you do not have to actually let me think about it in this case would it be true? Actually it is not very clear if that will be true in this case does it mean that the inside set actually depends on how the shape is actually I am not sure honestly speaking yeah because I have to see the shape and this will be a good exercise to see what is the shape of the level sets that is V equal to constant what is the shape that you get here ok it is not very obvious to me what the shape will be yeah yeah I do not think it is because this is looking like what this is is this can I write this as 25 minus 25 minus x 1 square divided by yeah I can write this as 25 minus 25 minus x 1 square divided by this. So, this becomes 25 divided by 25 minus x 1 squared minus 1 and similarly for the other one this becomes 25 over 25 minus x 1 squared minus 1 this becomes 9 over 9 minus x 2 squared minus 1 right. So, it is actually some kind of an ellipse only right some funny kind of a is it still no it is not an ellipse right yeah it is not very clear what the shape will be yeah, but the sort of point that I am trying to make is as you keep reducing your initial conditions you will get smaller and smaller sets that is the hope I guess right you will start getting smaller and smaller sets and the smaller set will become invariant you will not end up exploring the larger set at all because of this condition ok and this is a little bit restrictive again and this happened why because we took v dot less than equal to 0 this kind of a condition is what we use right. So, that is apparently not required this is what some of the research has been apparently all you need is this is what is the relaxation is that v dot is less than equal to gamma over b where I guess gamma is some positive constant ok gamma is some positive constant I hope you sort of understand what this equation is doing ok what is it doing it is saying that if you are very far from the boundary ok if you are very far from the boundary what happens to be typically I mean if you look at our barrier function b is some finite value ok it will give you some you know finite sort of decay yeah hopefully will give you a finite decay I guess let us see if I look at this barrier 1 over hx type of case. So, in our case we are looking at what I am trying to sort of make sense of how this will look for us let us see suppose let us look at our example ok. So, in our case bx was 1 over 25 minus x 1 squared ok. So, unfortunately this may not satisfy this condition which is why I am not very sure ok let us see what is b dot of x this is 2x 1 x 1 dot divided by 25 minus x 1 squared whole square correct thank you right ok no no minus it is a plus that is fine ok that is fine. But this is not going to be very obvious how we are doing it no no no this is not very evident, but the rationale for doing this is at least how it stated here is that the inequality allows for b dot to grow when solutions are far from the boundary ok yeah. So, basically what this will do is that if x is far from delta c in c naught then obviously your b is positive right because of whatever how you have constructed it right b is going to be positive this is going to be some positive quantity on the right hand side b is positive right because I took 1 over hx and h is positive in the interior right h is positive in the interior in fact it will be more and more positive in the interior right as you go further in the interior it is more and more positive ok that is the definition of the set right. So, obviously h is positive 1 over h is also positive ok that is the idea. So, if you are in the interior if you start in the interior you your b is going to be positive and so this is right hand side is going to be positive ok. So, what am I saying that the derivative is less than some positive number ok. So, so basically b can increase ok because all I am saying is that derivative is less than a positive number yeah. So, it can also be positive. So, this allows for b to increase what does the increase of b mean remember b becomes infinity at the boundary what is reciprocal type construction right this becomes infinity at the boundary. So, b increasing means you are going closer to the boundary ok make sense. So, b can increase implies x moves towards delta c this is allowed by this construction ok. So, this was so by this is allowed only in this concern if b dot was less than equal to 0 this is not allowed because it is always going down or not reducing or it is it is never increasing b dot less than equal to 0 means b is never increasing here there is a possibility that b can increase. However, what happens when you go close to the boundary if x near delta c implies b is large right that is how we have defined it you remember 1 over 25 minus x 1 square if x 1 reaches 25 the denominator is exploding sorry the denominator is going to 0. So, b is becoming large ok all right if b becomes very large what happens to this guy almost 0 almost 0. So, therefore, b dot implies b dot approximately less than equal to 0. So, b either does not increase or starts to decrease ok. So, what is it saying is saying basically only this boundary h of x is in effect the inside boundaries are not you know like in this case I could have remained inside right you know I could have remained inside this and not even got in here that is not allowed here yeah here the right hand side is positive for some time you are allowing some growth inside the set ok, but as you start getting closer to the boundary of the set this growth stops ok this growth stops ok which means implies x cannot escape c yeah and this can this is not difficult to show these folks have actually shown it. So, basically how they are saying it is that so this is the b dot sorry. So, what is b dot? b dot is equal to minus 1 over h x squared times h dot and if this is less than equal to gamma over b this is gamma h right. So, this condition means that h dot plus gamma h cubed greater than equal to 0 yeah this is what you will get. So, what did I do to get this is I think it is evident right b is defined as 1 over h x right. So, b dot is this guy correct I think I did it correctly verify b dot is minus 1 over h x h dot h x square h dot and the right hand side is gamma over b and that is this guy yeah this is gamma times h right. So, that gives me this kind of a differential inequality yeah this can be solved yeah using your comparison lemma type results and they have actually solved it I am going to just write it h x t x 0 is greater than equal to 1 over square root 2 gamma t plus 1 over h squared at x 0 ok. So, you get this basically just by solving this with initial conditions on x and all that not difficult right you can just solve this equation yeah this is a differential inequality you can just solve the equality and then by the comparison lemma make it greater than equal to done. So, you will get this solution yeah please verify this I am also not sure, but it is not difficult to see that this is already giving me h greater than equal to 0 right right hand side is positive yeah right hand side is positive not a negative quantity right. So, this is you are always getting some positive number on the right hand side which means what you are inside c right for all time right. So, this implies what c is forward invariant ok. So, this kind of barrier function already did something better than what we did by making b dot is less than equal to gamma over b of course, you have to be careful how to choose this b and all and then how to make it. So, those things are not obvious here yeah unfortunately I am not sure we will have time to discuss those, but this is how you define a barrier function ok. This is the right way that you want this to happen ok not less than equal to 0 yeah that is just too much to ask. If you can enforce this via the control design excellent it would be the best way to do that this happens ok. Now one final notion yeah that I sort of want to talk about is basically the notion of which is slightly more than this it is zeroing yeah just a second which this why why are you saying it is negative t is positive no no it is the positive square root no no no do not worry about that it is always the positive square root you can that you can verify in the solutions yeah yeah ok I mean it is a see the basic ideas is the continuous the solution is continuous right yeah. So, either you are always positive or always negative ok and at initial time if you are positive there is no point in taking the negative square root no the solutions are continuous. So, you will always work with one side only yeah yeah yeah ok alright zeroing barrier functions ok this is what is a little bit more advanced right not much ok. So, sort of the final notion I will sort of take a few more minutes and we will be done yeah here even in the previous case if you see your your function still became infinity on the boundaries. So, you can imagine whatever you do whatever these tricks you do to make sure that the inside side does not become invariant and all that great that works, but your control might still go unbounded if you start close to the boundary because that is a feature of how you define it just like here right control contain this guy you start close to the boundary same D even there because that is how you defined your barrier function 1 over hx ok. So, this is one un un seemingly thing that you want to avoid you do not want the control to become explored as you get start close to the boundary right. So, that is where the zeroing barrier functions sort of come in they defined in a slightly different way let us see I will I will talk about it first we define the notion of a extended class k function you already know what is a class k function because it is 0 at 0 and strictly increasing but the arguments are always taken to be argument of a class k function is also taken to be positive whenever you define a class k function alpha you say that it goes from r plus to r or whatever right. Now we do not do that now it is allowed to go from r to r ok. So, this is basically the notion of an extended class k. So, alpha 0 is 0 and alpha strictly decreasing basically negative arguments are allowed ok negative arguments are allowed that is the idea it is not necessary that the argument must be positive because if you remember we always take this class k function as norm of x and norm of x square and which is basically argument is the norm right. So, the positive arguments are positive here the argument do not have to be positive ok. So, basically negative argument allowed that is the whole point because once you start at 0 at 0 of course, it is going to be positive for values greater than 0 of the argument but values less than 0 no right. So, that is the important thing. So, this is why it is a sort of this is the sort of extension of if you remember Lyapunov functions are always positive definite and how was positive definite is defined by comparing it to the class k function right. Now we compare this barrier functions with a class extended class k function ok this gives us flexibility on both sides right there it was the function was always positive. So, the Lyapunov candidate was of course always positive here the function can also be negative. So, therefore, this function can also go negative that is the whole point here alright ok. So, suppose you have again a definition to 0 in ZBF is the 0 in barrier function how do we define it yeah. So, this is h belongs to C1 is ZBF for set C and we have defined the set C the safe set right if there exists extended class k function alpha and set D with C being a subset of D being a subset of Rn such that for all x in D LFH x is greater than equal to minus alpha Hx ok yeah. So, remember a dynamics we were looking only at a dynamical system there is no control. Therefore, only LFH no NG and all that. So, LFH is what just H dot right is just H dot in the along the trajectories of the system. So, this is the direction derivative. So, what am I saying I am just saying that there is a larger domain of course the C has to be part of a larger domain and in that larger domain this H dot must be greater than equal to minus alpha H right. Now the one of the simplest so, now notice that H itself the way we have defined C notice yeah we have we have defined C H can is not stopped from being negative right. In this definition it does not say H cannot be negative or anything like that right H can be negative right it is all we all we are saying is that whenever it is greater than equal to 0 it is the set C right otherwise outside the set C H is potentially negative right because whenever it is positive it is in the set C right. So, whenever you are outside just like here in these examples I mean I guess you can see this example itself right when H is positive X 1 is less than phi plus minus phi X 1 is between plus minus phi if H is negative it is outside ok. So, H negative is allowed no problem yeah ok great. Now what do you want we want H dot to be equal to greater than equal to minus alpha H. So, this is basically a this is a or a simplification actually this is a generalization that way this is a generalization of what you take alpha there is this extended class k function as H itself alpha of H is just H yeah because it is it will be 0 at 0 and then increasing on the negative side it will go down no problem straight line basically it is a straight line yeah. So, if alpha function is taken as the unit function itself then this is the this is the generalization of this case. So, what does this give me? So, what do you want to do you want to basically maintain H greater than equal to 0 yeah I hope that is obvious. Now if I solve this equation what do I get let us look at this equation because it is solving the this one general one is difficult let us try to solve the simpler one what is the solution H of t is tell me everything e to the power of minus gamma t let us say initial time is 0 and done H naught thank you very much this is important H naught ok. Now suppose if starting in C or I should be more precise if x starting in C then what do I know I know that H naught x or how do I say H 0 H naught which is defined as H at x 0 is definitely greater than 0 I will say in t here of C. So, H naught is positive right because that is how I defined H right. So, what does this mean implies H t is always greater than 0 and H t goes to 0 as t goes to 0 ok alright. So, what is the good thing in this case in this case what is the nice thing nice thing is that again I mean it should be obvious to you that x of t is also in C yeah also in the in the interior for all time forget infinity infinity is not a real numbers. So, x of t is going to remain in the set C. So, this definitely this method also made it invariant ok, but it has a nice structure right I mean is nicer structure there is no reciprocal happening here there it was H dot is gamma over H here it is gamma times H ok. So, also nice right. So, again a similar feature that you will see is that here as you go close to the boundary H is going to go to 0 going to go towards 0 right. Therefore, by this law as you go close to boundary you will stop moving gamma H is close to 0 stop moving you stop further increasing or anything yeah if you are far from the boundary H could have large values yeah it could have large, but you are inside the set suppose you are of course if you are inside the set let us assume you are inside the set yeah H is positive ok could have large positive value as you go further in and in the set yeah. So, H is decaying which means it is being pushed towards the boundary earlier we were looking at everything in that the perspective of 1 over H therefore, we were thinking the other way around now is the other way around 0 is H equal to 0 is the boundary. So, as you are in the interior H is large therefore, minus gamma H is large therefore, you can potentially get pushed towards the boundary right because H dot equal to minus gamma H is basically going to push you towards the boundary it is going to reduce H right that is fine yeah you are allowed to explore that region and as you go close to the boundary H is going to become 0 you do not further move you have stopped ok. So, that is the idea that this there is no reciprocal nature here. So, when you do a control design with this we are of course out of time we will not be able to do a control design and all that, but typically constructing these is not easy that is the thing typically how this is done is folks usually solve quadratic program they do not actually what they do is they do not actually they only construct the H and they put a quadratic these are all quadratic program conditions right if you see this is a QP type conditions these are actually QP if you do not see also I am telling you this is QP type conditions yeah this is like the barrier condition and corresponding there will be a control condition which is going to make states go to 0. So, there will be a control condition, barrier condition and the two are solved simultaneously using a quadratic program using some say I want to minimize control or something like that and this so they do not actually solve this by hand analytically. So, it is not typically easy to solve all of these by hand, but this reciprocal ones you can see you can do by hand I would really strongly suggest that for the same sort of example you try to construct these zeroing barrier functions also alright. So, why is it called zeroing barrier function because at the boundary we did not do anything earlier we took a reciprocal right 1 over Hx and things like that here we took the H itself as the barrier function H itself is the barrier function right and we just ensuring that the H is such that H dot is greater than equal to minus alpha H okay which means that it has a nice zeroing property yeah the barrier function becomes 0 at the boundary because the barrier function and this function are kept the same functions to be honest yeah. So, the barrier so that is why it is called a zeroing barrier function on the other hand when we took the reciprocal ones at the boundary they explode here they become 0 right. So, it is like you stop moving at the boundary right therefore you will not need large force to push it back typically okay that is the idea. So, I would really recommend that for some simple example like I tried you try to come up with a zeroing barrier function okay it is essentially this H of x function that H dot is greater than equal to minus alpha H can one come up with that and so that if you are looking at the control problem there is no difference per se right it is it is all these conditions this condition becomes exactly the same thing just with the control right and this condition becomes okay it is just the CLF condition right this is the conditions that is all it is just that you have a control term here to play with this helps you in the design in the control case you have a control term now and you can play with the control so that with whatever B you have or whatever H you have with using this control you can get this that is the whole idea yeah I would strongly recommend you try because that is what we did it we did the control problem I will post this article and you can take a look yeah there are rather nice articles the entire field of bipedal robot walking is now relies on this okay they this is the Aaron Hems group and these guys are pretty much experts at it okay all right okay