Good morning, everyone. Thanks for coming here for our unofficial American holiday yesterday. So we have to cover all the sets today, right? I think everybody realizes that. Oh, there you go.  OK, so but first, I want to let you know Project 3 is posted on the website. You should be looking through and, oh no, you should be looking through and reading it now. You should be thinking about it. Really, you should get started on it now. You have lots of time to work on it. Lots of time to work on it. It's due March 4, but you will need all of this time. So if you're starting this project in March or even the end of February, there's going to be nothing I can do to help you. It's a complicated assignment, but it's really cool because we're putting to practice the things that we've talked about in class. So you're going to be reading in the description of a context free grammar. And to do that, we've actually given you the description of the grammar that you're going to be reading in the context free grammar. So you have to write the code to interpret and that context free grammar. Then once you have that, then there are. So this would be an instance of a context free grammar. I'm not going to go into the details right now. We're more in depth on Wednesday or today if we have time. Then there's three different tasks that you need to do. So one, tasks case 0 is a simple just output some information about the grammar to make sure that you've read it in properly. Case 1 is calculate the first sets of the grammar and then output those first sets. Case 2 is calculate first and follow sets of the input grammar and output the follow sets. And so kind of skipping down to the points. So this is kind of the point right now. There'll be test cases on the servers for each of these things. On the submission server, you'll be given in that zip file those test cases. We'll be a subset of the actual test cases that are on the server. So you won't have all of them. So you have to be responsible for creating your own test cases. Quick questions on this at a high level. I expect you to spend some time reading this. You'll be getting very, very, very familiar with it. You can do C or C++. One important thing I will note now I'll try to note further on, you're going to be reading in an input language, right? So you can for specifically allowing you, if you want to, you can use the lexer.c and the lexer.h from project 2. But this is why we have this important warning here, right? That's for possibly a different input language with different tokens and symbols, right? So you can use that, but it's up to you to then modify it to work on this assignment. It's not just a drop-in replacement. If you try to do that, you will encounter a problem. Yes. But it's a good starting base. So you can rip any code out of there, it's fine. You can rip functions out of there, whatever that skip spaces function is kind of useful, whatever you want to do. Or you can just write something, a new lexer, or whatever completely from scratch. OK, and to help motivate the start early, start now, start reading the assignment now, start thinking about how you're going to program this, right? Because this will help make sure that you actually understand how to do first and follow set calculations for the midterm on Friday. So it's good practice in that aspect. Also, so this is last semester's project 3 grades, reverse sorted. So there's, I mean, if you don't start, these are people who started late, didn't submit anything, submitted stuff that didn't work, didn't compile, didn't pass any of the test cases. So just like project 2, it has to match exactly the output, being kind of close doesn't count. But you can see that it gets up in the 70s, gets into the 80s. And then we had a lot of people who got 100. So there's a significant amount of people that got 90 or above. But it's hard, and it's supposed to be hard.  Because you're doing this basically all through the scratch. And we will plug me. OK. So now let's talk about first sets. So why were we studying first sets? Why did we even care about first sets? You guys said so? Part of the reason, yes, but the deeper reason. I think it will eventually make it easier to obtain parse tree. So our end goal is to, we want to write a predictive recursive design parser. So we want to be able to tell, just by looking at one token from the input, which rule to apply. So we said that, hey, if we calculate the first sets, then that can help us distinguish between which rule to follow in doing parsing. So for instance, if I have a grammar like this, S goes to big A, big B, little C. I have A goes to little A or epsilon. And I have B goes to little B, big B, or little A. So then it was calculating the first sets here. I'm not going to go through all the steps. So let's first start with the easy case. What's the first set of A? Little A or epsilon. Little A or epsilon. What's the first set of B here? B or A. B or A? And so then what's the first set of S? So A, what was it? A, B, or epsilon. A or B, A, B, C, or epsilon. Oh, yeah, A, B, A, B. So A, so we get the A, the small A from the fact that there's a big A here. So we add the first set of A minus epsilon to the first of S, right, B, A. Now, because there's an epsilon in the first set of big A, then we add the first set of the next one minus epsilon to S. So the first set of B minus epsilon is the secantating B, the secantating A. So we add B. Do we add then the first of C to the first of S? No, because there's not a first. Exactly, there's not an epsilon in the first set of B. If there was no epsilon in big A, would it just be for the first set of S, or it just be A epsilon? So if there was no A here like this, we're just like that? Yeah. So then what would be the first of big A? A. Just A, yeah. And then the first of S would be just for one. We add the first of big A, right, minus epsilon. And then we say we add the next symbol if there is an epsilon in the first set of big A, right, which there's not. So we don't go further down the string. We don't look at anything else. Yeah, so because of this, we know that all strings that S possibly generates. Yeah. Do you have to start with A here, or would we start with S first? Do not. You could do it in any order, but to do it like this without doing a table, I would start with the base cases that it's clear. It's just going to be based on that. But if you do it, it doesn't matter what order you do it in percent. No. But essentially. Exactly, when you're programming it, or when you're doing it in a table, it doesn't matter the order. As long as you keep going until you reach, until nothing has changed by finding the rules. Yeah, so based on that question, but I'm guessing you already answered it. So for our assignment, if we were to get a longer S, I don't know, like a 20-digit or something like that, like a 20-letter, and if we wanted to calculate the first of S, we could just do that without counting the sub, not the substance, but first of S, first, right? OK, so if I just asked you to calculate the first of S, then yeah, you only really need to see first of A, right? Then you can look at first of A, but for parsing, we care about all the non-terminals. So that's why we do the whole table with all of them, right? Because at some point, we're going to be parsing A, right? We want to decide between these two rules. And so then we need to know what's the first of A or what's the first of this other type. So yeah, there's definitely cases where we'll need to know. And there you go. Well, we'll see in a second. OK, so let's go back to parsing for a second, right? Let's say I have a string. So is this string in this language? Does this grammar generate this string? No, not C. Oh, no, C is up there. That's the language. Right, so how do we tell? How do we tell? How do we prove that this string came from this grammar? OK, so first set. Yeah, that's the first check, right? We can see, OK, S, does it start with either an A or a B, right? If it doesn't, we can throw one right away, right? But the way we prove this is we show either a parse tree or a derivation that says, hey, this is exactly how you can get to this string starting from S, right? So let's try to draw the tree from here, right? So this is what parsing is going to actually do. But let's draw the tree here, right? So we have S, which rule of S production rule do I choose? A, A, this, right? Yeah, this one. There's only one choice. I don't have a choice. So it's got to be S goes to big A, big B, little C, right? Now we need to decide what does this A go to, right? So looking one character ahead, which of these does this go to? You can't tell when one character gets a look at the next. I can't tell. I have the first of this A is A. The first of this is that one. So why can't I tell? Can't we say it goes to all three because there's two A's. So it could go to A and the first A and then A and B. What do you mean all three? There's only two rules here. We're trying to decide between these rules, right? So we're trying to draw the tree and say? The second, the middle part is B and A, which would come from the first B in the straight. So can we say the first one comes from terminal A? The first terminal A comes from A, and then what was that like? The B and A would come from terminal B. But how do we know that just from looking at one character, right? We're only looking at this one character. Because it's alone and by itself it's in terminal A. And it's the first one in the sitting line order. So we can select that one. Isn't it A or epsilon? One of those. Yeah, so that's the choice right now, right here. So we have to make a choice here. We're trying to parse this A.  So why can't we tell? We have first sets, right? Can we be able to tell? Both the first sets of A and B include lower case A. Why do we care about B though? Because S is A, B, and little C. A, B, and little C. So B essentially comes after A. If it was like, let's say it's like this, if it was like this, would we be able to tell? Yes. Yeah. We know it has to, we look at one character ahead, it has to go to A. We can choose this rule, right? But exactly what everyone is pointing out, right? The fact that we have an epsilon here means that, well, if this goes to epsilon, then this A that we just read could actually come from the B after it, right? It doesn't necessarily have to come from the A. So now we get to this problem of even though, for each of these rules that we just look at this B, so we can look at the first character and say it's either this rule, right, which does little B, or it's a little A. We can distinguish between those rules. If I take A, I have a little A and an epsilon, well, theoretically I could distinguish between these two rules, except that it depends on what comes after A, right? So here, if this goes to epsilon, well then this starting character that I'm looking at could have come from whatever came after A, right? Which is the purpose of epsilon. So the problem is right now, first sets don't help us. They don't help us to distinguish this case, right? Typically when we have epsilon, first sets become, aren't actually enough because really then the question is, okay, what does B start with? If B starts with an A, right, then I know that A should go to epsilon, but if B can't possibly start with an A, let's say it can only start with a little B, right, then I know I need to choose this rule A goes to little A and A won't go to epsilon. So as it is, this grammar is actually... The problem is that second A in the language of B. So the problem is that second A in the language of B. Exactly, but it's only a problem because B follows A here in this rule. So the language as it is right now, we can't actually do a predictive parser to determine which rule to take here between little A and epsilon. But we need more information. We can't just use first sets. If we had, we could change this grammar around and have it be B, A, right? So here I can say, okay, this definitely goes to a B. I can say, okay, we have B, A, a little C, B, right? Looking one character ahead, do I know which one of these two rules to choose? Yeah, it's got to be this one, right, little A. Yeah, so that consumes that input. So now I go back to A and I'm saying, okay, just looking at this B, can I decide which one? I have to choose epsilon, right? Yeah, it's definitely got to be epsilon, but is it correct, right? We know that it can only be little C, right? So yeah, so this part here, so now I actually know here that it's a parsing error. If I were to change this, get rid of that. Okay, if I were to change it here, where I have C here, right, so I get this C. Now I can accurately determine between these two, right? So I know from looking at this rule, where A is used on the right-hand side, I can tell that, hey, if A goes to epsilon, then C must follow big A, right? So if when distinguishing this rule here, I can say, okay, it's either little A or it's little C, and if it's little C, I choose epsilon, otherwise I give up, right? I'm done. So this gets us to the concept of the follow sets. So first set describes the all strings that that subtree can generate, right? So the first set of B describes the starting terminal for all strings that B can generate. The follow set says, hey, what could start after B, right? So all possible combinations of terminals that come after B. What's that character that can come after B is generated? Let's look at an example. So let's get into some types. So when we think about the follow set, it's going to return a set of terminals, right? So it's the thing that can follow this character, right? But can epsilon ever really follow the character? Yeah, not that we care about, right? We're going to be looking at the string, right? There's going to be no epsilon in the string, so we want to know what that actual character is. Now, look at here. What follows S? So if you draw here, right? It's going to generate some big tree. What's that first thing that's going to be after S? End of file. Yeah, end of the file or the end of the string, right? Because S can generate the whole thing. So we'll use the symbol actually from regular expressions of the dollar sign. S sign represents end of file or end of input. So we want that in our follow sets, right? That kind of makes sense. So our follow sets are going to return either a set of terminals and the end of file. A set containing either terminals or the end of file, which we're representing with the dollar sign. And the input is going to be a non-terminal. So we have a grammar, right? We're looking at grammars.  We want to ask, just kind of looking at this, right? Let's try to develop some intuition by looking at this. So what's the follow of S? End of file, right? And we know because it's the starting non-terminal, right? So that all, you know, S is going to be the root of all possible parse trees. Is in every context for a grammar, S going to be exactly the end of file? No? Why no? Is the end of file always going to be in S's follow set? Yeah, so that's actually our first rule that we'll look at, right? So it's the starting non-terminal. It's always the root, right? There's nothing about a context-free grammar that says S can't actually be a rule here on the right-hand side somewhere, right? So S will always be the root, but that doesn't mean it also doesn't appear as a non-terminal end of grammar. But that's fine. We know how to deal with that, right? We just expanded that one. So what follows A in this example? Big A. And where do we look, right? We talked about where to look for first sets. Where do we look for follow sets? Which one of these rules, these production rules? Whatever would come directly after the first A? Big A? Can B come after A here? No. Bars are OR, right? So this means there's three different rules here. Or a B or a C. So B actually, big B can't actually follow A, right? Do you look at this rule? Does this rule tell us anything about what can come after this rule here? It's a terminal, so after would be nothing. We're talking about big A, right? Isn't it anything? So think about it in terms of the tree, right? So you kind of write with this. So we have our tree. Well, this is cool. You guys see that? So we have our tree A, right? This rule describes everything that comes... This is really hard to actually write like this. That's way more sense than the other one. So we have our A here. This rule describes everything that can come here. So this is why for first sets we care about that because we care about what's here. What's the first terminal that this tree could possibly generate? But for follow sets, what do we care about? Whatever comes after. Yeah, right? So this rule tells us absolutely nothing about what comes after this first set model. It's really terrible. That's why I'm not an artist. So this rule doesn't tell us anything, right? So when we calculate follow sets, we don't want to... We only care about looking where the non-terminal, in this case A, is used in the rule itself here. Or on the right-hand side. Where it's on the left-hand side. The left-hand side only tells us what it actually generates, but its usage tells us what could possibly come afterwards. So from looking at this, what follows A? The same thing that follows S, right? S will generate A, right? So we know that from this rule we have S... That's terrible. S goes to A, right? And then there's nothing after A here. So it's got to be whatever S, whatever follows S also follows A, right? So A is going to also be the end of file. So what about for B? Which of these four production rules do we look at to try to calculate the follow-up of B? Well we have to look at B first, because we have to figure out what the first in B is. No. We don't care about the first in B. So we may not care about it. That's not 100 percent true. S and B? Yeah. So we care about rules one and three, right? Why rule three? Because we just made a whole terrible drawing about why we don't care about looking at that. Because it references itself. B is a recursive rule. It's on the right-hand side, right? That's what's important. So we look at all the rules where B is on the right-hand side, and that occurs in rule one and rule three. Right? So for rule one, what do we say is the follow-set of B? Dollar sign, right? End of file? What about from here? What follows B here? B. Lowercase B. Lowercase B, yeah. Right? So we know whenever we see a B, the next thing after a B, better be either the end of file or a little B. So what about for C? What follows C? Which rules do we look at? One through four? One and four. One and four? Right? So what do we get from the follow-set of C for rule one? Dollar sign. Same thing, right? Dollar sign. What about here? What do we get for the follow-set of C? Lowercase C. What about the epsilon? Doesn't matter. It just leads back to dollar sign. No, the epsilon doesn't matter, right? We don't care because we're only looking at the usage in the rules. Right? We're only looking at where is big C here and what follows right after it? Rules for a second. So we kind of already have our first rule, right? So we know that the end of file should be in the follow-set of S, right? So if we have a rule like this, how do we calculate the follow-set of D? We can find where D is on the right-hand side. So we just have this rule? Just that rule? This is where it's used, yeah. Dollar sign? Yeah. Why? Because there's nothing after it. Because there's nothing after it? So then what do we do? Dollar sign. Is it because there's an epsilon there? Is there an epsilon there? The follow-of D. Why? Think about the tree, right? So S, right? We have S.  It's a little better tree. So we know the first rule here that we're looking at, S goes to A, B, I didn't believe myself in a room here, C and D, right? So now we think about this tree that D generates. What do we know about its relation to S? When the D tree ends, the S tree ends? Yes, because it's the rightmost non-terminal, right? So whatever tree that D generates, right? What we care about here is what possible terminals or end of files could be after S, right? So if I say, okay, I already know that. If I've already calculated it for S, right? And I have a rule that says, well, the rightmost symbol here, D, generates the rightmost tree. So this means that the end part here is going to be the same. It's either going to come from D or it's going to come from S, right? So then we should add whatever was in the follow of S to the follow of D, right? And we know this because it's the rightmost symbol. I think I may be going in the wrong order, but that's fine. So then, kind of by the same logic, let's say I have the same rule, right? But now I have, I know that, let's see, first of D is, let's say it's D epsilon, right? So does this change this rule? No, right? We should still do that all the time because it's always on the right-hand side here. So how does this knowledge that there's an epsilon here in the first set of D, does that change? Do we do anything different here? It's picking D, like little D. So you pick a little D and then after that you do follow of S, which is just the empty set. And it's the same thing for epsilon. Okay, let's think about it in a different, a little different way. So just using this kind of logic, where do I move follow set of S, right? So here I can basically say I add the follow set of S to the follow set of D because D is the rightmost symbol, right? Can I use that logic here with, I don't want to erase this, I don't want to draw it again. Let's just move the screen up so it's gone. Can I use that logic here to add the first set of S to the first set of C? I want to do follow of C. I want to see where follow of S goes. So I always add the follow of S to the follow of D. So for any, and it doesn't have to be S, right? So this kind of says for any rule, for any production rule you can add the left-hand side's follow set to the right-hand's rightmost symbol's follow set, right? Because they're going to be the last part of the tree. Well if the rightmost follow set is empty string. We don't have enough knowledge for that. We don't know that or we can't assume that at this point. So then do we add the follow set of S to the follow set of C? Yeah we can't because when we look at the tree we see okay, X, C is going to generate some part of this tree, right? But what follows S doesn't necessarily follow C, right? Because there's a D in the way we can see that, right? Unless we know that D could possibly go to epsilon, right? So we know there's some possibility that we have, right? A, B, C, D. So we have some possibility that this goes to epsilon. So what does that tell us about C's tree here? That it could be instant halitane with rightmost. It is the, in that case it would be the rightmost some tree here, right? Which means that whatever follows S also must follow C. So what if there's an epsilon and C's follow set? Then B. Then B, right? And then what about the follow set? The epsilon and the first set of D. Exactly. That's why we need first sets, right? Because we've calculated the first sets tell us that hey, this could go to epsilon. This is one way to get it to go. So basically I'll kind of write, this could be rule two. These aren't the actual ordering numbering that I use, I think. But this rule is kind of like base case. These two rules are very related. They tell us how to propagate the left-hand side to the right-hand side. So follow set. So basically this would be like follow of S to follow of C if epsilon is in, sorry. If epsilon is in the first of D. And right, so you can probably assume that this is the way to write this mathematically. So it works for any kind of I in here. You can always add the other one if there's epsilon's in the first set here. So we'll see that in a second. But the logic here is very simple. So we can always add the left-most side to the right-most side. Follow set. And then we can add the left side to the second one if there's an epsilon in that first set. There's a little C. Just confusing. Let's get to a little E. A bit. That's a little weird. Go back to C. So what do I know about from this rule? So I can apply those other two to calculate follow of S into follow of D. But this rule, what do I know about this rule for the follow of B? It's going to be C. Why? Because C is a terminal. And what do we know about C, what do we know about C from this rule? Follow of B. Yeah. No. Follow of B. So let's change it slightly. Let's go back to our original one. Now we have big C. Let's say I know, because I calculated this, I did it correctly, that the first of big C is the second containing C. Now what do I know about the follow of B? The first of big C. The first of big C? Why? Because the first, it can be the first of big C, as long as the first of big C is not epsilon. Yeah. So it's the first of big C minus epsilon. And we can also know that because epsilon is not in our follow of S. So that's part of why the textbook helps, is that it should only be terminals or end of file dollar sign. If you ever have epsilon in a follow of S, you've done something wrong. So just because they're next to each other, I know that it goes back to the trees again. I know at some point this rule is going to be chosen, and I really don't want to draw the tree again, so I'm just going to go back here. So I know that B is going to generate some tree, and so if I, ah, I do have to draw it because I think it's important to draw it bigger. So C generates something, D generates something, B is going to generate something, and A is going to generate something. So in this picture, what is the first of C? It's a little C, but what is it in this picture? It's right here. It describes all characters here that could potentially, let's see if I'm pushing it hard. It describes all terminals that C could possibly start with, that subtree. And then if I look at subtree B, this is exactly what I'm looking for. I'm looking for what are the terminals that could possibly come for after B. I've already calculated the first of C, so I know I can add that first of C minus epsilon to B. It changes slightly, and we still have this rule. And what if we say that the first of C is now C epsilon, and let's say the first of D is the second time D. So what's the follow of B? The first of C minus epsilon. And then because there's an epsilon in the first of C, then I can add the first of D. To the follow of B, yes. These do get a little tricky. And so I'd also do this here, obviously, if I was trying to calculate the follow of A, I'd use the same thing. I would say, okay, look at this rule. Add the first of B to the minus epsilon to the follow of A. If there's an epsilon to the first of B, then add the first of C to the follow of epsilon, or a follow of A, and so on and so forth. So these are basically rules four and five, right? It's that big C over there. Where? Here's big C, this is little C. And the follow of B above the line, that's a little C. Anything in the sets, right, are terminals.  These are non-termals, also non-termals. Which one did you define as rule four? Rule four is the simple case, just always add the one after you, right? So if you want to calculate the follow of B, you should add the one after you. Add the thing that comes after you. Add their first set minus epsilon to your follow set. Done. Always do that. You never have to think. The only time where there's a possible case is if there's an epsilon here. And of course, if there's something else after we're here like E, and there's an epsilon in the first of D, you would add the first of E to the follow of B. It's just a simple recursive thing you keep applying. Questions on the intuition or ideas behind these rules, we can look at what they exactly mean. We're going to measure up if the order is different. So if we have a non-termal A, we want to calculate the follow of A. What we saw, we first need the first sets, right? So when you're doing your homework and stuff, you want to make sure that your first sets are pretty rock solid, right? Your first sets depend on the first sets. So if your first sets are broken, it really doesn't make too much sense to spend a lot of time coding follow sets when you've got something fundamentally wrong. Okay, so we're going to do this in the exact same way. So it's going to be fairly straight, hopefully straightforward if we've been following the first set calculation. Follow sets should be easy. So we first are going to initialize everything to the empty set, right? Okay, all the follow sets are empty sets. And then we apply these five rules that we just derived until nothing changes, right? We're going to do that in steps. So the first rule is the rule we talked about, right? For the starting symbol of the grammar, add the end of file to its follow set, right? Which makes sense, right? If you're the root, then end of file has to come after you. Okay, we did do it in the right order. That's good. Cool. So if we have some rule of the form B goes to alpha A, right? What was alpha that we've been using as kind of a symbol? A sequence of symbols. Yeah, a sequence of symbols. Non-terminals, terminals. We don't care, right? Just anything. This just means the rightmost one. Epsilon could also be a sequence of like zero, right? In the case that there's just B goes to A, right? Then we add follow B to the follow of A, right? So the way I like to think about it, this first rule, base case, right? Always do this. These next two rules tell you how to propagate follow sets, right? So this says, hey, I can always add the follow set of the left-hand side of my production rule to the follow set of the rightmost symbol. And this next rule says, okay, what if A has an epsilon in its follow set? Or in its first set, sorry. If A has epsilon in its first set, then we're gonna add the rightmost symbol of alpha, right? And this just says we can keep doing that as many times as we want. So for all of these, let's call it, we're using C here, right? C zero through K, right? As long as there's epsilon in all of those first sets, we can continually add the follow set of B to the follow set of A here. We can do this as many times as necessary. So these are just about propagating follow sets, right? So you only need the first sets here to deal with this third rule. So our next rule says, okay, what do we do when two things are next to each other in the rules? So this just says, if we have whatever rule here, and actually in this case, we don't even care about B at all. B has absolutely nothing to do with what we're trying to do here. We say, okay, if we want to calculate the follow of A, we just take the next symbol, right? Add the first of the next symbol, whatever it is, non-terminal, terminal, right? Take the first of that minus epsilon and add it to the follow set of A. Yeah. Question on rule three. So for example, if C zero, so let's say C one, C two through C K, R is just epsilon, and then C zero is a little C or epsilon, then if you do follow of A, it will be little C or in line, right? That's what the next rule gets to, is what to do. What to do if there's an epsilon in the first of C zero. But in this case, you just always add, this you always do, so it doesn't matter what's in the first. They just said that you always add. Yes. Exactly. Yeah. So all these rules keep adding and changing things. Yeah. They don't tell you what it exactly is, right? Even this first one. Right. It doesn't say that S has to be the second thing. Exactly. So then the next rule just says, okay, if there's an epsilon in the first of C zero, then you can add the first of C one minus epsilon to the follow of A. And then if there's an epsilon in the first of C one, then you can add the first of C two to the follow of A. And you can do that for as many times as there's epsilon in those first sets, right? Because we calculated, okay, we know that there's an epsilon in the first set of C zero. We know there's some combination of rules that can be followed by C one, whatever the first of C one is. And then the same thing, C one could go to epsilon and so, okay, then we can add C two, right? This just says it in a mathematical way. That means we can do this as many times as we want for all possible Ks that meet this criteria. Questions on this? All right, let's run through an example. The nice thing about follow sets, so if you think about it, right, do these two change based on what the current follow sets are? Does the first one change? So this is only adding first sets to follow sets. It's first sets to follow sets. The first one just adding dollar sign to the follow set in this particular case, right? So actually rules two and three are the only ones that change. And basically these say how the first sets should propagate. These kind of say how to populate the first sets. So I don't have like a proof for it, but all the times I've done it, follow sets kind of converge very quickly.  So let's look at an example. I think it's the grammar we've been working with so far in the slides examples, right? We have S goes to A, B, C, D.  D goes to little D, big D, or epsilon, right? So we've already calculated the first sets of all of these, right? So what's the first part of our algorithm for calculating the follow sets? Initialize them all to zero. Not zero. Empty set. Empty set, right? So we initialize them all to zero. We have our first sets. We have our rules. I need to really do that better. Okay, right? So we do our first rule. We say, okay, let's calculate the follow of S, right? So we say, does the first rule apply? Yeah. And then we say, is S used in any of the right-hand sides of this production rules? No. Exactly. So the other rules, right, rules two through five only apply if it's used on the right-hand side. If it's not, then, hey, don't worry about it. Okay, what about calculating A? Which of the one, two, three, four, five rules am I going to look at? One, two, three, four, five. What am I looking for? How do I know? I want to calculate the follow of the A here. You look for uppercase A on the right-hand side. Yes, I look for uppercase A on the right-hand side. So which of these rules has uppercase A on the right-hand side? Rule one. Right? Let's start with rule one. This is first. Right? So we only look at this and we say, is it the starting non-terminal? Nope. Is it the right-most symbol? Nope. Is there epsilons all the way from A to in the first sets of all the symbols from A to the end of the grammar? To the right-hand side? First of B is little B, so no. Right? So this rule can't apply. This says there has to be epsilons in all of them, BCD. Yeah, BCD. Does rule four apply? Is there something after A? So what's the symbol that's after big A here? B. B. So let me add the first of B minus epsilon. Let me add the first of B minus epsilon to the follow of A. So we have B. Then is there an epsilon in the first of B? Nope. So we're done. This rule doesn't apply. So now we've got to move to our second rule. We have to look at every place that A is used and we say, okay, we know it's not the starting non-terminal, right? Is it the right-most symbol here? Yes. Yes. So which of the follow sets am I going to add to the follow set of A? Yeah, the follow set of A, right? How do I know the follow set of A? I'm calculating the follow set of A. Because A is also the left-hand side of that rule. Right, so this says you can add the follow set of the left-hand side to the follow set of the right-most one, right? This B is just a placeholder that says if the left-hand side of this rule, right? So here I can take the follow set of A and add it to the follow set of A. How do I know the follow set of A? Currently empty. Currently empty. I've calculated it, right? This is why I pre-calculated it. So I add the empty set to there. It doesn't change anything. I say there's nothing after us, so this rule can't possibly apply. Then we say there's nothing after us, so we can't add anything that comes after big A here, right? So this rule doesn't apply. This rule also doesn't apply. So the follow set of A is a little B. Then calculating the follow set of B, right? I look at this rule, the top rule, right? So I'm going to say it's not the starting on terminal, right? Is it the right-most symbol? Are there epsilons in the first set of everything after B to the end of this rule? Yes. Yes. So I have to add the first of what to the first of B? First of S. First of S, right? So the first of B is going to have an F end of file in it, right? Who calculated here? The follow of S. There's an epsilon in what comes after it. From the end after it to the end of the grammar, right? So we check the first of C and the first of D when there's epsilons in here. So then we say, okay, this rule just says add the first of whatever's after it to the follow of big B. So what's the first, what's the symbol that comes directed after it? C. C, capital C. So we take the first of C minus epsilon, add it to the follow of B. So B, what can follow B right now is end of file and C. And then we say, does rule 5 apply? Can we move on? Yes. Yeah. Yeah. All right, we can move on because there's an epsilon in the first of C. So then what, which symbols, which symbol and what do we add to the follow of? Yeah, the first of D minus epsilon under the follow of D. Right, so we're going to add little D and we're done. Right, we've gone through there. We have dollar sign, C and D. For the follow of C, which rules do we look at now? One and two and four. Yeah, one, two and four. Right, one, two and four. So here we say, we know something's starting non-terminal. We say, is it the right most symbol? No. Is there epsilon in the first sets of all the symbols after us to the end of this rule? Yes. Yes. Right, so then we add the follow of S to the follow of C and give us the dollar sign. And this rule says, add the thing that comes after us. What's the thing that comes after us? D. Yeah, so take the first set of D, subtract epsilon, so add D there. Is there anything after D? No, so this rule can't possibly apply. So we have, I forgot it already. Dollar sign and D, right? Then we have to look at the next rule where it's used. So we say, is it the right most symbol? No. No. Are there epsilon's in all of the symbols from C to the end of this rule that we're looking at now? Yes. Yes. So then we add what to the follow of C? D. D in the first set of D. The follow of A. Yeah, remember these two rules are about propagating the follow of A, right? So we do the follow of A to the follow of C, which is little D, little V. And then we would add the first of big D to the follow of C, right, which we've already done. There's no symbols afterwards. This doesn't possibly hold. And then here we go through this again and say, okay, right, same thing. This applies. It's the right most non-terminal. So we take C, add it to the follow of C to the follow of C. There's nothing after us. So none of these apply. So we have the follow of C is dollar sign B and B, right? And this is an important thing, right? This little B came from the follow of A. So we're five minutes over. I'll just continue doing this and record it and put it online if you want to, or you can leave. I don't know. It's up to you. We can go to the last one real quick. You got to go, you got to go. But it'll be recorded. Okay, now I want to calculate the follow of D, right? So which rules do we got to look at here, the production rules? One, two, and five. One, two, and five, yeah, right? Any place there's a big capital D. So we say does this rule apply? Is D the right-most symbol? Yes. Yes, so we add what? The follow of S. Follow of S to the follow of D, exactly. Does this rule apply? Is there anything after it? No. Does this rule apply? Is there anything after it? Nope. Does this rule apply? Nope. So we leave the next rule, right? So we've added the dollar sign. Then we say, okay, is it the right-most symbol? Yep. Yes. So we add the follow of A. The follow of A to the follow of D, right? So we have dollar sign and little B. We go through this again. The right-most. Right? It doesn't have it. It doesn't have it. Then we look at the next one. We say, is it the right-most? Yes. Yes. So we add the follow set of D to the follow set of D, right? So we have the empty set to what we're calculating. Doesn't change anything. There's nothing afterwards. So we get dollar sign B. And so cranking through these all again, we would get the same thing, which I'll let you do your practice on your own. There's also for, I'll be releasing the practice midterm today. I will say the slides have a pretty good, we won't go over this, but maybe touch on it a little bit in class, but I won't go super in-depth on to it. But it turns out emails are super complicated. So there's an example of a context-free grammar for emails, and we walk through calculating this simplified grammar's first and follow sets. So one way to self-check is go through, use this grammar and generate first and follows on that on your own, and then check with the slides to make sure you're doing it right.


