 Okay, cool. So now we're going to look at, we have a question about structural equivalence. So here we have seven different types and we're going to talk about how to decide which ones are structurally equivalent. Okay, so the easy way to do this is we make a table of types, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, a bunch of lines. Okay, so first, so we assume that everything is structurally equivalent, right? So that's what we do at the start. So we assume everything's structurally equivalent and we go through and we're going to try and prove that things are not structurally equivalent. So, 0, 0, we know definitely structurally equivalent. 0 and 1, are they structurally equivalent? Nope. No. One's an int, one's a string, ints can't be a string, so they're two basic types, so the two basic types aren't structurally equivalent. They're not, they're not the same basic type, they're not structurally equivalent. Okay, 0 and t2, why? That's a pointer. It's a pointer. Exactly, yeah. 0, t3, nope. 0, t4, 5, 6, we can kind of use what I talked about today, so these are all structs, so there's no way they can ever be the same thing. So actually that's a good question. So let's add a t7 in here. The structure containing. Yeah, that's what I put it as. So, okay. Or no, so the question, yes, the question is, that's the case. So, is t0 structurally equivalent to t7? Yep. There's an additional layer. So what's the definition of two, two structures being structurally equivalent? Yeah, they're both structures and they both have the same number of fields and all of their fields are structurally equivalent, right, in order. So even though we know that the C compiler, these are going to be pretty much exactly the same, right, this is going to take up the exact same amount of space as this, they're not structurally equivalent because the programmer specifically said, hey, this is a structure and they said this is an integer. So those are definitely different, so they're still not. And it's still throwing time, C would still throw time, right? Yes, I'm, I'm about 90 percent sure. 95 percent sure, yeah. I'm pretty sure we'd throw an error, but I don't know, C was weird. Okay, we know one and zero or not because symmetric one and one. Yep, structurally equivalent. Is a string a pointer to integers? Yep. Is a string a pointer to strings? Is it any kind of structure? Nope, nope. So here we have a pointer to p zero. So it's not structurally equivalent with an integer, it's not structurally equivalent with a string, we've already done that. Is it structurally equivalent to itself? Yes. Is it structurally equivalent to a pointer to t one? So the question is, how do we know, right? So we say, okay, are they both pointers? Yes. Yes. Okay, so for them to be structurally equivalent, both of what they point to have to be structurally equivalent. So is t zero and t one structurally equivalent? No. No, so we see that there. So we might see, nope, t two and t three, not structurally equivalent. And these are pointers, these are all structs. There's no way. Those are half are going to be the same. t three, we've already done t three. No, no, no. t three and t three. Yep. t three is a pointer to all of these structures. Nope, never gonna happen. t four. Here we have a structure so we can see four, we can see these are the same, one, two, three, four. It's always structurally equivalent itself. Okay. t four and t five. So, first thing I say, are they both structs? Yes. Yes. How do we know if two structures are structurally equivalent? Same number of fields and each of their fields are structurally equivalent in order, right? So this has to be structurally equivalent to this. So here we have an it and here we have t six. So is t six structurally equivalent to an integer? No. No, so this whole thing fails. If it was t seven, would it be structurally equivalent? If here? If t five on a was t seven, would it be structurally equivalent to a on t four? Is this is t seven structurally equivalent to an integer? Nope. Nope. Very good question. All right, four and six. So here we have the first field is an integer. The second field is a t five. Is t five structurally equivalent to an int? No. No, because it's a structure. Four and six, four and seven. Are they structurally equivalent? No. They have the same first parameter, the first field. Different number. Exactly, different numbers. So, all right, five will copy over from here. All right, five is structurally equivalent to five. Five is structurally equivalent to six. So do they have the same number of fields? Yes. Is t six structurally equivalent to t five? We assume yes. Yes, exactly. We assume yes. So great. Our table says yes. So let me go on to the next one. Is array of ints structurally equivalent to an array of ints? Yes. Yes. What if this was array of t zero? Why did we assume it was still, still, still. Ah, that's the very first step that we do here with this table. So we assume that there's check marks in all of these rows. Exactly. We start off by assuming that they're all structurally equivalent. So anything I haven't filled in, we consider structurally equivalent. Exactly. So that's the first part of the step. I just don't want to draw all the check marks. Okay, so is an array of integers structurally equivalent to an array of t zeroes? Yes. How do we check? t zero is an int. Right. t zero and int, are they structurally equivalent? Yes. Yep. Great. So t five and t six, structurally equivalent. t five, t seven? Nope. Nope. Different number of fields. All right. t six, we can copy from here. Check mark for five. Check mark for six. T six and t seven? Nope. Nope. And t seven, we've actually already calculated it. All knows. Okay. Now, remember this is just like first and follow sets. So we went through the table. Now to really be sure we'd have to calculate it all again. I have to go through. Really the only thing, t five, t six, right? So now that we've done that, because now we assume that they were the same. Now we can do this and look here and say, okay, t five, t six, are they the same? So they have the same number. Is the first one the same? Yes. Our table says yes. And is the second field the same? Yes. Field says yes. Yep. We didn't make any changes. So now we know that these are structurally equivalent. But I couldn't instantiate these structures. So they're structurally equivalent, but the compiler could not create these structures because it's in C. Exactly, in C, because these would be infinite. Yeah, you could use a language like Haskell where you could have infinite data structures. So in C, it has to be a pointer to blah and a pointer to blah, and then you could actually instantiate them, but they're still structurally equivalent. T six hasn't been defined yet. Yes. That's another problem. What if for struct five, for example, at A, we have instead C comma A and then T six? Sorry. Wait, where? So on A, you would have C comma A. That's all you would change. So you would add, yeah. So for here, for example, you would add C and then it equals that. Well, can you do that or not? I would say on a struct, the way we've been doing it, no, because the order matters. So which is the order here? Does A come before C or does C come before A? Oh, no. Yeah. So what if we had a system? So we have to be like this, like a C, T, six. Can you have A and C together? No, not on a structured equation. You have to have them to put it like that. Okay. Yeah. Because you're defining the different fields. So in our definition of structures, the order is the thing that matters, not the names. So when would you go back and decide that not structurally equivalent? When you can prove that they're not. Okay. And you do that by referencing the table. Exactly. Yeah. So what if, okay, in that case, so let's say it's back to the way it was on struct five. And instead of just T six, what if you had a pointer to T six? In here? Do you have anything, a pointer to T five here? No, no, on struct five, T six. Yeah. What if it's a pointer to T six? Okay. So we would get to let's say five, six here. So we assume that they're structured equivalent. We look, we say that the same number of parameters, are they both structures? Yes. Yes. Do they have the same number of parameters? Yes. Or some parameters? Fields. Yes. Yes. Okay. First field, are these types equivalent? They wouldn't be equivalent, right? Because T five is a structure. Exactly. We know that T five is a structure. We know this other thing is a pointer. So there's no way that can be equivalent. So it doesn't matter if it's a pointer to a structure, it's still because it's a pointer, right? Now the question is, what if we change this one? So then we get to their five, six, we say, okay, are they both structs? Yes. How many field, do they have the same number of fields? Yes. Okay, their first field, they're both pointers. So that's good. So then we check the middle ones, T five and T six, are they structured equivalent? Yes. Yes. We've assumed so. So then we go on. It would be the same if you had a range, right? Exactly. Yeah, it doesn't matter what, it could be, you know, you could have, because we talk about functions, right? It could be T five returns int, T six returns T zero, right? They're still equivalent. Exactly, still equivalent. As long as it doesn't say this is a pointer to a pointer of an int, right? Yeah. Like, okay, let's say T five structs went to pointer of T zero, and then T six went to pointer T two, because then technically that's a pointer to a pointer. Exactly. So we do exactly the same thing, right? We go here, we say, are they both structs? Yes. Do they have the same number of parameters? Yes. Yes. Look at the first field. So this field are, we want to see if they're structurally equivalent. Are they both pointers? They are pointers. So that means T zero must be structurally equivalent to T two. Yeah. We've actually already calculated. So is T zero structurally equivalent to T two? No. No. So this whole thing's not structurally equivalent. All right. So that's, yeah. Yeah. You drew the line this time. Huh? You drew the line this time. Yeah, it took forever. No, in class, I remember I asked you that question, I'm supposed to draw another line because you're recording on it. Oh, this. Yeah, that's how I was confused. That's, yeah. I saw that, I guess, later, or while I was doing it here. Any other questions on structural equivalents? Okay, I'll stop this recording for now. Good little chunks of structural equivalents.