So we do import stuff from Mathematics alot.
I think we need better tutorials. It is a hard problem. How to teach something, who is your audience. For an AI tutorial, do I need to explain what inference is? Maybe. If I don't and they don't know it is another weird word.
In terms of brain problem - I have the same thing. It is worse inside the corporate barrier as there is no internet documentation on what the terms mean. I think all we can do is slow down and write cheat sheets until we remember.
https://philosophy.stackexchange.com/questions/85809/feynman...
The Property type is a datatype for which the definition is private. So we look at functions that creates Property objects. We find
class Testable prop where
property :: prop -> Property
This means anything of the class Testable can be turned into a Property. So let's look at what are the instances of this class. We immediately find instance Testable Bool
This means any boolean can be turned into a Property. But more interestingly we find instance (Arbitrary a, Show a, Testable prop) => Testable (a -> prop)
This means any function where the argument has a generator and the result can be turned into a Property can itself be turned into a Property. This implies that for example a function of `Int -> Bool` can be turned into a property. And due to currying, `Int -> Int -> Bool` can also be turned into a property.This basically covers the first half of the article.
We continue to find other functions that returns Property objects. We find
forAll :: (Show a, Testable prop) => Gen a -> (a -> prop) -> Property
This states that if we have a function where we explicitly provide a generator and it returns anything that can be turned into a Property, it can also be turned into a Property. This is different from the instance above only by providing an explicit generator.We also find the implication operator:
(==>) :: Testable prop => Bool -> prop -> Property
This states that if we have a Bool, and anything that can be turned into a property, we also have a property.You see, the beauty of Haskell and similar languages is that you don't need to first gain an intuitive understanding of those vocabularies of a library. The library designer has built up an abstraction of those vocabularies and Nouns and the compiler is tasked to enforce it. You can get things wrong, and the compiler just yells at you. Or you can just mechanically find things to fill in the blanks ("hole-driven development") without understanding the vocabularies. It's your choice.
Unfortunately, very few texts and tutorials on property-based testing actually tell you how to see what properties are. I have it on paper somewhere in some workshop materials. But online I think this is one of the very few that describe what they are: https://fsharpforfunandprofit.com/posts/property-based-testi...
Domain Modeling Made Functional - Scott Wlaschin
In the link above he's described 7 very practical ways to use it. No functional jargon, no mathematical jargon. Just practical useful ideas. And the language choice in the book is irrelevant - the concepts translate well.
There is an alternate universe where he would be well known as the top author on software engineering. His website is great as well.
That said, if you do know a bit of the math his example introduced commutative, invertible, invariance, idempotency, structural recursion & isomorphism - but anyone reading it would never really know and would never need to know. It's just framed as useful applications of tests.
Sometimes I see people saying "in LANG, obj.foo is just 'syntax sugar' for foo(obj)" and I think that technically it has always been "syntax sugar" and there have always been ways to call any "method" with any "object" of any "type."
Sometime along the way we decided that "syntax sugar" means "it means the same thing as" but except for (<cast OtherType>obj).foo(), which means that the semantics of "syntax sugar" don't mean it's simpler than the phrase it was supposed to replace.
For what it's worth, to a researcher in the field of programming languages (like the author of the post), these all have distinct unambiguous meanings. At least as far as PL goes, almost every term has a well-defined meaning, but as those terms were adopted into less-than-academic contexts, the meanings have diluted.
"Property" is such a term in the context of programming languages research, and, in particular, it is a very specifically defined term in the realm of property-based testing (no surprise).
> Even the constants are variables from the viewpoint of the CPU that has to load it in its registers.
No; this is not what "variable" means. Registers are properties of the processor, i.e., they are implementation details; variables are an abstract concept from the domain of the formal language specification.
> Sometime along the way we decided that "syntax sugar" means "it means the same thing as" but except for (<cast OtherType>obj).foo(), which means that the semantics of "syntax sugar" don't mean it's simpler than the phrase it was supposed to replace.
No; this is not what "syntax sugar" means. If a language defines some syntax f and it "expands to" some other syntax g, then f is syntax sugar for g. This is well defined in Felleisen's "On the Expressive Power of Programming Languages" [0]. For example, Python's addition operator `+` is implemented in terms of a method `__add__`; therefore, `a + b` is syntax sugar for `a.__add__(b)`, because the former syntax is built on top of the latter.
Notably, syntax sugar has nothing to do with casts; casts are semantic, not syntactic. There are also no promises about whether syntax sugar makes something "easier"; it's simply the ability to syntactically express something in multiple ways.
[0] direct PDF: https://www2.ccs.neu.edu/racket/pubs/scp91-felleisen.pdf
Also, in Harvard-architecture systems, the constants, being part of the instruction itself, might not even be in the same memory or even address space as variables ([EEP]ROM/Flash vs RAM).
The comment you are responding to was correct in what "property" means in some settings.
The article itself says:
> A property is a universally quantified computation that must hold for all possible inputs.
But, as you say,
> but as those terms were adopted into less-than-academic contexts, the meanings have diluted.
And, in fact, this meaning has been diluted. And is simply wrong from the perspective of what it originally meant in math.
You are right that a CPU register is a property of the CPU. But the mathematical term for what the article is discussing is invariant, not property.
Feel free to call invariants properties; idgaf. But don't shit all over somebody by claiming to have the intellectual high ground, because there's always a higher ground. And... you're not standing on it.
English (int al) distinguishes "proper" nouns as a subset of nouns. A proper noun is a name and is capitalized. Hence you might write: King Charles is a king. Now, you also capitalize the first word of a sentence but here King is not the first word of a sentence - King Charles is a name. If you make a small change (indefinite to definite article), you get: King Charles is the King. The second king becomes a moniker and no longer just a description.
English also tends to get capitalization-loopy as soon as religion rocks up (any religion).
You can obviously ignore all that bollocks and write whatever you like, mostly without blushing!
Some other related languages eg German, capitalize all nouns.
The insert statement isn’t independent of the database because the table needs to exist and its schema has to allow the inserted values. If the database is generated randomly, you need access to it to generate an insert statement that will work.
This is straightforward to do if the library is designed for it. Using my own TypeScript library [1]:
const insertCaseArb: Arbitrary<InsertCase> = arb.from((pick) => {
const db = pick(dbArb);
const table = pick(arb.of(...db.tables));
const values = pick(rowArbForTable(table));
return {
db,
tableName: table.name,
insert: {
kind: "insert",
table: table.name,
values,
},
};
});
Why might that be difficult? Some property testing libraries don’t let you call a pick function directly.