My name is Lise Grande and I'm the head of the United States Institute of Peace. We're delighted to welcome you to a conversation with the president of the International Committee of the Red Cross, Dr. Peter Maurer. Peter is one of the most principled and famous humanitarian leaders in the world today, and it is a privilege to welcome you back to USIP. We are also honored to welcome Lieutenant General Michael Nagata, who has served with distinction for four decades in the US Army and Special Forces, who has commanded US troops in Afghanistan and Iraq, and who we are privileged to have as a member of USIP's Senior Military Advisory Group. Our conversation today is focused on ICRC's new and very important report called Allies, Partners and Proxies. The report looks at the changing nature of modern warfare and the implications of these changes on the human costs of conflict. The report argues that most modern conflicts are now densely networked, involving coalitions, partnerships and proxies of both state and non-state belligerents. The report makes the point that these highly complex, networked conflicts subvert, minimize and reduce the lines of accountability which are essential for upholding international humanitarian law. The report also argues that the costs of modern conflict, the loss of life, record levels of mass migration and the reversal of decades of hard-won economic progress are too high, too unacceptable and too unmanageable to ignore. ICRC's report is an urgent call for all of us to double down and use our leverage to hold our partners accountable so that we can together reduce violence against civilians. As the custodian of the Geneva Accords and one of the most revered and respected institutions in the world, ICRC is uniquely placed to make this call. We'll start today's conversation with questions for both Peter and General Nagata and then we'll open the discussion to the audience. For those who are joining online, we ask that you submit questions through the discussion via the Q&A box on the event webpage. To start us off, Peter, we would be grateful if you would tell us more about the findings of the new report and whether you think the current framework for international humanitarian law is sufficient and robust enough to deal with the changes that your report identifies. Thanks a lot, Lise, for the introduction and for the question. I'll maybe kick it off with some of the figures which illustrate our experiences over the last decade in the theaters of conflict in which we are working. I'll start with numbers of actors in the theaters of conflict in which we are. We started pulling the lists together who is occupying the territories in which we deliver humanitarian assistance and protection work. And over the last two years we have done it more systematically to find that more than 600 non-state armed groups together with more than 130 countries are basically populating the battlefields in the 40 most important areas of conflict. That's a lot of actors. Our original task from the Geneva Convention is to facilitate the implementation and the respect of international humanitarian law and to engage with belligerents, state or non-state. Whether you have to do with two parties to a conflict in a traditional border dispute warfare or whether you have suddenly five, 10, 15, 20 actors with state and non-state mixed with volatile alliances shaping from one day to another into new alliances, you ask yourself what are the chains of command you are trying to influence?  And so while I'm pretty much convinced that the basic orientation and task that we got from the international community after the Second World War is relevant, the respect for international humanitarian law, the landscape has fundamentally changed. We have to look at chains of commands, of influence, of proxies, allies, partnerships, because nobody fights wars alone today. If I look at the impact of the new environment in which we are, it's striking. A lot of people today live in control of territories outside state control and therefore the respect for the law outside of state control demands a completely different way of engagement. Our recent findings say that 50 million people, that's more than we have refugees in the world, almost double the refugee population live in territories controlled by non-state armed groups. Another 100 million, so a total of 150 million, another 100 million live in territories contested where the chain of responsibility of respecting the law in belligerent warfare is contested. And so this new situation made us reflect what do we have to do in order to engage? We have to find the chains of commands and the responsibility in order to prevent erosion of responsibility with regard to the respect of international humanitarian law and doing so we find where the hooks are. And then we looked at what makes partnered warfare today, what is this notion by through with working with partners, what does it actually mean? And we have sort of find the panoply of activities which enter into that into that equation from arms transfers to training to train and equip policies to support in doctrine, support in logistic, support in intelligence, knowledge sharing. And we tried to structure all these different activities which make out partner and allies and proxies in order to systematically see where are their relationships which we could use in a positive sense in order to influence respect for international humanitarian law. So this is by in large the essence. It's a reflection which is deeply rooted in the core of our mandate which we still believe is absolutely relevant to ensure respect for norms and principles. But it is adapted to a new context, a new situation, a new battlefield and of course opens a completely new way of engagement for the organizations because if 20 years ago our interlocutors were by and large states and maybe two or three liberation movements fighting the colonialism of states, today the land is flat, the landscape, the battlefields and we try to find hooks, entry points, engagement surfaces. General Nagata, you've lived the realities that Dr. Maro is reflecting on and through the many years of experience you've had working by with and through our allies and our partners and even proxies. Can you share with us the lessons you've learned that are relevant for the application of international law, for getting our partners and our proxies to uphold their obligations under international law? What have you seen that's worked and what have you seen that hasn't? I've seen both but thank you for asking. But before beginning, first of all, thank you for inviting me to be here. It's a particular honor to be on the same stage as Peter and this incredibly important report but more importantly, as I was driving here this morning I was trying to count up the number of places around the world where I've had the honor of interacting with people from your organization and I stopped at 12, not because that was the right number because I couldn't remember all the other places. But in all seriousness, at the beginnings of my career, my interactions with your organization were not intentional, it was just happenstance and circumstance but I learned how beneficial that contact was. So in the latter half of my career, every time I deployed to a new place around the world, I deliberately sought out your organization and my operations and activities were the better for them so thank you. But back to your question, there are so many things that come to mind but I'll try not to drone on endlessly here. The first one that gets to this question of our effectiveness, whether or not our intent to work with a partner somewhere around the world will actually succeed. The first choice is going to sound rather simplistic but I've seen us get this right and I've seen us get this wrong. Is the relationship we seek just transactional or is it meant to be durable? In which case it cannot be only transactional because rather obviously if it's just a transactional relationship, once one of the two parties stop getting what they want that's the end of the relationship. If it is a durable relationship there's a degree of resilience and strength to the relationship that even if there is occasional disappointment, the relationship will endure. The United States still aspires, still claims to be, you know, the indispensable nation or the leader of the free world pick whatever phrase you wish to use. If that is true, if we intend to continue to make that rhetoric our reality then it's hard for me to think why would ever be wise for the United States to choose just a transactional relationship. But let me get to the point here. Transactional relationships are cheap, easy and fast to create. They just don't last very long. Durable relationships, durable partnerships, whether with a nation-state or a increasingly powerful non-state actor are hard, complex and require constant nourishment, constant attention and constant resourcing. That's very inconvenient if you don't want to do those things. But that's the first one. If we choose the transactional relationship our likelihood of success goes way down. If we choose the more difficult, more complex but ultimately more durable pathway towards durable relationships then our likelihood of success in that partnership goes up exponentially. The second thing, and in a way I'm kind of repeating something Peter has already alluded to, that in the way we interact with whoever our chosen partner is at the end of the day what we do together doesn't matter as much as how we do it together. A rather obvious example is if we insist that the outcome of this relationship is going to abide by international law, is going to respect humanitarian norms, even at the cost of some operational progress then we are more likely to succeed. When we start taking shortcuts because we feel the press of circumstance or it's an emergency or what have you, in my experience whether it was months later or years later I have always seen us regret it. I've always seen a certain amount of, how did we get here? How could we possibly have gotten to this bad spot? And the answer really is because we chose to take a shortcut. We chose to skimp on this principle that how we do things together matters as much or more as what we do together. Finally, this is something I've seen most nation states struggle with including my own, but when we're seeking a relationship, particularly with a non-state actor, do we take the time and trouble to understand all of the relationships that that actor already has? Because those relationships are, it's very unlikely our prospective partner is going to jettison those relationships. They have those relationships for a reason. If we do not understand those relationships, we're going to be surprised by what happens in our new partnership and surprise particularly in military and security operations abroad are always unwelcome. Peter, the United States is changing its military posture. It's withdrawing its forces from Iraq and from Afghanistan. It's repositioning its forces in Somalia. We see France repositioning itself from Operation Barking and the Sahel changing its position. There's an argument that when great powers are engaged in a theater that they're able to exert positive influence. General Nagata has suggested this, that they're able to help those militaries do the right thing. As you see the U.S., France and other powers changing their posture, what do you think that means for the leverage that these countries can exert on their allies, their partners and their proxies? Well, I would suggest that it changes the way how you engage with the world outside and the mixture between security, military and other engagements may become a very different one. And this speaks to what Michael just has said. What we wanted basically to propose and to put forward with this new study that we have presented is a framework for a durable relationship which looks at a multiplicity of engagement and does not reduce engagements to purely military or one-dimensional interests. And if you enlarge the perspective, you enlarge the influence. If you enlarge the timeframe, you enlarge the space in which you are designed to ensure influence. And in that sense, I do believe that we are at a critical moment where the mixture of exerting influence in the world will be different. Very frankly, I come from a small state which has never had the ambition or the possibility to have influence in a traditional way in terms of military influence and didn't want to have this influence. But it is important to recognize that influence is not limited to military influence, but it can be much broader and it can engage in a completely different agenda. And with regard to security and military engagement, I think it can be recast and reconceptualized, made more durable, made more systematic and made more structured. And if this happens, I think we have gains for civilian populations and we have a perspective also that influence is leveraged in a positive way. You may have seen, and because you mentioned Afghanistan, Iraq and others, one of the points we highlight in our study is structured engagement of phasing out military engagement and trying to diversify to look at new types of partnership, what comes next, and I think structured engagement is very much something which speaks to the durability of creating a new form of influence. It's all about hard and soft power. I think it, Robert Nye, when he defined soft power politics and diplomacy has rightly highlighted that the U.S. has never been only hard power. It has influenced because of an intelligent soft power policy, and I think the combination of both is what probably the world looks like. I can't imagine the United States withdrawing within its borders. We can't imagine China just being agnostic about the rest of the world, neither Russia nor India or any other countries. We will have these surfaces of influence which are sometimes contradictory and they need to be structured and organized. And when weapons and conflict is involved, then better do it in a structured way and take the law and principles as help on how you do it. Peter, one of the very interesting things about your report is the back half of the report, which includes nearly 100 pages of detailed guidance on how to do exactly what you're describing. How to build up a relationship through development support, how to build up a relationship and influence through a concentration on human rights and humanitarian assistance. And if I can just say as a practitioner, as someone who reads your reports to know what to do, that back section of the report is almost like a textbook for us. And bravo to you for doing that, because I think it will be hugely useful for everyone in the field. Yeah, we are in the middle of a process of trying first to offer a framework to think about these issues. And as we move forward over the next couple of months and years, hopefully to have a collection of best practices and examples. Because at the end of the day, it's also how we think about laws and principles. Are laws and principles here to influence behavior? And if they are here to influence behavior, then we have to have sophisticated ways to influence behaviors. We don't have just to have justice accountability for violations. And so the whole logic of the report is trying to build bottom up from positive experience and say, why not think about this? It has worked. It's a positive example here of why we were able eventually to ensure better respect for international humanitarian law. It's leveraging influence for the positive building on positive examples, but also adequate to these complex environments and relationships and battlefields in which we are operating today. So you are commending sort of the middle product of what will hopefully become a larger repertory of good practices of shaping relationships in order to respect basic principles. General Negata, there has been a criticism that the United States in its relationships with its allies and its partners and its proxies has focused on training and equipping as the center of the engagement strategy. We know that you have served with distinction in Iraq and in Afghanistan and other theaters. If you had to respond to those critics, what would you say? Well, I would say the criticism is not completely unfounded. There are probably more than a dozen various train and equip and advisement operations and campaigns that I participated in over the years that I was in the military. Some still exist to this very day and have been incredibly successful and continue to be successful with everything they do now. Many have dissolved for various reasons, either loss of interest on our own part, loss of interest on our partner's part, or because it didn't work. In some ways, I'm not necessarily the best person to ask, in some ways I'm too close to these things, but you've asked me a fair question, so let me try to give you a fair answer. I think in my own view, as I've looked back on these things, I think the most important choice we and our partners had to make was not something we always consciously thought of, but as a general rule, when we succeeded, we did consciously think about these things, not just at the tactical, practical level, but also at the policy level, because what I'm about to say has policy implications. In my judgment, the best choice we made, which usually led to the best outcome, was that we were going to train, equip, and advise a partner force of some kind somewhere in the world because they were the best solution to the security problem we were trying to deal with. It could be a counter-terrorism problem, it could be almost any kind of problem. As a general rule in my experience, when we made that choice, the outcome was generally pretty positive and durable. The wrong choice, which I also saw us make, is we're doing this because we don't have the stomach to do it ourselves. We're doing this because we don't want to pay the price. We don't want to put our own people at risk. Of course, we never said it this way, but there was always a little hint, frankly, in my own personal view of we're more important than these people are, so let them go to the fighting and the bleeding and the dying. Those choices, in my experience, ended up not being durable, and they certainly did not succeed. Peter, if we can build on General Nagata's observations, have you seen in ICRC's experience around the world examples of where countries like the United States, like France, through their relationships with their partners, have used those relationships and that leverage to further international humanitarian law? Where have you seen that this has worked? Well, we definitely have a panoply of examples where opening the doors for ICRC, either in terms of access to detainees or access to trainings for belligerents or access to negotiation for delivering humanitarian services to people have been heavily supported, influenced, shaped by influential members of the international community, including the United States. It's one of those, I say that openly, one of those critical issues where sometimes we are reluctant to give very precise examples, but I can tell you very frankly, we are almost in no significant relationship internationally without also having the support of a state with influence for what we are doing. We need this influence to get access. States, non-state, armed groups, they don't give us access because we are the ICRC. They give us access because there are more important interests for them and if we have powerful advocates, access is facilitated. And so when I look at the Sahel, we are visiting detainees in most of the countries in the conflict in the Sahel. We have access. We have respect for our rules. It wouldn't have happened if the powers involved would have just been sitting back and asking us to deal with the issue. So we see when influence is exerted, we see also the difficulty that sometimes power have to exert influence because in the perspective of a power access for a humanitarian actor like ours is only one facet of the reality. There are other interests to ponder, but we see a difference. We see a huge difference and it's by far not only the United States. What I can recognize here and this is why it is so important to discuss here in Washington about these issues. We do have a three decade old tradition to work with the US militaries and their engagement and we have got to learn each other in the battlefield and to know how influence and mutual support can go in order to protect civilians. And it makes a difference. And I think what we need to do and to discuss today is can we what we have done in the past carry forward in the future, Albeit the realities are much more complex and the influence streams are much more difficult, but yes it makes a difference and it is logic. States have 196 states have given us a mandate to ensure respect for international law and we expect states to support us in this effort. And so it's not that we are asking for a favor. We are basically thinking that it is the responsibility of states to use their influence to further what we are paid to do. We now have a number of questions that are coming in from the audience. And General Negata, one of the first questions relates directly to the point that Dr. Maurer has raised. And the question is, why was the US hesitant to use the leverage that it had over the Saudi-led coalition to change the way that the war was being prosecuted in Yemen? Right. Well, the glib simple answer but not completely inaccurate is because it's complicated, but I know that's a satisfactory answer. So let me try to dissect that, at least from my point of view. Because at the heart of this question lies a number and I may not actually be capable of describing every single one, but a significant number of contradictory or somewhat contradictory impulses and interest the United States had in this part of the world. It had far more to do than just Yemen or just Saudi Arabia. It had to do with the entire Arabian Peninsula, our relationships with the Gulf States, many of whom were to one degree another supportive or antagonistic of what the Saudis were doing, and frankly our international reputation. And so I doubt it will surprise anyone watching this that you can describe the United States interest from any one of those particular vantage voices, international perceptions, what's the perspective of the non-Saudi Gulf States, what's the perspective of Israel, what's the perspective of the Yemeni government in exile, et cetera, et cetera. But when you have a meeting to discuss these and try to navigate your way to, okay, but what's the right choice for the United States to make, you have to find a way to digest all of that complexity, decide how much risk you're going to take because there's no risk-free solution here and then make a choice. And as I think everyone knows, the decision-making process at the policy level of the United States government is elaborate, some people might call it bureaucratic. And so quite often what appeared to be a decision by the United States on this particular question was not actually a reflection of a decision, it was a reflection of an inability to make a decision. Oh, that's interesting. And so we just kept doing what we were doing because even if we felt the urge, at least in some parts of a very diverse United States government, even though there were often strident voices saying we need to make a different choice, the fact that we didn't decide whether or not we would make that choice was a decision in and of itself even though we did not intend that to be the decision. That's very interesting. Peter, I think that the next question to you actually comes from something that General Nagata was talking about in one of his earlier responses when he referred uncomfortably to the proposition that sometimes states shirk their responsibilities by delegating active warfare to an ally or a partner. So the question from the audience is do you think that states are shirking their responsibilities when they do that? Well, not every time and everywhere but yes quite often as well. We have to recognize and I think one of the drivers of our new conflict reality of light footed engagement, of secret undercover engagement, of different than boots on the ground engagement is eventually to evade political responsibility which is not able to generate the consensus for a military operation abroad, neither in many European countries nor in the United States. And because it's difficult to have and to continue to have military operations on the ground and to be also responsible for these military operations, the partner allies and proxy relationships are also here to duck responsibility. And I think shrinking or diffusing responsibility to unknown and unknown multiplicity of actors is one of the big problems that we are dealing with. And that's the reason why we propose the opposite, having structured relationships and systematic relationships and long term engagement and transparency and first and foremost consideration for the protection of civilian. And why do we say the protection of civilians? Because today's warfare is not only complex, it's more deadly than ever and it has produced impact on civilian populations which become a burden, not only for the context in which this happens, but for the whole international community. What do we do with 80, 90 million of refugees and internally displaced person with rocket science, rocket numbers of people dependent on humanitarian assistance. The price is too high to let it go. And it's very interesting, Michael, what you said before, because I fully agree that the non-decision is very often at the origin of many of the problems that we are encountering. And my effort and my top line argument in all conversations I have on state responsibility is basically to say factor in the cost of non-decision. Because the cost of non-decision is today exorbitant for the international community, for the people affected, for the regions, for the countries. And if you see seeming chaos in today's world and difficult international relationship is also because we had accumulation of non-decisions which let conflicts evolve as they have evolved over the last 10 years. And this has now accumulated in absurd numbers of suffering of people. And so we need to reverse the trend. And reversing the trend is really starting with structured, considered engagement in order to respect basic rules and principles in order to minimize the impact of what warfare as it goes on. There's a question to both of you which relates to, if I understand well, the recognition that the nature of warfare is changing. That civilians are at very great risk because many belligerents consider civilians to be a legitimate target to be part of the actual strategy of their entire campaign. If that's the case, is the framework for mitigating violence and protecting civilians, the Geneva Accords and the protocols, developed and acted and ratified in a very different time in history. Is that framework sufficient, robust enough, adequate? Is it good enough for what we see as the reality today? Well, I'll start. I'm not an expert enough in the language of the various conventions and treaties that govern this to know how much of an improvement needs to be made in the language. I'm sure there are some, given the fact we're hurtling through a digital age that did not exist when most of these treaties were originally signed. I'm sure there have to be some improvements that ought to be made. But acknowledging that I don't really know how much of a problem that is, I am much more anxiety-ridden about how at least the character of armed conflict has changed so dramatically just in my own career. Just in, you know, I was 38 years of active duty, just in that relatively short span of time, less than four decades, armed conflict for me at the end of my career was so different than what I originally was recruited and trained for. It's almost bewildering how different it is. And I do not believe we've made the appropriate adjustments or the adequate adjustments to reduce the likelihood that we end up having unintended negative outcomes and negative consequences because the change has been so rapid. I'll give you, I guess, one permutation of this. The ability to distinguish between a combatant and a noncombatant has gotten more difficult every year of the last 20 years. It has not even stayed at the same level of difficulty. The level of difficulty in distinguishing who is a combatant and who is not has gotten worse every single year, and frankly I see no end in sight to this. Particularly, again, as we are hurtling through this digital age, I'll mention just one thing. What's the likelihood of so-called deep fake video and photographic material? What's the likelihood that combatants around the world are going to look at that as a potentially useful tool and sell themselves? In this case, I'm not going to do it. I'm not going to use this powerful capability to my advantage. The likelihood is zero. People are going to use it. That will make our ability to distinguish the warfighter from the non-warfighter even harder. I'm not suggesting this is an impossible problem, but what I will suggest is I don't see enough effort in the United States or in the international community to match the trajectory this challenge is presenting to us. From my side, I would maybe start with the following. When I look at the four Geneva Conventions, the additional protocols, as you rightly said, crafted to respond to different types of conflict, but I would still believe that these conventions in the way they were crafted and what the authors of the Geneva Conventions put together are partly time-tested over centuries and cultures. They represent a normative framework which today is still valid, appropriate, adequate, whatever you name it. I believe the big advantage of these conventions is that they are not just conventional law. It's customary law drafted into conventional law after the Second World War. And this makes a large part of the general rules and principles of the Geneva Conventions so relevant for future conflicts as well. Having said that, I fully agree that given the transformation that we have seen, insufficient time and energy, political and technical has gone into developing what these principles mean in present-day context. And whether the response will be at the level of doctrine, of manuals of interpretation or of new norms is something which we have to look at without prejudice. That's basically where we are. I would be surprised if after such an intense period of warfare and destruction that we have seen, at a certain moment the international community is not able to come together and say, well, what did we learn from here? What can we do better? We have always done that to have those moments of review and looking forward. We try hard at the present moment, given the obvious blockages in the international community to advance the normative systems of international humanitarian law, because every process which has been started at some time in the last 10 years is blocked. There is no process which has successfully advanced, whether it is at the level of weapons, the conduct of hostilities, the protection of civilians, power differences and power interests at the present moment are still too freshly controversial, given the conflictuality that we would easily agree to a fixed normative framework. And on the other hand, and I think the study again wants to help craft consensus through recognition what problems are through best practices and out-of-bred practices, you can create eventually normative guidances and directions. So I'm pretty optimistic that there is a certain agreement that this is not good enough for the problems that we have created. And we find more armed forces in the world and more politicians in the world who recognize that it is like that. And even if compromise is difficult, whether it is in terms of the significance of norms and principles with regard to new technologies, new weaponry, whether it is with regard to new forms of protection of the population, all these issues as you rightly say, Michael, have been so fast that they may not be ripe for normative legislation and negotiation. But I think it is important to keep the ambition high and to have a vision that this is necessary to do. Gentlemen, we're at the end of our discussion, but we have a final very interesting question. Let's come from the audience. I think it relates, Peter, to a point that you raised earlier when you mentioned, almost en passant, that 196 countries have embraced the Geneva Accords. In fact, the foundation of being a member of the international community is to embrace the Geneva Accords. You're the standard. So as a final question to you both, what do you see as the greatest threat right now to the continue adherence to and embracing of international humanitarian law? General? I think the greatest threat to the question that is being posed here as well as the greatest threat, in my opinion, to the very survival of these forms of government that have all signed these accords is what I consider to be the global erosion of confidence between populations everywhere and their own governments. Perhaps there are a few countries where that is not true. I don't know who they are. Every place I have been for at least the last 20 years, probably longer, including frankly in my own country. I am seeing a steady, sometimes slow, sometimes fast, but a steady erosion of this confidence between the governed and those who purport to care for and govern them. And as long as that trajectory remains true, not only is the question you have posed, or whoever posed the question, not only is that question likely to result in a very unwelcome answer, but many other similar kinds of questions are going to result in a very unwelcome answer. Because so long as that erosion of confidence continues, the likelihood that these populations will faithfully adhere to the agreements and the pronouncements of these governments, either as individual governments or in accords such as the Geneva Accords, goes down correspondingly. I would add to Michael, while I fully agree with what he said, that in our experience at the present moment in the midst of so many conflicts, it's not only the confidence between governments and populations, it's also the trust amongst belligerence which is eroding. And at the end of the day, the respect for a norm is at the end of the day as good as trust amongst the opposing parties is. This is law designed for war, not law designed for peace. It's law designed for war, which means you need to have a level of trust that the adversary as bad as much as you fight him will also respect the law. We find it increasingly difficult to establish these small and shaky bridges between belligerence which establish trust in the respect of the law as an instrument because the others respect it as well. And establishing these bridges between belligerence in order to have better respect because you create a minimum standard of understanding is what is at stake at the present moment and where we have seen the biggest breakdowns of order is basically when belligerence don't trust that the other side and that the other side will respect. And this reciprocity on the re-establishing this reciprocity as of critical importance, we are confronted very often in the middle of these discussions with the following conversations and I end with that. One side of belligerence tell us, well, we really appreciate the Geneva Conventions, we respect it, but we will only respect it if the other side respects it. And the conversation is exactly the same on the other side. And I think that's at the present moment the thin ice on which we are walking and in some parts the ice has broken in and that's cold water as we know. Gentlemen, on behalf of the United States Institute of Peace and in fact all of us who have been part of this discussion today, thank you. You know in peace building there are three components, what you do to try and prevent a war, what you do to try and mitigate violence against civilians during the war and what you try and do to resolve it. One of the most difficult of those three questions is precisely the ones that you have provided your wisdom and your insight on today. How do we mitigate violence in the middle of a war? It's the crucial question and we thank you for spending time with us and sharing your thoughts. We hope that everyone joins the United States Institute of Peace for our further conversations on how we can do what is necessary to protect civilians, what we can do to prevent wars and how we can help to resolve them. Thank you. Thank you.


