#Is this correct for proof of correctness?
54 messages · Page 1 of 1 (latest)
- Ask your question and show the work you've done so far. If you've posted a screenshot of a question, specify which part you need help with.
- Wait patiently for a helper to come along.
- Once someone helps you, say thank you and close the thread with:
+close - Feel free to nominate the person for helper of the week in #helper-nominations
- Do not ping the mods, unless someone is breaking the rules.
- If you're happy with the help you got here, and the server overall, you can contribute financially as well:
Oh shit Im rewatching my lecture and they use induction for proof of correctness
Is that ncecessary?
don't know about necessary but if I had to prove correctness of an algorithm, induction is the first thing I'd think of
I see. What do you say about this. I am not rlly confident in my inductive step
You can say the algorithm for a singleton graph, or two-vertex graph for that matter, is obviously correct
and formulate your induction assumption precisely
since that's what you have to invoke during induction
Is my current I.H not good enough?
you take a k+1 vertexed graph and pick any one vertex in it, delete it and all edges incident to it, then by induction algorithm is correct (w.e that means) on the k-vertexed graph
if you don't have a bipartite graph after deleting the vertex (and all edges), then you didn't have bipartite to start with
so you only need to worry about the case when the smaller graph is bipartite
so I would have to split this into 2 cases where the k graph could be bipartite and where it couldnt?
yes, the second case is trivial, just make sure your algorithm returns "not bipartite" for that case
alright ill redo my inductive step rq and then could you review my inductive step again 😭
How is this
this is true, because every subgraph of a bipartite graph is bipartite, but why does your algorithm return this result?
im afraid this is not good enough
you have defined your algorithm precisely
so you must retrace its steps precisely as well
I should explain why G wont be bipartite if G' isnt? is that what you mean?
Sorry I dont rlly understand this. Are you saying that I should explain every step of the helper function?
yes, you can't explain an algorithm is "correct" in some high level language, you must prove it using the description of the algorithm itself
by high level language I mean something like this
"..helper function will explore .."
what does "explore" mean?
in what order?
well it returns None if it isnt bipartite right. and if G isnt bipartite then it contains an odd cycle so adding that additional vertex still wont fix the issue of the odd cycle being present in G'?
ah right my bad Ill fix that
all that is fine, but why does your algorithm recognise this?
there is no mention of odd cycles anywhere in the pseudocode