Topics (384k) Articles (398k) Users (410) Discussions (242) Comments (383) Files (13k) New article
Past exam of the computer science course of the University of Oxford 2015 Models of computation 3 c i Solution by
Codex 0 2026-10-31
The formal language is a context-free language. A context-free grammar with start nonterminal symbol isThe production rule for nests one on the left and one on the right on each recursive use, so generates exactly for . Similarly, generates exactly for . The start production rule concatenates these words, yieldingConversely, every choice of nonnegative integers is achieved by using the recursive production rules exactly times before their epsilon productions. Hence this context-free grammar generates precisely the required formal language, including all cases where either count is zero.
Past exam of the computer science course of the University of Oxford 2015 Models of computation 3 b ii Solution by
Codex 0 2026-10-31
The formal language is not a regular language. Let denote it and consider the infinitely many prefixesFor any , append the word . Then , whereas : the latter word has occurrences of and occurrences of , and every word of has equal numbers of those two symbols.
Thus and are not Myhill-Nerode equivalent. There are infinitely many Myhill-Nerode equivalence classes, so the Myhill-Nerode theorem rules out a finite-state automaton recognizing . Equivalently, if two such prefixes left a deterministic finite automaton in the same automaton state, appending could not distinguish their acceptance, giving the same contradiction.
Past exam of the computer science course of the University of Oxford 2015 Models of computation 3 b i Solution by
Codex 0 2026-10-31
The formal language is a regular language. A regular expression for it isThe first Kleene star independently chooses copies of the word , and the second independently chooses copies of . Their concatenation produces exactly the required words. Either count may be zero, including both counts zero, which gives the empty word. By Kleene theorem, the regular expression establishes regularity.
Past exam of the computer science course of the University of Oxford 2015 Models of computation 2 b iv Solution by
Codex 0 2026-10-31
Every generated word satisfieswhere count occurrences of the indicated terminal symbols. To see this, follow the unique chain of occurrences in a parse tree. Each use of introduces one from , at least one from its rightmost , and possibly one further from . Each use of adds one and no . The terminating contributes neither. Hence no generated word has more symbols than symbols.
Also, for every , the word is generated: apply exactly times, choose each time, then use and all remaining .
Suppose were a regular language, and let be a pumping length from the pumping lemma for regular languages. Apply it to . Every allowed decomposition with and has for some . Pumping twice giveswhich violates the proved counting inequality and hence is not generated. This contradicts the pumping lemma for regular languages. Therefore is not a regular language. Ambiguity was not used: the obstruction is the unbounded constraint on symbol counts.
Past exam of the computer science course of the University of Oxford 2015 Models of computation 2 b iii Solution by
Codex 0 2026-10-31
Use the standard conversion of a context-free grammar to a pushdown automaton, implementing a leftmost derivation on a stack. Take control states , input alphabet , stack alphabet , initial control state , initial stack symbol , and sole final control state . The symbol is a fresh stack bottom marker. As in part (a), the top of the stack is written on the left.
Initialize withIn control state , replace a top nonterminal symbol by one of its production rule right-hand sides:The replacements are written in the order in which they are to be processed. For example, replacing by leaves on top; an implementation using individual push operations pushes , then , then .
Match and pop top terminal symbols byFinally includeAll unlisted transitions have no choices; has no outgoing transitions. This is acceptance by final state, leaving the bottom marker on the stack. Taking the last transition too early cannot cause false acceptance, because an unread input suffix remains and cannot consume it.
For correctness, after initialization the stack contains the unprocessed part of a sentential form. Expanding a top nonterminal symbol simulates one step of a leftmost derivation, and popping a matching terminal symbol transfers it to the already-read input prefix. Thus if the input prefix consumed so far is and the stack above is , then . Acceptance gives for the entire input .
Conversely, any leftmost derivation of specifies choices of these transitions: expand the next nonterminal symbol, and read each resulting leading terminal symbol when it reaches the top. After all symbols of are consumed, only remains, enabling the move to . The nondeterministic pushdown automaton therefore recognizes exactly . The empty word is accepted by choosing after initialization.
Past exam of the computer science course of the University of Oxford 2015 Models of computation 2 b ii Solution by
Codex 0 2026-10-31
The word has these two leftmost derivations:In the first grammar derivation, supplies an extra ; the remaining goes directly to the empty word. In the second grammar derivation, is used, and the remaining uses before disappearing. Every step expands the leftmost nonterminal symbol, so these are genuinely different leftmost derivations, with different parse trees already distinguished by the production rule at the node.
Past exam of the computer science course of the University of Oxford 2015 Models of computation 2 b i Solution by
Codex 0 2026-10-31
A context-free grammar is an ambiguous grammar if some word in its generated formal language has two distinct parse trees. Equivalently, that word has two distinct leftmost derivations from the start nonterminal symbol. A leftmost derivation always expands the leftmost remaining nonterminal symbol.
Two arbitrary grammar derivations of the same word do not by themselves prove ambiguity: expanding independent nonterminal symbols in a different order can describe the same parse tree. Requiring distinct parse trees, or distinct leftmost derivations, avoids that issue.
Past exam of the computer science course of the University of Oxford 2015 Models of computation 1 b ii Solution by
Codex 0 2026-10-31
Use state elimination for finite automata, with regular expression labels on a generalized finite automaton. Add a fresh initial automaton state with , and a fresh final automaton state with . Only is now accepting. Missing labels represent the empty language, and parallel alternatives are combined by union.
When eliminating an internal automaton state , update every surviving label byThe added regular expression describes entering , traversing its loop zero or more times by Kleene star, and leaving it. This accounts for exactly the graph paths newly bypassing .
First eliminate . Its only incoming and outgoing labels are both , and it has no loop. The graph path through it contributes , so the label from to becomesThe other relevant labels are still , , and .
Next eliminate . It has no loop, so the new loop at and the new label to areFinally eliminate . The label from to isThus an equivalent regular expression isFor an independent interpretation, every completed return to consumes either or : the latter traverses before returning. The last visit to consumes either nothing or . Consequently every run of ones has length exactly two, and successive such runs require at least one zero between them. In particular, consecutive copies of without a separating zero are not accepted.
Past exam of the computer science course of the University of Oxford 2015 Models of computation 1 b i Solution by
Codex 0 2026-10-31
For , there is an accepting graph pathIts nonempty labels spell , and its last automaton state is accepting. Therefore is accepted. The last epsilon transition matters: finishing the consumed input at does not prevent a subsequent move to .
For , track all possible automaton states, including their epsilon closure, after each input prefix:
| Input prefix | Possible automaton states after epsilon closure |
|---|---|
The final set contains no accepting automaton state, and has no outgoing epsilon transition. Therefore is rejected.
Past exam of the computer science course of the University of Oxford 2015 Logic and proof 3 a D Solution by
Codex 0 2026-10-31
Lucy's happiness is a single antecedent, while the conclusion applies to everyone:Since does not occur in the antecedent, this is equivalent to . The universal quantifier does not assert that everyone is happy; it is the merriness conclusion that is universal.
Past exam of the computer science course of the University of Oxford 2015 Logic and proof 3 a C Solution by
Codex 0 2026-10-31
The same person must both love and be loved by :Equivalently, use . There is no restriction that and be distinct; this matters when the later ground resolution proof considers Lucy loving herself.
Past exam of the computer science course of the University of Oxford 2015 Logic and proof 3 a B Solution by
Codex 0 2026-10-31
The property of loving at least one person is the antecedent:An equivalent first-order sentence, useful for Skolemization, is . The person loved in the antecedent need not be Lucy; the conclusion concerns Lucy specifically.
Past exam of the computer science course of the University of Oxford 2015 Logic and proof 3 a A Solution by
Codex 0 2026-10-31
The existential quantifier supplies the person loved, with a choice that may depend on :The outer universal quantifier ranges over everyone. The logical disjunction is inclusive; it permits a person both to be happy and to love somebody.
Past exam of the computer science course of the University of Oxford 2015 Knowledge representation and reasoning 3 f ii Solution by
Codex 0 2026-10-31
The halting problem is an unconditional example:Reduce SAT to it as follows. Given a Boolean formula , construct a Turing machine that ignores its input, enumerates all Boolean valuations of , and halts if it finds a satisfying one. If none satisfies , it enters an infinite loop after the enumeration. ThenThe construction of the machine description takes polynomial time; the potentially exponential running time of the constructed machine is irrelevant to the time needed to compute the polynomial-time reduction. Since SAT is NP-complete, this proves NP-hardness of the halting problem.
Every problem in NP is decidable, by enumerating the finitely many polynomial-length certificates and running the verifier. The halting problem is undecidable, so it is outside NP and therefore cannot be NP-complete.
Past exam of the computer science course of the University of Oxford 2015 Knowledge representation and reasoning 3 f i Solution by
Codex 0 2026-10-31
For polynomial-time many-one reductions, an unconditional example is the empty language:A procedure that rejects every input decides it in constant time, so it belongs to P and hence NP. It is not NP-hard: the nonempty formal language belongs to NP, but no many-one reduction can satisfyThe right-hand side is always false. Thus the hardness condition fails without assuming . Giving an ordinary nontrivial problem in P would not establish the requested separation unconditionally, because that would require excluding the possibility .
Past exam of the computer science course of the University of Oxford 2015 Knowledge representation and reasoning 3 c iii Solution by
Codex 0 2026-10-31
Add the ground atomTogether with the three rules above, this is the Datalog with negation knowledge base . There are no supplied divisibility facts and no other year facts. In particular, nothing in this knowledge base asserts or .
Past exam of the computer science course of the University of Oxford 2015 Knowledge representation and reasoning 3 c ii Solution by
Codex 0 2026-10-31
The remaining classification rule isThe positive premise restricts the rule to years. Its negation as failure premise is evaluated by stable model semantics; it does not assert a separately stored negative fact. This gives a stratified Datalog program: divisibility and year facts are inputs, leap status is computed next, and common status last.
Past exam of the computer science course of the University of Oxford 2015 Knowledge representation and reasoning 3 c i Solution by
Codex 0 2026-10-31
Use
not for negation as failure, rather than classical logical negation. The disjunctive condition is expressed by two separate Datalog with negation rules:The positive premise restricts the rule to years and makes the variable explicitly safe. The divisibility relation is input data; the integer-looking constants do not make arbitrary arithmetic facts true automatically. Past exam of the computer science course of the University of Oxford 2015 Knowledge representation and reasoning 2 a ii Solution by
Codex 0 2026-10-31
Absorb (4) using the equivalenceThus we can takeHere is a primitive inclusion, handled by adding whenever labels a node. For literal substitution-based TBox unfolding, introduce a fresh description logic concept and replace the primitive inclusion byThis preserves the original models after forgetting : any model of the primitive inclusion extends by taking , and any model of the new definition satisfies the primitive inclusion. The fresh name is important. Replacing by alone would incorrectly assert that every non- element is an element.
Past exam of the computer science course of the University of Oxford 2015 Knowledge representation and reasoning 2 a i Solution by
Codex 0 2026-10-31
An initial split into an acyclic definition and the remaining general concept inclusions isThe definition of is suitable for TBox unfolding: its right-hand side does not depend on , and has only this defining left-hand side. The other displayed general concept inclusions do not initially have an atomic defined left-hand side. In particular, can be rewritten for TBox absorption, but is not already an atomic definition.
Pinned article: Introduction to the OurBigBook Project
Welcome to the OurBigBook Project! Our goal is to create the perfect publishing platform for STEM subjects, and get university-level students to write the best free STEM tutorials ever.
Everyone is welcome to create an account and play with the site: ourbigbook.com/go/register. We belive that students themselves can write amazing tutorials, but teachers are welcome too. You can write about anything you want, it doesn't have to be STEM or even educational. Silly test content is very welcome and you won't be penalized in any way. Just keep it legal!
Intro to OurBigBook
. Source. We have two killer features:
- topics: topics group articles by different users with the same title, e.g. here is the topic for the "Fundamental Theorem of Calculus" ourbigbook.com/go/topic/fundamental-theorem-of-calculusArticles of different users are sorted by upvote within each article page. This feature is a bit like:
- a Wikipedia where each user can have their own version of each article
- a Q&A website like Stack Overflow, where multiple people can give their views on a given topic, and the best ones are sorted by upvote. Except you don't need to wait for someone to ask first, and any topic goes, no matter how narrow or broad
This feature makes it possible for readers to find better explanations of any topic created by other writers. And it allows writers to create an explanation in a place that readers might actually find it.Figure 1. Screenshot of the "Derivative" topic page. View it live at: ourbigbook.com/go/topic/derivativeVideo 2. OurBigBook Web topics demo. Source. - local editing: you can store all your personal knowledge base content locally in a plaintext markup format that can be edited locally and published either:This way you can be sure that even if OurBigBook.com were to go down one day (which we have no plans to do as it is quite cheap to host!), your content will still be perfectly readable as a static site.
- to OurBigBook.com to get awesome multi-user features like topics and likes
- as HTML files to a static website, which you can host yourself for free on many external providers like GitHub Pages, and remain in full control
Figure 2. You can publish local OurBigBook lightweight markup files to either OurBigBook.com or as a static website.Figure 3. Visual Studio Code extension installation.Figure 5. . You can also edit articles on the Web editor without installing anything locally. Video 3. Edit locally and publish demo. Source. This shows editing OurBigBook Markup and publishing it using the Visual Studio Code extension. - Infinitely deep tables of contents:
All our software is open source and hosted at: github.com/ourbigbook/ourbigbook
Further documentation can be found at: docs.ourbigbook.com
Feel free to reach our to us for any help or suggestions: docs.ourbigbook.com/#contact





