munotes®

The Internal Assessment: Building and Presenting the Implementation

Get access to whole semester resourcesSemester Pass

Chapter One Hundred One

Syllabus topic Module 2, "Algorithm Specification (Pseudo-code)", "Complexity & Limitations", "Conceptual Mapping Table", "minimum 10 test cases"

Pages 366 to 369 of 378

In one line

One implementation, eight headings, ten test cases, a live demo and a viva, for twenty of the fifty marks.

In the wording you can write in an examination: the internal assessment for this paper is a single implementation, undertaken individually or in a pair, of an Indian Knowledge Systems concept as a computer science concept. It must comprise a problem statement in that form, a formal specification of the rules or algorithm, working code, a minimum of ten test cases, and a short analysis of correctness and limitations, and it is presented through a live demonstration and a viva.

Her eight topics, and where each is built in this book

Her topicThe chapter
Piṅgala's Chandaḥśāstra as Binary Encoding and Combinatorial Generation[Prastāra in Code]
Pāṇini's Aṣṭādhyāyī as a Rule-Based Grammar Engine[Pāṇini's Aṣṭādhyāyī as a Rule-Based Grammar Engine]
Nyāya Logic as an Inference Engine[Nyāya Logic as an Inference Engine]
Ayurvedic Classification as a Rule-Based Expert System[Ayurvedic Classification as a Rule-Based Expert System]
Arthaśāstra-Inspired Cryptography as Symmetric Cipher System[Arthaśāstra-Inspired Cryptography as a Symmetric Cipher System]
Meru-Prastāra as Pascal Triangle and Dynamic Programming Model[Meru-Prastāra as a Dynamic Programming Model]
Padārtha Ontology (Nyāya) as Knowledge Representation Model[Padārtha Ontology as a Knowledge Representation Model]
Śāstra Rule Precedence as Deterministic Finite Rewrite System[Śāstra Rule Precedence as a Deterministic Finite Rewrite System]

And you may choose another relevant topic, which her own wording permits.

Her eight headings, and what each is for

HeadingWhat it must containThe commonest mistake
1. Titlein the form "IKS Concept as CS Concept"a title that names only one side
2. Problem Statementwhat is to be built, and what it must dodescribing the classical material instead
3. Conceptual Mapping Tableeach classical element against its computer science counterpartomitting it entirely
4. Algorithm Specificationpseudo-code, not codepasting the code again
5. Working Codethe program, runningcode that has never been run on another machine
6. Test Casesat least ten, with expected and actualten cases that all succeed
7. Complexity and Limitationsthe cost, and what it does not doclaiming it has no limitations
8. Conclusionwhat was built and what it establishesrepeating the problem statement

Two of those deserve emphasis.

Heading three is where the marks for understanding are. The mapping table is the only place the submission shows that the classical side has been understood rather than summarised. It is also the heading most often missing.

And heading six should include failures. A test set in which every case succeeds has not tested the failure behaviour. Every implementation in this book includes cases that must return nothing, and says how many.

munotes.in366

The Internal Assessment: Building and Presenting the Implementation

Worked: a complete submission

What follows is one submission, short, in her order, so that the shape is visible. It uses the simplest of the eight topics deliberately: a student who can produce this for the prastāra can produce it for any of them.

1. Title

Piṅgala's Prastāra as Exhaustive Enumeration of a Binary Space.

2. Problem Statement

The eighth chapter of Piṅgala's Chandaḥśāstra states a rule which, applied repeatedly from a starting row, produces every possible pattern of light and heavy syllables for a metre of a given length, in a fixed order. Implement that rule, verify that its output is complete and free of repetition for every metre up to twelve syllables, and verify it against an independent construction derived from the same sūtra.

3. Conceptual Mapping Table

Classical elementComputer science element
a syllable, laghu or gurua symbol from a two-letter alphabet, or one bit
a metre of n syllablesa string of length n
the prastārathe enumeration of every such string
the next-row rule of sūtra 8.22a successor function
the all-guru first rowthe initial state
the all-laghu last rowthe termination condition
Halāyudha's "again and again until the desired prastāra"a loop, or a recursion with a base case

4. Algorithm Specification

ALGORITHM Prastara(n)

INPUT n, a positive integer

OUTPUT every pattern of n syllables, in Pingala's order

row <- n copies of GURU

rows <- [row]

while row contains a GURU do

k <- the position of the first GURU, counting from the left

