- The program have a tendency to terminate for the provided gang of traces.
- Page breaks occur just after Lines_PER_Page traces.
- All the declaration item line is actually released precisely immediately following.
Evidence that the program will cancel
Which evidence tend to verify that for all the provided selection of outlines, the program have a tendency to cancel. This proof will use a familiar way of proofs inside the recursive programs named an enthusiastic inductive evidence.
An enthusiastic inductive facts include two-fold. First, you should confirm one to possessions P is true for a provided selection of parameters. Then you definitely confirm an induction one to says in the event the P holds true getting a value of X, it have to keep genuine to possess a value of X + 1 (or X – 1 otherwise almost any stepwise procedures). This way you might confirm assets P for all numbers sequenced starting with usually the one you establish getting.
Within this program, we will confirm one to print_report_we terminates to possess current_line == num_outlines after which demonstrate that in the event that printing_report_i terminates to possess a given current_range , it is going to cancel to possess current_line – step 1 , and in case newest_range > 0 .
Inductive action proof When you look at the for every iteration of program, current_line either increments because of the step 1 (R3) or stays the same (R1 and you will R2). R2 will only are present in the event that most recent value of current_range varies compared to past value of current_range as the current_class and you may earlier_class was in person based on it.
As R2 can only just exist on the basis of R3 and you will R1 can simply are present based on R2 and you can R3, we could end that newest_line need certainly to increase and certainly will just improve monotonically.
This choice monitors locations to perform page vacations, so it’s practical to show that the webpage-breaking device performs. While i mentioned before, evidences play with axioms and you will theorems and make the case. I shall write a few theorems here to show the newest facts. In case the standards of theorems get to be real, then we could utilize the theorem to ascertain the actual situation from this new theorem’s results for the system.
Theorem step one In the event that num_lines_this_page is determined on proper carrying out worth (standing step one), num_lines_per_web page increases of the step one for every single line published (standing 2), and you will num_lines_per_web page are reset shortly after a typical page crack (reputation step three), next num_lines_this_page precisely reflects how many traces printed into the web page.
Theorem dos In the event that num_lines_this_web page accurately reflects the amount of lines posted (position 1) and a webpage crack is carried out every time num_lines_this_webpage == LINES_PER_Webpage (status 2), upcoming we know that our system does a typical page crack after print Outlines_PER_Web page contours.
Proof The audience is just in case updates step 1 from Theorem 1. This will be apparent off evaluation in any event if we assume print_report_i happened to be titled from print_statement .
Reputation 2 are dependent on verifying that each and every process and that prints a column represents a rise off num_lines_this_page . Line print is done
Of the inspection, line-printing criteria step 1 and you can dos increase num_lines_this_web page by the step one, and you may line-printing position 3 resets num_lines_this_web page for the appropriate value immediately following a page crack/going printing combination (general updates step 3). The requirements to have Theorem step one was indeed found, so we has turned-out your program can do a web page split immediately after printing Traces_PER_Web page contours.
Facts that each report product range are published exactly shortly after
We should instead find out if the application form usually designs all of the line of the statement and not skips a line. We are able to inform you playing with an inductive facts if print_report_we prints just one-line to own most recent_range == X , it is going to both print just one line otherwise terminate on current_range == X + step one . As well, since the i have both a starting and you may an effective terminating reputation, we might need show they both hookup apps Wichita Falls correct, therefore we would need to establish the bottom instance that printing_report_i really works when newest_line == 0 and this only terminate when newest_range == num_traces .