category
stringclasses
107 values
title
stringlengths
15
179
question_link
stringlengths
59
147
question_body
stringlengths
53
33.8k
answer_html
stringlengths
0
28.8k
__index_level_0__
int64
0
1.58k
tokenization
LL grammars and left-recursiviity
https://cs.stackexchange.com/questions/6809/ll-grammars-and-left-recursiviity
<p>Why LL(k) and LL(∞) are incompatible with left-recursion? I understand that a LL(k) language can support left-recursivity provided that with k-overahead tokens can be resolved any ambiguity. But, with a LL(∞) grammar, which type of ambiguities can't be solved?</p>
<p>The problem that $LL$ variants have with left recursion is inherent to the way $LL$ works: it is a top-down type parser, which means it replaces nonterminals by their productions.</p> <p>An $LL$-style parser works as follows. It traverses the input from left to right in one go. If we are at some point in the input,...
400
tokenization
Two Step Verification. 4 digits vs 6 digits
https://cs.stackexchange.com/questions/30300/two-step-verification-4-digits-vs-6-digits
<p>From a security level standpoint (such as Server, DataBase, Token Code, Authorization, Authentication, etc.) in regarding the Two Step Verification, usually Apple send a total of <strong>4</strong> digits security code vs Google send a total of <strong>6</strong> digits security code. What are the main differences?<...
<p>The number of digits in such a <a href="http://en.wikipedia.org/wiki/One-time_password" rel="nofollow">one-time password</a> is determined by the acceptable risk that an attacker who doesn't receive the verification code will be able to guess it (lucky guess). This risk takes into account several factors:</p> <ul> ...
401
tokenization
How the LZ77 compression algorithm handles the case when the entire look-ahead buffer is matched in the search buffer
https://cs.stackexchange.com/questions/75925/how-the-lz77-compression-algorithm-handles-the-case-when-the-entire-look-ahead-b
<p>The LZ77 compression algorithm uses a sliding window technique, where the window consists of a look-ahead puffer and a search-buffer. What I am wondering is how the algorithm handles the case if the match of the word in the search-buffer is the entire word in the look-ahead buffer? According to the desriptions I fin...
<p>A simple solution: your look ahead buffer is no smaller than your longest match length. As long as the start position is in the Search Buffer(a min of 1 byte), then the look-ahead buffer will have that one extra byte available to use as the follow byte</p>
402
tokenization
How to represent sentences with their dependency parses as input to an RNN?
https://cs.stackexchange.com/questions/96814/how-to-represent-sentences-with-their-dependency-parses-as-input-to-an-rnn
<p>I am working on a task embedding sentences into a lower-dimensional space according to style, both grammatical and lexical. As such, I want to have as input the linear ordering of tokens in each sentence, together with its dependency parse as provided by spacy. </p> <p>In particular, I'd like to find a way to tie ...
403
language modeling
Next-Word Prediction, Language Models, N-grams
https://cs.stackexchange.com/questions/18354/next-word-prediction-language-models-n-grams
<p>I was looking into how a <strong>next-word prediction engine</strong> like swift key or XT9 can be implemented.</p> <p>Here's what I did.</p> <ul> <li>I read about <strong>n-grams</strong> here - en.wikipedia.org/wiki/N-gram and aicat.inf.ed.ac.uk/entry.php?id=663</li> <li>I read about <strong>Language Models/Mark...
404
language modeling
Language constructs vs. forms in semantic modeling
https://cs.stackexchange.com/questions/171438/language-constructs-vs-forms-in-semantic-modeling
<p>I saw the following paragraph in a data modeling <a href="https://www.gooddata.com/blog/what-a-semantic-data-model/" rel="nofollow noreferrer">article</a>:</p> <blockquote> <p>Semantics relates to the study of references, specifically describing the real meaning between symbols or words. In computer science, semanti...
<p><em>Form</em> is an alternative (and uncommon) word for <em><a href="https://en.wikipedia.org/wiki/Syntax" rel="nofollow noreferrer">syntax</a></em>, used in particular when contrasting form with <em>meaning</em> (semantics).</p> <p>An example:</p> <blockquote> <p>Irons (1961) discussed “A Syntax Directed Compiler f...
405
language modeling
How can Kneser-Ney Smoothing be integrated into a neural language model?
https://cs.stackexchange.com/questions/127864/how-can-kneser-ney-smoothing-be-integrated-into-a-neural-language-model
<p>I found a paper titled <a href="https://doi.org/10.1109/ICIP.2016.7532765" rel="nofollow noreferrer">Multimodal representation: Kneser-Ney Smoothing/Skip-Gram based neural language model</a>. I am curious about how the Kneser-Ney Smoothing technique can be integrated into a feed-forward neural language model with on...
406
language modeling
N-gram language model question
https://cs.stackexchange.com/questions/105909/n-gram-language-model-question
<p>I have this question I found regarding n-gram modelling in the textbook <em>Speech and Language Processing</em>:</p> <blockquote> <p>Suppose we didn't use the end symbol &lt;/s&gt;. Train an unsmoothed bigram grammar on the following corpus without using the end-symbol &lt;/s&gt;.</p> <blockquote> <p>&lt;s&gt; a b<b...
<p>For these 2-word sentences, notice that the original equation for the MLE approximation of the probabilities of the bigram is:</p> <p><span class="math-container">$$P(w_i|w_{i-1}) = \frac{C(w_{i-1}w_i)}{\sum_w{C(w_{i-1}w)}} = \frac{C(w_{i-1}w_i)}{C(w_{i-1})}, $$</span></p> <p>where the denominator <span class="math-...
407
language modeling
What are the 175 billion parameters used in the GPT-3 language model?
https://cs.stackexchange.com/questions/156130/what-are-the-175-billion-parameters-used-in-the-gpt-3-language-model
<p>I am currently working my way through <em><a href="https://arxiv.org/abs/2005.14165" rel="nofollow noreferrer">Language Models are Few-Shot Learners </a></em>, the initial 75-page paper about <a href="https://en.wikipedia.org/wiki/GPT-3" rel="nofollow noreferrer">GPT-3</a>, the language learning model spawning off i...
<p>The 175 billion parameters in the GPT-3 language model are values that are used by the model to make predictions about the next word or words in a sentence or piece of text. These parameters are essentially the weights that are applied to the input data in order to make the model's predictions. In a neural network, ...
408
language modeling
Regular languages - models of computation
https://cs.stackexchange.com/questions/9645/regular-languages-models-of-computation
<p>As far as a I understand, a regular language is a set of words that can be run in a DFA.</p> <p>$L_1 = \{ x\#y \mid x,y \in \{0,1\}^* \ \text{and} \ |x| = |y| \}$</p> <p>$L_2 = \{ xy \mid x,y \in \{0,1\}^* \ \text{and} \ |x| = |y| \}$</p> <p>$L_1$ is not regular but $L_2$ is, why is that? Is it possible to creat...
409
language modeling
What real-world computer languages cannot be described by deterministic grammars?
https://cs.stackexchange.com/questions/49037/what-real-world-computer-languages-cannot-be-described-by-deterministic-grammars
<p>Are there any examples of real-world computer languages that are non-deterministic?</p> <p>By computer languages I include programming languages, markup languages, query languages, modeling language, transformation languages, etc.</p> <p>By non-deterministic I mean they cannot be parsed with deterministic grammars...
<p>Yes. Many modern programming languages have this property, including Algol 60, C, and C++; see below for details.</p> <hr> <p>Algol 60 famously had <a href="https://en.wikipedia.org/wiki/Dangling_else" rel="nofollow noreferrer">the dangling else problem</a>, for some programs, it was ambiguous how they should be ...
410
language modeling
Are objects appropriate for modeling the real world?
https://cs.stackexchange.com/questions/129926/are-objects-appropriate-for-modeling-the-real-world
<p>First of all, I know objects are not meant to model the real world, although they have been marketed as such and perhaps that was an intention at some point.</p> <p>Here I say 'modeling the real world' in a general sense. That includes simulations, modeling of abstract (non-real) concepts and modeling of business su...
<p>Object-oriented programming languages are designed to support <em>programming</em>. Whether they &quot;properly&quot; model the real world is beside the point and not the primary goal. So, when you ask &quot;why haven't [these requirements] been included?&quot;, it's likely because those weren't considered relevan...
411
language modeling
Model paths by regular languages
https://cs.stackexchange.com/questions/44733/model-paths-by-regular-languages
<p>I want use DFA to describe a sequence of movements in a 2D-space (language will be the path accepted by automaton in a particular case).</p> <p>That is a typical modeling problem: how can I encode a sequence of 2D movements in a DFA?</p> <p>Infact, walking through DFA or NFA seems a process analogous to walk thro...
<p>If the number of locations (e.g. points or regions) are finite, naively, you can say that these locations are my states and you can directly use a DFA with an alphabet containing UP, DOWN. But you already said it's impracticable for your case.</p> <p>Then, let's look into where the number of locations is infinite o...
412
language modeling
How is algorithm complexity modeled for functional languages?
https://cs.stackexchange.com/questions/74494/how-is-algorithm-complexity-modeled-for-functional-languages
<p>Algorithm complexity is designed to be independent of lower level details but it is based on an imperative model, e.g. array access and modifying a node in a tree take O(1) time. This is not the case in pure functional languages. The Haskell list takes linear time for access. Modifying a node in a tree involves maki...
<p>If you assume that the $\lambda$-calculus is a good model of functional programming languages, then one may think: the $\lambda$-calculus has a seemingly simple notion of time-complexity: just count the number of $\beta$-reduction steps $(\lambda x.M)N \rightarrow M[N/x]$. </p> <p>But is this a good complexity meas...
413
language modeling
Question about word embeddings in a specific language model - GPT-2
https://cs.stackexchange.com/questions/116184/question-about-word-embeddings-in-a-specific-language-model-gpt-2
<p>How were the <a href="https://openai.com/blog/better-language-models/" rel="nofollow noreferrer">GPT-2</a> token embeddings constructed? </p> <p>The authors mention that they used Byte Pair Encoding to construct their vocabulary. But BPE is a compression algorithm that returns a list of subword tokens that would be...
414
language modeling
Data type implementation of 1.58 bits
https://cs.stackexchange.com/questions/169098/data-type-implementation-of-1-58-bits
<p>In Large Language Models, using 1-bit binary weights (<a href="https://arxiv.org/pdf/2310.11453" rel="nofollow noreferrer">BitNet: Scaling 1-bit Transformers for Large Language Models - Wang et al, 2023</a>) instead of 32-bit floating point weights has numerous advantages. Some of the recent research (<a href="https...
<p>They are using trinary values which have an information density of <span class="math-container">$\log_2 3 = 1.584963...$</span> bits per trinary digit.</p> <p>The effective implementation for computation in traditional compute devices is going to be 2 bits in a signed magnitude style. They can be stored using a vari...
415
language modeling
What are the other language models of computation similar to lambda calculus?
https://cs.stackexchange.com/questions/106004/what-are-the-other-language-models-of-computation-similar-to-lambda-calculus
<p>I hope this question makes sense, but I was wondering if there are other models of computation similar to lambda calculus that you can use to build up axiomatic mathematical and logical fundamentals like numbers, operators, arithmetic functions and such?</p>
<p>Yes, there are many models of computation, and of those many are extensions or modifications of the <span class="math-container">$\lambda$</span>-calculus. You may wish to learn about <a href="https://ncatlab.org/nlab/show/partial+combinatory+algebra" rel="noreferrer">partial combinatory algebras</a>, which are very...
416
language modeling
If Large Language Models like ChatGPT grow, do also their problems grow?
https://cs.stackexchange.com/questions/159907/if-large-language-models-like-chatgpt-grow-do-also-their-problems-grow
<p>In a video Noam Chomsky said, that if these LLM get bigger, than also the things they are not good at get bigger too. He doesn't explain more details about this. So is this true? In what way do their problems get bigger? Sry for the little context of in what they are getting also more bad at.</p> <p>here is the vide...
<p>First, it's important to understand that Chomsky is a linguist (a syntactician) and that the goals of linguistics are very different from artificial intelligence. In particular, the two domains differ greatly as to what constitutes a satisfactory theory of human language. For the modern study of syntax, it is to hav...
417
language modeling
Computational models - proving language is decidable
https://cs.stackexchange.com/questions/44474/computational-models-proving-language-is-decidable
<p>I tried to prove that the following language is recursive/decidable/in R: for $\Sigma=\{0,1\}$, $k$ a positive integer: $$ L_k= H_\text{TM,epsilon}\cap \Sigma^k $$ where $H_\text{TM,epsilon}=\{\langle M\rangle\mid M \text{ is a TM that halts on epsilon input}\}$</p> <p>It is easy to prove because $L_k$ is finite, b...
418
language modeling
Is there a way to connect a deep language model output to input?
https://cs.stackexchange.com/questions/115948/is-there-a-way-to-connect-a-deep-language-model-output-to-input
<p>In models like GPT-2, TXL and Grover, is there a good way to know which input weights (tokens) resulted in each token of the output? </p>
419
language modeling
Programming languages and Model of computations
https://cs.stackexchange.com/questions/133116/programming-languages-and-model-of-computations
<p>I am learning about model of computation and I found this <a href="https://en.wikipedia.org/wiki/Model_of_computation" rel="nofollow noreferrer">wikipedia</a> entry that categorises and outlines various model of computation.</p> <p>Now I want to know the programming languages that builds on these models.</p> <p>I am...
<p>Functional programming languages can often be thought of as built on the lambda calculus.</p> <p>Imperative programming languages can often be thought of as built on the RAM (Random Access Machine) model of computation.</p> <p>Some hardware description languages can be thought of as being built on the finite-state m...
420
language modeling
What are the inputs to an LSTM for Slot Filling Task
https://cs.stackexchange.com/questions/71032/what-are-the-inputs-to-an-lstm-for-slot-filling-task
<p>I am confused on the inputs of a Long-Short Term Memory (LSTM) for the slot filling task in Spoken Language Understanding. </p> <p>Before I worked on this, I implemented a language model with a Recurrent Neural Network (RNN) and then with a LSTM. The input to the RNN and LSTM language models was a one hot vector, w...
421
language modeling
How can I find the perplexity of a text by the perplexity of its sentences?
https://cs.stackexchange.com/questions/105220/how-can-i-find-the-perplexity-of-a-text-by-the-perplexity-of-its-sentences
<p>For a bigram language model, I can calculate the perplexity of sentences of a test document. However, I'm not sure what would be the perplexity of the whole document. Should I get the average of the perplexities of sentences?</p>
422
language modeling
Uses of unary or sparse languages in other models
https://cs.stackexchange.com/questions/60461/uses-of-unary-or-sparse-languages-in-other-models
<p>In the turing model we have the statements that if there is an unary or sparse language that is NP complete then P=NP and if there is a Turing reduction from an NP complete problem to an unary or sparse language then NP is in P/poly.</p> <p>Is there an analog of these statements in the Valiant model and in the BSS ...
423
language modeling
What is meant by a full abstract model of a lambda-calculus like language?
https://cs.stackexchange.com/questions/116807/what-is-meant-by-a-full-abstract-model-of-a-lambda-calculus-like-language
<blockquote> <p>The simply typed lambda-calculus with numbers and fix has long been a favorite experimental subject for programming language researchers, since it is the simplest language in which a range of subtle semantic phenomena such as full abstraction arise. </p> </blockquote> <p>I tried to find a definition ...
<p>In denotational semantics, you want to be able to map each of your language terms to some object in your semantic domain or model. Now, it cannot be any arbitrary domain/model as you like, but, informally speaking, something that gives a good intuition about how the language works (its computational behavior).</p> ...
424
language modeling
should you take question mark as a separate word in bigram language modelling when finding probability?
https://cs.stackexchange.com/questions/132713/should-you-take-question-mark-as-a-separate-word-in-bigram-language-modelling-wh
<p>the corpus</p> <p><s> what is the shape ? </s> <s> what is the colour ? </s> <s> what colour is it ? </s> <s> it is what ? </s> <s> is it red ? </s> <s> what is it ? </s> <s> what shape is it ? </s> <s> it is red </s> <s> it is green </s> <s> the colour is red </s> <s> the shape is square </s> <s> red is the colour ...
425
language modeling
Model checking and dependently typed languages for formal verification
https://cs.stackexchange.com/questions/170371/model-checking-and-dependently-typed-languages-for-formal-verification
<p>What are the differences and limitations between model checking and type-checking dependent types for verifying correctness?</p> <p>If I were to model a state machine in a language like Idris, what can't I verify that a model checker can and vice-versa? I can enforce valid transitions in Idris, but can I prove reach...
<p>Model checkers tend to be better for checking control-flow properties, i.e., about the sequence of events, particularly in the presence of concurrency, threads, etc.</p> <p>Dependent types tend to be better for checking data-flow properties, i.e., about the values and types that variables can hold, and typically are...
426
language modeling
Formal model of execution for Java (or general imperative language)
https://cs.stackexchange.com/questions/82424/formal-model-of-execution-for-java-or-general-imperative-language
<p>I'm trying to prove some statements about execution in Java programs under some heavy restrictions (basically I have a conjecture that if two methods satisfy a set of constraints for a given input then the are they equivalent - i.e., that return value and state after execution are identical). To prove this I'm looki...
<p><a href="https://www.cis.upenn.edu/~bcpierce/papers/fj-toplas.pdf" rel="noreferrer">Featherweight Java</a> is quite highly regarded in the PL community. But if that doesn't suit your needs, here's a general approach to modelling:</p> <ul> <li>Formalize your language's AST into expressions and statements</li> <li>Wr...
427
language modeling
Compression of domain names
https://cs.stackexchange.com/questions/3056/compression-of-domain-names
<p>I am curious as to how one might <em>very compactly</em> compress the domain of an arbitrary <a href="http://en.wikipedia.org/wiki/Internationalized_domain_name" rel="nofollow noreferrer">IDN</a> hostname (as defined by <a href="https://www.rfc-editor.org/rfc/rfc5890" rel="nofollow noreferrer">RFC5890</a>) and suspe...
<p>Huffman coding is optimal for letters and can certainly be adapted to sequences. For instance, if the sequence "ab" results in fewer bits than the bits for "a" and "b", then simply add it to the tree ...and so on.</p> <p>...you can also probably use some simple library which does that all for you with near optimal ...
428
language modeling
n-gram model: why conditioning on the start symbol &lt;s&gt;?
https://cs.stackexchange.com/questions/161693/n-gram-model-why-conditioning-on-the-start-symbol-s
<p><a href="https://i.sstatic.net/ngTqN.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ngTqN.png" alt="enter image description here" /></a></p> <p>from the <a href="https://web.stanford.edu/%7Ejurafsky/slp3/3.pdf" rel="nofollow noreferrer">book</a>, Speech and Language Processing (3rd ed. draft)</p> <p>...
429
language modeling
How to create model for a powerful language whose programs are guaranteed to terminate?
https://cs.stackexchange.com/questions/103129/how-to-create-model-for-a-powerful-language-whose-programs-are-guaranteed-to-ter
<p>I'm creating a powerful regular expression matching system that can be augmented by adding small microprograms to deterministic finite automaton (DFA) states. The microprogram solves the <a href="http://pages.cs.wisc.edu/~estan/publications/bigbang.pdf" rel="nofollow noreferrer">big bang</a> issue where a rule of th...
430
language modeling
LTL properties in bounded model checking via assertions
https://cs.stackexchange.com/questions/49169/ltl-properties-in-bounded-model-checking-via-assertions
<p>Is there a way to check LTL properties in a bounded model checker?</p> <p>As an example, consider a liveness property ($G F p$ - always eventually $p$)? Suppose we have the following trivial program</p> <pre><code>#include &lt;pthread.h&gt; int a = 0; void * f(void * x) { a = 1; return x; } int main() { pthr...
<p>The property "always eventually main terminates" should be expressible and verifiable in a bounded model checker. For such properties, the model checker would either verify the property or find a "acceptance cycle" that shows that there exists a loop in an execution trace that does not satisfy the property (by consi...
431
language modeling
What are the conditions necessary for a programming language to have no undefined behavior?
https://cs.stackexchange.com/questions/161663/what-are-the-conditions-necessary-for-a-programming-language-to-have-no-undefine
<p>For context, yesterday I posted <a href="https://cs.stackexchange.com/q/161643/131435">Does the first incompleteness theorem imply that any Turing complete programming language must have undefined behavior?</a>. Part of what prompted me to ask that question in the first place is that, awhile ago, someone on the lea...
<p>The problem of statically detecting undefined behavior has nothing to do with undefinedness as such. It's just impossible to prove in general that programs in a Turing-complete language will do anything (<a href="https://en.wikipedia.org/wiki/Rice%27s_theorem" rel="nofollow noreferrer">Rice's theorem</a>). For examp...
432
language modeling
Can other models of computation equivalent to Turing machines also recognize the same languages?
https://cs.stackexchange.com/questions/64207/can-other-models-of-computation-equivalent-to-turing-machines-also-recognize-the
<p>There are other models of computation equivalent to Turing machines in terms of computability. </p> <p>Turing machines also recognize recursively enumerable languages.</p> <p>My questions are</p> <ul> <li>Do other models of computation equivalent to Turing machines also recognize the same languages?</li> <li>Are ...
<p>Two models of computation are equivalent iff they can compute exactly the same set of functions. So the answer to your question is yes, they can recognize the same languages. The definition of "accept" has to be altered a bit to fit the new model, of course, since for example in the lambda calculus you have no state...
433
language modeling
The importance of the language semantics for code generation and frameworks for code generation in model-driven development
https://cs.stackexchange.com/questions/55781/the-importance-of-the-language-semantics-for-code-generation-and-frameworks-for
<p>I am implementing worflow where the code in industrial programming languages (JavaScript and Java) should be generated from the formal (formally verified) expressions (from ontologies as objects and rule formulas as behaviors). What is the best pratice for such code generation? Are some frameworks available for this...
<p>In general when we talk about code generation (or model-to-model transformation in general), clearly defined semantics is quite important, since such transformations usually make sense when both the source and the target model <em>semantically match</em> according to some criteria. For example, programmers might des...
434
language modeling
Smallest class of automata model whose corresponding language class contains CFL and is closed against (dis)allowing nondeterminism in the model
https://cs.stackexchange.com/questions/43152/smallest-class-of-automata-model-whose-corresponding-language-class-contains-cfl
<p>From <a href="https://cs.stackexchange.com/questions/43137/machines-for-context-free-languages-which-gain-no-extra-power-from-nondeterminis?noredirect=1#comment86645_43137">a comment</a>, an interesting question popped up. The class of CFLs (the languages recognized by PDAs) are obviously not closed under nondetermi...
<p>The notion of a <em>PDA</em> can be generalized to an <em>$S(n)$ auxiliary pushdown automaton ($S(n)$-AuxPDA)</em>. It consists of</p> <ol> <li>a read-only input tape, surrounded by endmarkers,</li> <li>a finite state control,</li> <li>a read-write storage tape of length $S(n)$, where $n$ is the length of the input...
435
language modeling
Next Word Prediction using n-gram &amp; Tries
https://cs.stackexchange.com/questions/18351/next-word-prediction-using-n-gram-tries
<p>I am studying the following paper for understanding next-word prediction using n-gram &amp; trie: - <a href="http://nlp.cs.berkeley.edu/pubs/Pauls-Klein_2011_LM_paper.pdf" rel="nofollow">http://nlp.cs.berkeley.edu/pubs/Pauls-Klein_2011_LM_paper.pdf</a> Before this, I did some brief study on what are n-grams. And, I ...
436
language modeling
Does ChatGPT use specific sub-programs
https://cs.stackexchange.com/questions/156287/does-chatgpt-use-specific-sub-programs
<p>I have had a somewhat hard time trying to understand how ChatGPT can &quot;solve&quot; some tasks that cannot be entirely cast as language-model-based rephrasing of textual subsets of the internet directed by a textual query.</p> <p>For example, ChatGPT seems to be able to do calculations, even if not always appropr...
<blockquote> <p>It seems to me that it is not simply one huge neural network, but has access to some additional programs like a calculator</p> </blockquote> <p>I'd add to <a href="https://cs.stackexchange.com/users/755/d-w">D.W.</a>'s answer that OpenAI's CEO <a href="https://www.youtube.com/live/outcGtbnMuQ?feature=sh...
437
language modeling
Question about bigram model
https://cs.stackexchange.com/questions/52526/question-about-bigram-model
<p>I am trying to build a bigram letter model.</p> <p>I obtain a sequence of words in a form of ['hello','I','am','Johnny'].</p> <p>Firstly, I lower all the words to obtain : ['hello','i','am','johnny'].</p> <p>I am capable of building a bigram letter model, but I have read somewhere that you should provide some kin...
<p>The padding is there since the distribution of letters at the beginning and end of words is very different from their distribution inside words. To capture that, separate words with spaces and add trailing spaces on both sides: <code>' hello i am johnny '</code>.</p>
438
language modeling
How do you have a type typed &quot;Type&quot; when implementing a programming language?
https://cs.stackexchange.com/questions/131117/how-do-you-have-a-type-typed-type-when-implementing-a-programming-language
<p>I am working on the <em>base</em> of a language model, and am wondering how to represent the base type, which is a type <code>Type</code>. I have heard of an &quot;infinite chain of types&quot;, but (a) I can't seem to find it on the internet while searching anymore, and (b) I am not sure if that's what I need or wh...
<p>I think what you might have found in your previous researches might be a <a href="https://en.wikipedia.org/wiki/Pure_type_system" rel="nofollow noreferrer">pure type system</a>.</p> <p>In a pure type system, to avoid having &quot;Type&quot; being a &quot;Type&quot; at the same level that &quot;Int&quot; is a &quot;T...
439
language modeling
How do RNN&#39;s handle providing output with different dimension than input
https://cs.stackexchange.com/questions/54607/how-do-rnns-handle-providing-output-with-different-dimension-than-input
<p>It seems like an RNN has to have the h<sub>t-1</sub> needs to be the same size as the input vector since they're being added to one another, but if you're doing something like modeling to another language or classification, how would you handle this? I'd imagine you'd just have a fully connected layer that would pr...
<p>So Basically what happens is the input x is multiplied by a hidden layer U to yield a state vector s, which transforms it to a new dimensionality. Then The recurrent layer W is always a square matrix to maintain the dimensions of s. Lastly, the output matrix V is multiplied to update the matrix to the output dimen...
440
language modeling
What are the modern alternatives to Backus–Naur form and what are their advantages?
https://cs.stackexchange.com/questions/127499/what-are-the-modern-alternatives-to-backus-naur-form-and-what-are-their-advantag
<p>I am very new to the whole concept of context-free grammars to represent the syntax tree of formal languages (i.e., programming languages). It seems that the Backus–Naur form (BNF) is the oldest of all possible notations and the most prevalent one. Though it looks like to be an ancient piece of art. Now I'm wonderin...
<h1>Answer 1: The question is meaningless as written.</h1> <p>You are mixing different <em>kinds</em> of notations here that are intended for different purposes.</p> <ul> <li>BNF and ABNF are concrete notations for writing the abstract concept of a <a href="https://en.wikipedia.org/wiki/Context-free_grammar" rel="nofol...
441
language modeling
Theoretical CSPs where (in)equality constraints can be expressed as a single constraint?
https://cs.stackexchange.com/questions/65097/theoretical-csps-where-inequality-constraints-can-be-expressed-as-a-single-con
<p>I'm designing puzzles by running a <a href="https://en.wikipedia.org/wiki/Constraint_satisfaction_problem#Flexible_CSPs" rel="nofollow">MAX-CSP</a> solver, and it works nicely in practice. For concreteness, my problems have the following form (in a pseudo-modeling language):</p> <pre><code># set up vars &amp; their...
<p>In complexity theory, CSPs are usually specified as a set of allowed <em>predicates</em>. If the (finite) domain is $D$, a predicate of arity $d$ is an arbitrary subset of $D^d$ of allowed values. In particular, equality (or inequality) is a predicate of arity 2.</p> <p>This is the point of view taken in <a href="h...
442
language modeling
As a Teacher: Choosing a suitable programming language
https://cs.stackexchange.com/questions/66983/as-a-teacher-choosing-a-suitable-programming-language
<p><em>I'm not sure if it's the right place for this question. Sorry if going a bit off-topic.</em></p> <p>Choosing a suitable Language for the first programming course is one of the most important things that every related teacher/lecturer should bear in mind; especially if the students are young or having a limited ...
<p>My answer? Python.</p> <p>Let me explain by tackling all your points.</p> <ol> <li><strong>Simplicity</strong>. Python code reads like English. Seriously, how simple is <code>print("Hello World!")</code></li> <li><strong>Generality</strong>. Python can be used for web development (via. Flask/Django), data analysis...
443
language modeling
Canonical reference on agent-based computing
https://cs.stackexchange.com/questions/2764/canonical-reference-on-agent-based-computing
<p>I am interested in exploring the world of <a href="http://en.wikipedia.org/wiki/BDI_software_agent" rel="nofollow">BDI agents</a> (software agents that possess "beliefs, desires, intentions", essentially the agent has knowledge of the world, a set of motivations, and carries out certain plans).</p> <p>I recently re...
<p>If you want to approach this field from a computer science perspective then the standard reference I would recommend is:</p> <blockquote> <p>Yoav Shoham and Kevin Leyton-Brown [2009], &quot;Multiagent systems: algorithmic, game-theoretic, and logical foundations&quot;, Cambridge University press.</p> </blockquote> <...
444
language modeling
n-grams textbook question
https://cs.stackexchange.com/questions/125653/n-grams-textbook-question
<p>I have this question I found regarding n-gram modeling in the <em>Speech and Language Processing</em> textbook by Daniel Jurafsky:</p> <blockquote> <p>Suppose we didn’t use the end-symbol <code>&lt;/s&gt;</code>. Train an unsmoothed bigram grammar on the following training corpus without using the end-symbol <cod...
445
language modeling
Proving the probability of zero occurrences in training using Good-Turing maximum likelihood estimate
https://cs.stackexchange.com/questions/90000/proving-the-probability-of-zero-occurrences-in-training-using-good-turing-maximu
<p><strong>Background</strong></p> <p>Good-Turing (GT) smoothing is used in language models to estimate the counts of words in the test set that have not been seen in the training set. </p> <p>In GT smoothing, $N_c$ is the count of things observed $c$ times (so a count of a count). As an example, the sentence "Sam I ...
446
language modeling
Data Flow Analysis with exceptions
https://cs.stackexchange.com/questions/59832/data-flow-analysis-with-exceptions
<p>Data flow analysis work over a control flow graph. When a language under consideration supports exceptions, control flow graph can explode. </p> <p>What are the standard techniques for dealing with this blow-up? Can we soundly disregard edges induced by exception? Data flow analyses anyhow compute over-approximatio...
<p>Ignoring exceptions is unsound. Example:</p> <pre><code>let g = { raise E; } let f = { x := interesting_stuff(); g(); x := 0; } </code></pre> <p>When analyzing <code>f</code>, you need to take into account the fact that <code>g</code> raises an exception, otherwise you would incorrectly conclud...
447
language modeling
Is there a standard or model or taxonomy of programming languages different than machine-threshold-highlevel?
https://cs.stackexchange.com/questions/149309/is-there-a-standard-or-model-or-taxonomy-of-programming-languages-different-than
<p>I understand that there are three types of programming languages:</p> <ul> <li>Machine languages</li> <li>Assembly languages</li> <li>high-level languages</li> </ul> <p>And that:</p> <ul> <li>Machine languages have no abstraction</li> <li>Assembly language have little abstraction</li> <li>High-level languages have m...
<p>I've never heard of &quot;threshold languages&quot;. I don't think that is a &quot;thing&quot;, or at least not a terribly important thing.</p> <p>Don't worry too much about taxonomies. Taxonomies are mostly not very important. They have value only insomuch as they help you understand more deeply, but real life i...
448
language modeling
What is the activation function, label and loss function for Hierachical Softmax
https://cs.stackexchange.com/questions/43912/what-is-the-activation-function-label-and-loss-function-for-hierachical-softmax
<p>Several papers(<a href="http://www.iro.umontreal.ca/%7Elisa/pointeurs/hierarchical-nnlm-aistats05.pdf" rel="nofollow noreferrer">1</a> (originator), <a href="http://arxiv.org/pdf/1310.4546.pdf" rel="nofollow noreferrer">2</a>, <a href="http://dx.doi.org/10.1007/978-3-662-45924-9_16" rel="nofollow noreferrer">3</a>) ...
449
language modeling
RAM BSS model based (or its variant) computer recognizing Boolean languages
https://cs.stackexchange.com/questions/102832/ram-bss-model-based-or-its-variant-computer-recognizing-boolean-languages
<p>Can any RAM BSS model based machine, or machines which are variants, recognize boolean languages(languages such as P, NP, or the like)? If so which languages are recognizable by RAM/BSS nachines, or its variants?(A variant could be to allow comparison. Or a RAM/BSS with weaker assumptions). </p>
<p><a href="https://math-inf.uni-greifswald.de/en/department/about-us/employees/pd-dr-rer-nat-habil-christine-gassner/" rel="nofollow noreferrer">Christine Gaßsner</a> studied the question you are asking. These papers seem relevant, but you should have a look at her list of publications (<a href="https://dblp.uni-trier...
450
language modeling
Why the most dominant programming languages didn&#39;t follow CSP thread model?
https://cs.stackexchange.com/questions/119711/why-the-most-dominant-programming-languages-didnt-follow-csp-thread-model
<blockquote> <p>I was trying to ask this question in StackOverflow, but later realized that this question is more relevant to general computer science, not specific engineering problems. If you think it's not, please let me know.</p> </blockquote> <p>Recently I've found out what CSP(Communicating Sequential Processes) ...
<p>Practically speaking, the C++ threading (memory) model is directly inspired by the Java Memory Model, and C followed. <a href="https://hboehm.info/c++mm/" rel="nofollow noreferrer">Hans Böhm</a> was closely involved with the process and has a great resource list. (*)</p> <p>You'll quickly note that your dates are p...
451
language modeling
How to prove NP-hardness from scratch?
https://cs.stackexchange.com/questions/114952/how-to-prove-np-hardness-from-scratch
<p>I am working on a problem of whose complexity is unknown. By the nature of the problem, I cannot use long edges as I please, so 3SAT and variants are almost impossible to use.</p> <p>Finally, I have decided to go for the most primitive method -- Turing Machines.</p> <p>Oddly enough, I could not find any example of...
<p>The only two methods I've seen are (a) a reduction or (b) direct proof (as in the proof of the <a href="https://en.wikipedia.org/wiki/Cook%E2%80%93Levin_theorem" rel="nofollow noreferrer">Cook-Levin theorem</a>). It is almost universally the case that a reduction is easier than a direct proof. Therefore, I suggest...
452
language modeling
Is concurrent language CCS or CSP turing-equivalent in language power?
https://cs.stackexchange.com/questions/32743/is-concurrent-language-ccs-or-csp-turing-equivalent-in-language-power
<ol> <li><p>Does the concurrent language CSP (or CCS, $pi$-calculus) model interacting machines?</p></li> <li><p>Is CSP (or CCS, $pi$-calculus) Turing-equivalent to other programming languages like C? </p></li> </ol>
<p>The answer to your (1) depends on what exactly you mean by "model" and by "interacting machines". The $\pi$-calculus in particular is usually deemed to be a good simplification of the core aspects of message passing concurrency.</p> <p>Regarding (2), you can simulate Turing machines in CSP, CCS, the $\pi$-calculus...
453
language modeling
Defining an HTML Template as an Algebraic Type
https://cs.stackexchange.com/questions/94026/defining-an-html-template-as-an-algebraic-type
<p>Wondering if/how you could define a highly nested structure as a <a href="https://en.wikipedia.org/wiki/Dependent_type" rel="nofollow noreferrer">Dependent Type</a> (or an Algebraic or Parameterized type). Specifically, an HTML template. Not that they work like this (HTML <a href="https://www.html5rocks.com/en/tutor...
<p>You might be looking for <a href="http://www.cduce.org" rel="nofollow noreferrer">CDuce</a> programming language.</p>
454
language modeling
Term for language that abstracts program location?
https://cs.stackexchange.com/questions/125606/term-for-language-that-abstracts-program-location
<p>What is the technical term that describes a programming language that abstracts (or at least largely abstracts) the machine location of programs? I’m thinking here specifically of the evolution of handheld calculator programming languages, from early (and some late) models where each instruction exists in a single l...
455
language modeling
Language Classification + AWS ML: what am I doing wrong?
https://cs.stackexchange.com/questions/66475/language-classification-aws-ml-what-am-i-doing-wrong
<p>I'm evaluating Amazon's machine learning platform, and thought that I would give it a "simple" classification problem first. As a disclaimer, I am quite new to machine learning (hence my interest in an ML platform).</p> <p>The classification problem is language detection. Given a list of 20k words, and their lang...
<p>There are probably multiple things wrong here.</p> <h2>Features</h2> <p>First, you don't tell us what features you have provided. If the only input you have provided is the word itself (e.g., the string <code>craindre</code>), then most likely the machine learning algorithm has no idea how to use that information...
456
language modeling
Does there exist standardized language-agnostic data structure notation?
https://cs.stackexchange.com/questions/129904/does-there-exist-standardized-language-agnostic-data-structure-notation
<p>I wonder if there exists language-agnostic data structure notation. Preferably a standard, allowing to describe data structures and basic data types. e.g. something like a subset of <code>WebIDL</code>.</p> <p>A motivation is to describe data structures (a model) in a way that is standardized and language-agnostic. ...
<p>In terms of notation:</p> <ul> <li>Isn't <a href="https://en.wikipedia.org/wiki/XML_Schema_(W3C)" rel="nofollow noreferrer">XSD</a> exactly what you are looking for? (barring all the &quot;<a href="https://en.wikipedia.org/wiki/XML_Schema_(W3C)#Criticism" rel="nofollow noreferrer">severe criticism</a>&quot; ...). Al...
457
language modeling
Programming language semantics prototyping tool
https://cs.stackexchange.com/questions/65383/programming-language-semantics-prototyping-tool
<p>Is there any tool for prototyping a programming language semantics and type system and that also allows for some sort of <em>model checking</em> of standard properties, like type soundness? </p> <p>I'm asking this, because I'm reading a book on <a href="http://alloy.mit.edu/alloy/">Alloy</a> and it provides the exa...
<p>Although there are frameworks created specifically for the purpose of prototyping programming languages (including their semantics, type systems, evaluation, as well as checking properties about them), the best choice depends on your particular case and specific needs.</p> <p>Having that said, there are multiple (p...
458
language modeling
Is my formal definition of programming language correct?
https://cs.stackexchange.com/questions/116507/is-my-formal-definition-of-programming-language-correct
<p>I found this formal definition of a programming language in the 1973 paper <a href="https://dl.acm.org/citation.cfm?doid=986953.986988" rel="nofollow noreferrer">Formal definition of programming languages</a> by Terrence Pratt.</p> <blockquote> <p>PL is a formal language endowed with two structures: a translator ...
<p>It is certainly not a full definition; one might reasonably expect a "real" programming language to have not merely an abstract mathematical model defining the language's semantics, but also a concrete implementation of a compiler or an interpreter which runs on an actual computer. Then again, one might reasonably n...
459
language modeling
Does a regular expression model the empty language if it contains symbols not in the alphabet?
https://cs.stackexchange.com/questions/64990/does-a-regular-expression-model-the-empty-language-if-it-contains-symbols-not-in
<p>Suppose $\Sigma = \{ a,b \}$ and the regular expression $(a^*b+dc)^*(b^*d + ad)^*$. Is it equal to $\varnothing$?</p> <p>So I have a regular expression like this: $(a^*b+dc)^*$. As only $(a,b) \in \Sigma$, I see that:</p> <ul> <li>$dc=\varnothing$</li> </ul> <p>So $(a^*b+dc)^*=(a^*b)^*$.</p> <p>Then:</p> <ul> <...
<p>Regular expressions only use characters from the alphabet so, if you've fixed your alphabet to be $\{a,b\}$, then $(a^∗b+dc)^∗(b^∗d+ad)^∗$ isn't a regular expression. It doesn't describe any language, in just the same way that "seventy red" doesn't describe any number. In particular, it doesn't describe the empty la...
460
language modeling
Does the first incompleteness theorem imply that any Turing complete programming language must have undefined behavior?
https://cs.stackexchange.com/questions/161643/does-the-first-incompleteness-theorem-imply-that-any-turing-complete-programming
<p>If I understand correctly, the first incompleteness theorem says that any &quot;effectively axiomatized&quot; formal system which is consistent must contain theorems which are <em>independent</em> of the axioms. In other words, there are models of the system where the theorem is provably true and others where it's ...
<p>No, it doesn't require that. These are two orthogonal issues. You can easily define a new programming language where you provide fully defined semantics for all operations; yet it can be Turing complete. For a concrete example, consider <a href="https://esolangs.org/wiki/Bitwise_Cyclic_Tag" rel="noreferrer">Bitwi...
461
language modeling
Showing that a language is NP Complete (advice)
https://cs.stackexchange.com/questions/110715/showing-that-a-language-is-np-complete-advice
<p>I am currently getting ready for my final exam in computational models. I know that there aren't any rules or rule of thumb to show that a language is NP-complete and each problem has its own tricks, but I am really struggling with questions where they give me a language and showing that the language is NP-complete ...
<p>Typically, yes, it's a matter of finding a known <strong>NP</strong>-complete problem that's somehow similar to the one you're trying to work with. So if you're dealing with a problem about formulas, you probably want to reduce some version of SAT or 3SAT to it.</p> <p>For graph problems, you probably want to reduc...
462
language modeling
Clustering changes in a directed acyclic graph
https://cs.stackexchange.com/questions/170968/clustering-changes-in-a-directed-acyclic-graph
<p>A have a following toy data modeling java-like language:</p> <ul> <li>all class fields are <code>protected</code></li> <li>multiple inheritance is allowed</li> <li>if a class sees several definitions of a field in its superclasses and all these defitions are the same (verbatim), then we do not reject such hierarchy....
<p>These changes can be expressed as</p> <ul> <li>delete <code>Cap extends Undecided, WithString</code></li> <li>the <code>field</code> in the class <code>Undecided</code> changed type</li> <li>add <code>Cap extends Undecided, WithInt</code></li> </ul> <p>How do you define changes?</p>
463
language modeling
Examples for CFG that cannot be expressed by regular language
https://cs.stackexchange.com/questions/75916/examples-for-cfg-that-cannot-be-expressed-by-regular-language
<p>There are nice examples for context free grammars which cannot be expressed with <a href="https://www.wikiwand.com/en/Regular_language" rel="nofollow noreferrer">regular language</a>, for example the palindrome and a similar contrived example <a href="https://cs.stackexchange.com/questions/57117/how-can-i-show-conte...
<p>Theoretically, you can nest sentences arbitrarily depth, by using subclauses and this excluded any finite state mechanism. The inventor of the phrase structure grammars himself looked at finite state languages, and compared them with the model of phrase structure grammars. The abstract of his paper <em>Finite State ...
464
language modeling
Good language for introduction to self-modifying algorithms?
https://cs.stackexchange.com/questions/55948/good-language-for-introduction-to-self-modifying-algorithms
<p>So I am trying to find a language with which i can write code to build/search through deductive reasoning 'nets', as well as self-modify it's search algorithms based on information learned from these nets. I also want a language that i can use to write scripts for a 2d game engine, as i would like to build visual mo...
465
language modeling
What are different ways to provide a semantics to a language?
https://cs.stackexchange.com/questions/103333/what-are-different-ways-to-provide-a-semantics-to-a-language
<p>Suppose you have 1. a grammar for terms of a language; 2. type-assignment rules, 3. a set of reduction rules. You want to prove that your language is adequate for mathematical reasoning. If I understand correctly, the right way to do it is to develop a semantics for it, and then prove certain desirable properties su...
<p>There are many possible approaches. Here's a few "classic" styles.</p> <ul> <li>Operational semantics (e.g. small step / reduction, or big step)</li> <li>Denotational semantics (e.g. domain-theoretic, or category-theoretic)</li> <li>Axiomatic semantics (e.g. hoare logic)</li> </ul> <p>You can also define the seman...
466
language modeling
Rules language / DSL expressivity measure
https://cs.stackexchange.com/questions/44395/rules-language-dsl-expressivity-measure
<p>Languages to express domain rules are quite diverse from very simple and inexpressive to Turing-complete programming languages. If we consider developing some DSL (domain-specific language), is there any generally useful scale (Chomsky hierarchy comes to mind as an analogy, as well as Description Logic "letters", li...
467
language modeling
What are constraints on some new logic programming language and system?
https://cs.stackexchange.com/questions/96058/what-are-constraints-on-some-new-logic-programming-language-and-system
<p>As I understand, everyone can create logic programming language and system by declaring that the valid program of some logic programming language is the set of statements in the form: <code>body-&gt;head</code>, where <code>body</code> is arbitrary expression of boolean type and the <code>head</code> is set of expre...
<p>It sounds like you have the impression that there are some rules on what languages you are allowed to define. There are no such rules. You can define whatever language you want. You can do whatever what you want -- you're not required to do anything (there are no language police who will come arrest you for faili...
468
language modeling
What is the single type in a dynamic typing language?
https://cs.stackexchange.com/questions/125245/what-is-the-single-type-in-a-dynamic-typing-language
<p>Regarding static typing and dynamic typing, <a href="https://www.cs.cmu.edu/~rwh/pfpl/2nded.pdf" rel="nofollow noreferrer">Practical Foundation of Programming Languages by Harper</a> says:</p> <blockquote> <p>There have been many attempts by advocates of dynamic typing to distinguish dynamic from static languag...
<p>The &quot;single type&quot; for Python is called &quot;object&quot; and described in <a href="https://docs.python.org/3/reference/datamodel.html" rel="nofollow noreferrer">https://docs.python.org/3/reference/datamodel.html</a>:</p> <blockquote> <p>Objects are Python’s abstraction for data. All data in a Python progr...
469
language modeling
What kind of language uses an infinite alphabet?
https://cs.stackexchange.com/questions/67223/what-kind-of-language-uses-an-infinite-alphabet
<p>Kind of what it says on the tin. Let's say I have a countably infinite alphabet $A$ and a "language" $L = \{s_1s_2 | s_1,s_2 \in A\}$ (i.e. all possible strings of length 2). Now, my question is this: does it even make sense to think of this in terms of formal languages? Is there some construct akin to a state machi...
<p>The definition of formal language doesn't depend on the alphabet - it remains exactly the same. Things start getting a bit more complicated when you are interested in certain <em>classes</em> of languages. For example, let us consider regular languages. If your alphabet is infinite, the restriction of having only fi...
470
language modeling
How to compare the efficiency of two encoding schemes or hypothesis languages?
https://cs.stackexchange.com/questions/82080/how-to-compare-the-efficiency-of-two-encoding-schemes-or-hypothesis-languages
<p>My question is pretty basic, I'm looking for a named method if you know one, but also proper terminology, further reading, and anything this reminds you of if you don't. (I'm new to this, don't have the right terminology and just need a starting point so I can help myself.)</p> <p>I'm trying to interpret the vector...
<p>The answer was just tree depth. What I needed to do was learn about evaluating the complexity of finite automata and how we can use a decision-tree model (<a href="https://en.wikipedia.org/wiki/Decision_tree_model" rel="nofollow noreferrer">decision-tree complexity</a>) to put bounds on the complexity of an automata...
471
language modeling
Classes of language with at least $n$ pump-able substrings
https://cs.stackexchange.com/questions/170176/classes-of-language-with-at-least-n-pump-able-substrings
<p>Regular languages (RLs) have a necessary condition (from the pumping lemma) that, for some <span class="math-container">$k$</span>, if the string <span class="math-container">$|s| \geq k$</span> is in the language there is some splitting of <span class="math-container">$s$</span> into <span class="math-container">$x...
472
language modeling
What is the language feature which allows a variable to be associated with values of different types?
https://cs.stackexchange.com/questions/116504/what-is-the-language-feature-which-allows-a-variable-to-be-associated-with-value
<p>In Python, I can change the types of values associated with a variable:</p> <pre><code>&gt;&gt;&gt; x=1 &gt;&gt;&gt; x="abc" </code></pre> <p>In C, I can't do the same.</p> <p>What is the name of the feature that allows Python to behave so, while not C?</p> <p>I was wondering if the following language features ...
<p>Allow me to address the misconceptions in your question one by one.</p> <blockquote> <p>In Python, I can change the types of values associated with a variable:</p> <pre><code>&gt;&gt;&gt; x=1 &gt;&gt;&gt; x=&quot;abc&quot; </code></pre> </blockquote> <p>In type theory, types classify <em>expressions</em>, i.e., <em>...
473
language modeling
Why is the Turing Machine a popular model of computation?
https://cs.stackexchange.com/questions/91773/why-is-the-turing-machine-a-popular-model-of-computation
<p>I am a CS undergraduate. I understand how Turing came up with his abstract machine (modeling a person doing a computation), but it seems to me to be an awkward, inelegant abstraction. Why do we consider a "tape", and a machine head writing symbols, changing state, shifting the tape back and forth? </p> <p>What is t...
<p>Well, a DFA is just a Turing machine that's only allowed to move to the right and that must accept or reject as soon as it runs out of input characters. So I'm not sure one can really say that a DFA is natural but a Turing machine isn't.</p> <p>Critique of the question aside, remember that Turing was working <em>be...
474
language modeling
Are syntax and semantic just 2 structures such that one is a model of the other?
https://cs.stackexchange.com/questions/45291/are-syntax-and-semantic-just-2-structures-such-that-one-is-a-model-of-the-other
<ul> <li>The syntax of a language is a structure. </li> <li>The semantic of a language is a structure.</li> <li>The semantic of a language is a model of its syntax.</li> </ul> <p>And that's all ? The duality syntax/semantic is just model theory applied to languages ?</p> <p>(A short answer could be ok; I have already...
<p>I am afraid the phrasing of the question misled me (though I did know better) in first seeing model theory as applying to any two arbitrary mathematical structures, and being the study of homomorphisms of mathematical structures.</p> <p>Actually this is wrong. <a href="https://en.wikipedia.org/wiki/Model_theory" re...
475
language modeling
Design a grammar for this context-free language
https://cs.stackexchange.com/questions/54759/design-a-grammar-for-this-context-free-language
<p>I am doing an exercise from <a href="http://web.engr.illinois.edu/~jeffe/teaching/algorithms/all-models.pdf" rel="nofollow">Models Of Computation - Ch - 5, Q-1(r)</a>.</p> <p>Design a grammar that generates this context-free language</p> <p>$\{ x\space\$\space y^R \,|\, x, y \in\{0, 1\}^* \text{ and } x \ne y\}$<...
<p>Hint: Break this into four different cases:</p> <ol> <li>Words of the form $x\$y$ where $|x|&gt;|y|$.</li> <li>Words of the form $x\$y$ where $|x|&lt;|y|$.</li> <li>Words of the form $\Sigma^* 0 \Sigma^n \$ \Sigma^n 1 \Sigma^*$.</li> <li>Words of the form $\Sigma^* 1 \Sigma^n \$ \Sigma^n 0 \Sigma^*$.</li> </ol>
476
language modeling
What programming language should I use to run physics simulations of CO2 being absorbed by different materials?
https://cs.stackexchange.com/questions/128448/what-programming-language-should-i-use-to-run-physics-simulations-of-co2-being-a
<p>I want to model the absorption of CO2 with multiple different materials such as cement, limestone, wood, etc? I know Matlab is capable of these types of physics simulation according to this research paper: <a href="https://www.sciencedirect.com/science/article/abs/pii/S025527011630006X" rel="nofollow noreferrer">Res...
<p>That depends on a lot of factors, mostly on available software for the task (you <em>don't</em> want to do the whole job yourself, if it is already done, or there are pieces you can combine with little effort, use that), in second line on how detailed your model (and it's computing requirements) is might force the u...
477
language modeling
What is the computation model of Prolog?
https://cs.stackexchange.com/questions/90400/what-is-the-computation-model-of-prolog
<p>Several computation models have representative programming language counterparts, as, according to <a href="https://cs.stackexchange.com/a/44310/86914">this answer</a>, Snobol for rewriting systems, APL for combinators, Lisp/Scheme for lambda calculus, and off course the family of imperative languages for TMs (or mo...
<p>I think the computation model of Prolog is the SLDNF resolution of Horn clauses.</p> <p>Prolog is actually very procedural. Kowalski 1974: "The interpretation of predicate logic as a programming language is based upon the interpretation of <em>implications</em> [...] as <em>procedure declarations</em> [...]" (empha...
478
language modeling
Term for the use of the same programming language in every tier?
https://cs.stackexchange.com/questions/106093/term-for-the-use-of-the-same-programming-language-in-every-tier
<p>What is the technical term that describes the use of the same programming language in every tier in the architecture of a system? For example, having JavaScript in model, view and controller.</p> <p>edit #1: MVC was mentioned just to give an example. I read the concept in a book once when I was at the university bu...
<p>I it is not widely used terminology, if you use MVC it makes little sense to deploy different languages, because some glue is needed to maintain it (say data sharing between different languages).</p> <p>The term is monolanguage (monolingual programming) or homogeneous language programming. Similar terms like homoge...
479
language modeling
Differences between programming model and programming paradigm?
https://cs.stackexchange.com/questions/49421/differences-between-programming-model-and-programming-paradigm
<ol> <li><p>What is the relation and difference between a programming model and a programming paradigm? (especially when talking about the programming model and the programming paradigm for a programming language.)</p></li> <li><p><a href="https://en.wikipedia.org/wiki/Programming_paradigm" rel="noreferrer">Wikipedia</...
<p>A programming model is implied by the system architecture. If your system architecture is a register machine, your programming model will consist of machine code operations on registers. If your architecture is a stack machine, your programming model will consist of stack operations. A Von Neumann architecture and a...
480
language modeling
What does it mean to say that a language is &quot;effectively closed&quot; under an operation?
https://cs.stackexchange.com/questions/11920/what-does-it-mean-to-say-that-a-language-is-effectively-closed-under-an-operat
<p>I've been reading some formal language theory papers, and I've come across a term that I don't understand.</p> <p>The paper will often refer to a set being "effectively closed under intersection" or other operations. What does "effectively" mean here? How does this differ from normal closure?</p> <p>For reference,...
<p>"Effectively closed" means that the family is closed under the operation, and that the closure can be computed by giving an automaton/grammar for it (if the original languages are also given in such an effective representation). E.g., given a finite state automaton, we can actually find an automaton for the compleme...
481
language modeling
Theoretical justification of &quot;halting problem avoidance&quot;
https://cs.stackexchange.com/questions/57739/theoretical-justification-of-halting-problem-avoidance
<p>The wikipedia page for the <a href="https://en.wikipedia.org/wiki/Halting_problem" rel="nofollow noreferrer">Halting problem</a> mentioned <em>practical solutions</em> to avoiding the halting problem such as avoiding infinite loops. And there is a mention that "by restricting the capabilities of general-purpose (Tur...
<p>It is absolutely theoretically justified. </p> <p>First realize that a loop is just a form of recursion: do the loop body, then either stop or do the loop body again with different variable values. </p> <p><a href="https://en.m.wikipedia.org/wiki/System_F" rel="nofollow">System F</a> is a lambda calculus (programm...
482
language modeling
What algorithm can be used to implement code folding for the C programming language?
https://cs.stackexchange.com/questions/171868/what-algorithm-can-be-used-to-implement-code-folding-for-the-c-programming-langu
<p>I'm working on a simple editor for the C programming language (without using an AST), and I need to implement a code folding feature.</p> <p>When the user opens a file, an initial parse is performed, and all {} code blocks are easily detected. I store these blocks in a tree structure, where nested blocks are childre...
483
language modeling
An alternative to the object paradigm
https://cs.stackexchange.com/questions/63332/an-alternative-to-the-object-paradigm
<p>I've been playing around with an alternative to the standard object-oriented paradigm for modeling data, and I would like to know if there is any research or already existing systems along the same lines. Let me briefly explain my ideas.</p> <p>What I call the object-oriented paradigm goes something like this. Obje...
484
language modeling
Computational complexity vs. Chomsky hierarchy
https://cs.stackexchange.com/questions/25940/computational-complexity-vs-chomsky-hierarchy
<p>I'm wondering about the relationship between computational complexity and the Chomsky hierarchy, in general.</p> <p>In particular, if I know that some problem is NP-complete, does it follow that the <em>language</em> of that problem is not context-free?</p> <p>For example, the clique problem is NP-complete. Does i...
<p>There are four classes of language in the Chomsky hierarchy:</p> <ol> <li><p>Regular languages &mdash; this class is the same as $\mathrm{TIME}(n)$ or $\mathrm{TIME}(o(n\log n))$ (defined using single-tape machines, see Emil's comment), or $\mathrm{SPACE}(0)$ or $\mathrm{SPACE}(o(\log\log n))$ (per Emil's comment)....
485
language modeling
Proving a certain language is regular by constructing a DFA
https://cs.stackexchange.com/questions/159660/proving-a-certain-language-is-regular-by-constructing-a-dfa
<p>Let <span class="math-container">$L$</span> be a regular language over the alphabet <span class="math-container">$\sum$</span>, prove that the language defined by <span class="math-container">$\hat{L} = \{uv \in \sum^* | u^Rv \in L \}$</span> is regular.</p> <p>There is guidance in the exercise that instructs us to ...
486
language modeling
Why is Dyck-2 so important for the Chomsky-Sch&#252;tzenberger theorem?
https://cs.stackexchange.com/questions/162654/why-is-dyck-2-so-important-for-the-chomsky-sch%c3%bctzenberger-theorem
<p>I have read a lot of times, that models that can parse Dyck-2 are of great importance. It appears that Dyck-2 is interchangeably used like Dyck-N.</p> <p>Afaik the Chomsky-Schützenberger representation theorem states that you can convert and context-free language into a Dyck-N language, using a homomorphism and a in...
<p>Whether 2-bracket Dyck is equivalent to <span class="math-container">$n$</span>-bracket Dyck (<span class="math-container">$n\ge2$</span>)? Short answer: that depends which operations one allows.</p> <p>The <a href="https://en.wikipedia.org/wiki/Chomsky%E2%80%93Sch%C3%BCtzenberger_representation_theorem" rel="nofoll...
487
language modeling
Measuring logicality of programming languages?
https://cs.stackexchange.com/questions/170042/measuring-logicality-of-programming-languages
<p>I have a simple question of how would you measure the logicality of a programming language?</p> <p>EDIT: I was asked to specify the term &quot;logicality&quot;. Hence I will try and provide a stipulation. By &quot;logicality&quot; I mean that the programming language is in correspondence with the least amount of ste...
488
language modeling
Difference between a model of computation and semantics
https://cs.stackexchange.com/questions/170997/difference-between-a-model-of-computation-and-semantics
<p>I understand if this question sounds non-sense, but in my understanding the concept of semantics applies to programing languages. And a model of computation is ( generally speaking ) a formal system, a mathematical object which describes exactly how to use, and what to expect while using it, thus having inherent <em...
<p>I am not sure I understand your question, yet I will give an answer to how the term “semantics” is used in the context of computational models. Let’s look at one of the fundamental computational models in computer science, which is a non-deterministic finite automaton (NFA, for short):</p> <p>An NFA <span class="mat...
489
language modeling
Contracts for Java Bytecode
https://cs.stackexchange.com/questions/13121/contracts-for-java-bytecode
<p><strong>Introduction</strong><br> For a paper I need contracts, which are also referred to as Design by Contract (DbC)<a href="http://www.eclipse.org/forums/index.php?t=thread&amp;frm_id=157" rel="nofollow">1</a>, and conceptually go back to Hoare[2]. For my work I need to apply contracts to Java bytecode. The quest...
<p>I recommend you look at <a href="http://bml.mimuw.edu.pl/" rel="nofollow">BML</a>. It is like JML, but for Java bytecode. It allows you to specify contracts (preconditions, postconditions, data structure invariants) at the bytecode level. I think the tools <a href="http://zls.mimuw.edu.pl/~alx/umbra/" rel="nofoll...
490
language modeling
Mathematical model for a webpage layout?
https://cs.stackexchange.com/questions/35490/mathematical-model-for-a-webpage-layout
<p>Getting layout right (even if only a structure is considered) with HTML5/CSS3 is still more like an art or black magic.</p> <p>On the other hand, there are other GUI systems (like wxWindows and Tcl/Tk) and some GUI research (like The Auckland Layout Model, ALM, and <a href="https://hal.inria.fr/hal-00953333/PDF/int...
<p>At the time of writing, I am not aware of any formal (or at least formalized enough) models for layouts in HTML. All the examples (ALM, etc) indicate, that usually the model is created to guide layout manager's creation. In the case of HTML and web-browsers the development is evolutional and while each web engine co...
491
language modeling
Detecting palindromes in binary numbers using a finite state machine
https://cs.stackexchange.com/questions/32081/detecting-palindromes-in-binary-numbers-using-a-finite-state-machine
<p>In my first algorithms class we're creating these patterns that are supposed to model a finite state machine. We were given a task to think if we can figure out a way to detect palindromes in binary sequences (no points if we do, it's just a food for thought).</p> <p>I specifically asked the professor, knowing a li...
<p><strong>In a nutshell</strong>: <em>As presented, with a single row of tiles, the tiling system is equivalent to a finite state automaton. It cannot recognize the set of palindromes which is context-free, but not regular. However, if the tiling system is extended, allowing as many rows as needed (possibly with the a...
492
language modeling
How do you represent LISP as mathematical / logical model?
https://cs.stackexchange.com/questions/79642/how-do-you-represent-lisp-as-mathematical-logical-model
<p>I asked this in stackoverflow, but the question probably fits here better.</p> <p>This question arose from the objection that LISP is regarded as a functional language with some simple principles, namely functions, variables, and operators that roughly correspond to predicates, propositional variables, and connecti...
<p>"Old" programming languages like Fortran, Cobol and LISP arose <em>before</em> serious mathematical theory of programming languages was developed. They <em>inspired</em> the development of such theory, but are full of idiosyncracies and features which from a mathematical point of view can best be described as "warts...
493
language modeling
procedures and immutable data to simulate return values
https://cs.stackexchange.com/questions/44412/procedures-and-immutable-data-to-simulate-return-values
<p>Let's say I have a programming language that allows procedures, i.e., methods without return values, and immutable data-structures, so no sideeffecting inside a procedure. Is it possible to simulate a program written in a language with return values in our language?</p> <p>In other words, do return values allow for...
494
language modeling
Characterising $(aa)^*$ in first order logic
https://cs.stackexchange.com/questions/14545/characterising-aa-in-first-order-logic
<p>In my descriptive complexity class, we've been asked to find a formula that characterises the language $(aa)^*$ (over the alphabet $\{a\}$) with a first order formula over the language $\{&lt;, P_a\}$.</p> <p>This was the first class, so I will recall what we've learned to be sure that I understood. To a $L$-formul...
<p><strong>Short answer</strong>. There is no such first-order formula, you need a monadic second order formula.</p> <p><strong>Details</strong>. This can be proved directly using an Ehrenfeucht-FraÏssé games argument if you want to stay inside logic, but the real answer to your question is the conjunction of three re...
495
language modeling
Is there an always-halting, limited model of computation accepting $R$ but not $RE$?
https://cs.stackexchange.com/questions/11936/is-there-an-always-halting-limited-model-of-computation-accepting-r-but-not
<p>So, I know that the halting problem is undecidable for Turing machines. The trick is that TMs can decide recursive languages, and can accept Recursively Enumerable (RE) languages.</p> <p>I'm wondering, is there a more limited model of computation which accepts only recursive languages, and not RE? And if so, is the...
<p>Yes, there are as many models of R as there are of RE! Take a model of RE, and restrict it to the total elements of the model. For example, take Turing machines that halt. Or take total recursive functions. Or take your favorite programming language (idealized to remove memory limitations) but in addition to requiri...
496
language modeling
Prove that a model of infinite tapes is stronger then turing machine model
https://cs.stackexchange.com/questions/75014/prove-that-a-model-of-infinite-tapes-is-stronger-then-turing-machine-model
<p>I want to prove that if we have a model, $A$, with unbound number of tapes, then $A$ is stronger then Turing Machine model. Can you help me with example of such a language that $M$ will fail but $A$ will give an output? thanks.</p>
<p>It is a standard proof that Turing machines with any finite number of tapes are equivalent to single-tape Turing machines, since you can code any fixed number of tapes on a single tape.</p> <p>If you allow a Turing machine to have an infinite number of tapes, then you can decide any language&nbsp;$L$. To do this, f...
497
language modeling
Why full Chomsky hierarchy is so detailed, if there are decidable recursive languages?
https://cs.stackexchange.com/questions/102305/why-full-chomsky-hierarchy-is-so-detailed-if-there-are-decidable-recursive-lang
<p>One can have a look on the Chomsky hierarchy <a href="https://en.wikipedia.org/wiki/Chomsky_hierarchy" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Chomsky_hierarchy</a> , especially the inset named "Automata theory: formal languages and formal grammars" at the bottom of the page. When one tries to model ...
498
language modeling
Why &quot;Choice Points&quot; introduce non-determinism in a program?
https://cs.stackexchange.com/questions/108817/why-choice-points-introduce-non-determinism-in-a-program
<p>I'm studying the didactic programming language <strong>Oz</strong>, following the book "Concepts, Techniques, and Models of Computer Programming".</p> <p>In the book, the nondeterminism is introduced through the concept of <strong>choice</strong>, as it's explained <a href="https://en.wikipedia.org/wiki/Nondetermin...
<p>Nondeterminism is an inherently unphysical concept. If you think about the various definitions of nondeterministic computation, they always say something like one of the following:</p> <ul> <li><p>the computation is structured as a tree and, if any of the paths through the tree succeeds, the computation succeeds, r...
499