row <- (k-1 GURUs) + LAGHU + (the rest of row, unchanged)

rows <- rows + [row]

end while

return rows

5. Working Code

The program of [Prastāra in Code], run on three Python interpreters.

6. Test Cases

Ten, in two groups. Five check the size of the output against Halāyudha's own figures: 2, 4, 8, 64 and 4096 rows for one, two, three, six and twelve syllables. Five check its shape for every n from one to twelve: the first row is all guru, the last is all laghu, no row repeats, every row has n syllables, and the iterative construction agrees with the recursive one.

All ten pass, and the fifth of the second group is the one that found a real defect: a recursive construction that appended the new syllable on the wrong side produced a table of the correct size with no repeats, and only the comparison detected the wrong order.

7. Complexity and Limitations

Time and space are both proportional to n times 2 to the power n, which is the size of the output and therefore cannot be improved by any program that prints the whole table.

Limitations. It cannot produce a single distant row without producing everything before it; naṣṭa is the alternative and is a separate implementation. It holds the whole table in memory, which is fine to twelve syllables and impossible at thirty. And the recursive construction builds every intermediate table, so it does about twice the work.

munotes.in367

The Internal Assessment: Building and Presenting the Implementation

8. Conclusion

The rule stated in the eighth chapter of the Chandaḥśāstra, as Halāyudha explains it, is an algorithm in the strict sense: it has a stated input, every step has exactly one result, it terminates after exactly 2 to the power n minus 1 steps, every step is executable by hand, and it produces every pattern once. Implemented directly it agrees with an independent construction from the same sūtra on every metre up to twelve syllables.

The live demonstration

Have it running before you sit down. A demonstration that begins with an installation is a demonstration that has already gone wrong.

Show a success and a failure. Run an ordinary case, then a case the program refuses, and say why it refuses.

Show the test suite running. It takes seconds and it is the strongest thing you can show.

And have the classical source open. Being able to point at the sūtra or the verse your program implements is what makes it an IKS submission rather than a programming exercise.

The viva

Twelve questions of the kind that will be asked, across the eight topics.

On the classical side. What text is this from, and what does it say? Who wrote the commentary you are relying on? What does the text NOT say that your program assumes?

On the mapping. Which part of your program corresponds to which part of the text? Where does the correspondence break down?

On the code. Why did you choose this data structure? What happens on an empty input? Which line implements the rule you quoted?

On the tests. Which of your tests would fail if you deleted this line? How many of your tests check a failure rather than a success? What is a case your tests do not cover?

On the limitations. What is the cost of your program, and why? What would you do differently with more time?

The hardest of them is "what does the text NOT say that your program assumes?" Every one of the eight topics has such an assumption, and every chapter of this book that builds one states it. A student who can answer that question has understood the whole point of the paper.

Quick revision

  • One implementation, alone or in a pair, for twenty of the fifty marks.
  • Five required items: the problem statement in the form IKS concept as CS concept, a formal specification, working code, at least ten test cases, and an analysis of correctness and limitations.
  • Eight required headings: title, problem statement, conceptual mapping table, algorithm specification in pseudo-code, working code, ten test cases, complexity and limitations, conclusion.
  • Heading three is where the understanding is shown and is the one most often missing.
  • Heading six should include cases that must FAIL.
  • Demonstration: have it running, show a success and a refusal, run the tests, and have the source text open.
  • The hardest viva question is what the text does not say that your program assumes.
munotes.in368

The Internal Assessment: Building and Presenting the Implementation

Test yourself

1. List MU's eight required headings in order.

Title in the form IKS Concept as CS Concept; problem statement; conceptual mapping table; algorithm specification in pseudo-code; working code; a minimum of ten test cases; complexity and limitations; conclusion.

2. Why should a test set include cases that fail?

Because a set in which every case succeeds has not exercised the failure behaviour at all, so nothing is known about what the program does with bad input, and a refusal that should happen might not.

3. What distinguishes heading four from heading five?

Heading four is pseudo-code: the steps stated in a notation with no syntax to get wrong. Heading five is the program itself. Pasting the code under both headings answers only one of them.

4. Give the viva question that is hardest to answer, and say why.

What the text does not say that your program assumes. It is hardest because it requires knowing both the classical source and your own design well enough to see where the second went beyond the first, which is exactly what the paper is testing.

munotes.in369

The rest of this subject

These notes are cut from the University's printed syllabus. Open the syllabus itself for the same subject.

Issue
Done!