QuickBooks Online 2022, setting up bank feeds. Get ready because it's go time with QuickBooks Online 2022. Here we are in our bank feed practice file. We set up with a 30-day free trial. Holding down control, scrolling up a bit to get to the 1, 2, 5% we're currently in the home page otherwise known as the Get Things Done page. In the business view as compared to the accounting view if you want to change to the accounting view it's something you can do by going to the cog up top switch to accounting view down below. We will be toggling back and forth between the two views either here or by jumping over to the sample company file currently in the accounting view. Back to the bank feed practice file. We're going to be looking into setting up the bank feed so there's a couple ways that you can't do it. Note you might think that the first thing you would do is go into the banking section in this business view here but this is where they have some other stuff mainly looking at that are related to the bank including meet your money goals, pay and get paid your way and so on and so forth some of which would be added on type of features like up-selling, some kind of things within QuickBooks which would be related to the banking. So we're going to go down to here you could go down to the bookkeeping area and set up the bank feeds by going to the transactions up top and then go into your banking section and then down below you've got to connect the account that's one way you can do it another way you might think about it is to say let's go into the chart of accounts and then possibly add a new account which would be an account that typically has the type related to a bank feed so that would be a checking type of account or a credit card type of account because those are the types of accounts that typically have financial institutions related to them so if you were to make a new account you would make sure to set them up as an account that has a financial statement related to it like a type of account which would be the cash account or the credit card account now as you do that I would not be in the account the business view but rather the accounting view because it's a little bit easier to add accounts in that way on the accounting view now if you were in the accounting view you could then go down to the same areas would be in in other words the banking section on the left-hand side that's where you'd be actually looking into your bank transactions in the banking information up top in the sample company the account has already been set up so you've got some bank fee transactions that are in place we haven't set them up so they're not in place at this point in time or you could go down to your accounting tab below where you would then have your chart of accounts and you could possibly set up a chart of accounts this being the type of account that would typically be linked to the bank feed so you might set up the account first so we're going to go back on over to this side open up the left-hand side on the hamburger let's go to the transactions up top now we're not going to actually fully connect this time we're just going to give an example of how to connect this time usually the connection itself is actually the easiest component of the bank feeds process connecting the account could take a little bit of work in terms of the financial institution a little bit different from institution to institution but the actual connection is usually not that difficult to set up what you want to consider with the connection is how much data do I want to be pulling in do I want to be pulling in say one month worth of data one year's worth of data what's my cutoff do I already have data in the system so that you can make sure that you got the right cutoff to get the amount of transactions that you want to be pulling in from the bank feeds there are in essence two ways that you can set up bank feeds or get information from the bank that's going to go into your accounting system one is to connect directly to the bank which is a little bit easier typically but you might not be able to go as far back in time and the second is to go into your financial institution download the financial transactions and then upload them into QuickBooks which is an option that might be useful especially for the first time that you're setting up the bank feeds because you may not be able to go as far back in time if you need like a whole year's worth of data or multiple years worth of data then it might be easier you might be able to get more of that data from the financial institution directly so those are the things to keep in mind we have the connect account or upload transactions here so the connecting to the account obviously would be the physical connection that would allow us to connect and pull the information let's take a look at the upload transactions first just to consider it it says here manually upload your transactions open a new tab and sign in to your online bank account export your bank statement in .csv.qfx or .qbo.ofx or txt format now these are common types of formats possibly not common types but for uploading their common types of format normally the easiest one would possibly be a .qbo that's not a qbo data file QuickBooks Online in other words but rather it's a data file very common in most financial institutions now if you don't have that one then often times you'll be using a .csv which is kind of like an Excel document stripped of all the Excel formatting within it so you can use those basically to upload your bank statement here so number three upload your bank statement drag and drop or select files and then on the right hand side bring in transactions automatically this is where you have your linking of the accounts to save time on entering bank transactions this is trying to get you back into that automatic link process instead of using the upload manual upload process let's close this back out and then go into the tab to the left which is the connecting to the bank which would be the direct connect to the bank so linking to your bank account would go through this process now note the accounts down below they have some common financial institutions these would be financial institutions we would have our banking with or possibly our credit card as well that we can do our connection with you can also then show more down below here and we can basically also just type in the financials institutions so bank, something and you can have a whole bunch of other banks a lot of different banks the number of banks that they're being able to pull in even banks that aren't the most the largest banks are still in here so they're getting a pretty large bank of banks in their system a big bank of financial institutions credit cards also like American Express American Express you can connect the credit cards we'll talk more about the credit cards as well I think it's easiest to think first about transactions related to the checking accounts once we have that down we'll go on to the credit card types of transactions and you also have some accounts like a PayPal account which is really really nice that they have PayPal because I don't think that the version on the desktop version has the same capabilities for the connection of the PayPal so we might explore that in a little bit more detail as well if your financial institution isn't here then it's likely that you still might be able to use the process of uploading the transactions by going to your financial institutions downloading the QBO typically a QBO file or the CSV the basically Excel spreadsheet file and then uploading them to the system so let's just pick an account let's pick like Bank of America here now here's the sign up process sign into the account Bank of America start by selecting the Bank of America accounts you want to connect with into it the makers of QuickBooks Online Education go to the bank site to sign in and choose which accounts to connect then we'll return you here and bring you to your transactions so you can go to directly to the bank account there's going to be some difference possibly from financial institution to institution as to how much security or what are the different types of security measures you're going to need to connect because you clearly need to have access to the bank data to get access that's the most confusing step which could still differ from financial institution to financial institution however it's usually fairly straightforward once you get the details of it if you have problems with it you may have to contact your financial institution in some instances but usually it goes fairly straightforward so what we're going to do is we're basically going to stop here and then we're going to go we're going to actually enter the data into the system and we'll do that on more of a manual type of basis noting that either basis that you use once the data is in the system then you're in the same kind of limbo area you've got the bank feeds directly from the banks into your system either because you uploaded them or because you downloaded them from the bank then put them into the system either method will get you into the same spot in general having all that information in what I would call bank feed limbo transactions that have been input into the system but for which they have not been approved have not been finalized the last pieces of information such as the account the vendor the customers have not been entered and that's what we would need to do and then we'll get into doing that part of the process so of course then you've got the login information on the right hand side so we're going to basically we're going to stop it here and then in future presentations we'll get into a bit more detail on uploading the data and then working with the data that's in what I would call bank feed limbo just note that as you create the data before we finish this off in your chart of accounts if you did not already have an account set up for that particular checking account it would then of course add an account which would be a cash type of account a checking account type of account which would then be linked to the bank feed data that it would be pulling in the data however would not be in the system yet it's something that we're going to have to approve and pull into the system something that we can further automate in the future with bank feed rules but no matter what kind of system you're in even if you're completely dependent on the bank the first month the first few months possibly you will need to do substantial work to make sure to pull that information in the proper way set up the proper rules to make the automation of the bank feeds better more automated save more time as time passes