[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7ASDNX8YYVM065MQ871MMW0":3,"skill-same:01M7ASDNX8YYVM065MQ871MMW0":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M7ASDNX8YYVM065MQ871MMW0","toc-type-systems-and-randomization",null,"Use when reasoning about type systems, verification, or randomized algorithms: types as logic and the Curry–Howard correspondence, decidability of type checking and inference, what formal methods actually buy and where lightweight methods win, and randomness and approximation — BPP, Monte Carlo versus Las Vegas, the PCP theorem and hardness of approximation, heuristics and No Free Lunch.","the-vibey-project\u002Fvibey","the-vibey-project","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F329298758?v=4","01M7AJHGZ9722CTJ4JNQZVRH0Q","the vibey project","01M7AJHGZVMG2K7TGXQ6XFHVG3",5,"MIT","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Ftheory-of-computation\u002Fskills\u002Ftoc-type-systems-and-randomization\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: toc-type-systems-and-randomization\ndescription: \"Use when reasoning about type systems, verification, or randomized algorithms: types as logic and the Curry–Howard correspondence, decidability of type checking and inference, what formal methods actually buy and where lightweight methods win, and randomness and approximation — BPP, Monte Carlo versus Las Vegas, the PCP theorem and hardness of approximation, heuristics and No Free Lunch.\"\n---\n\n# Theory of Computation: Type Systems, Logic and Verification, and Randomness and Approximation\n\n> **Part 4 of 5** of the *Theory of Computation* reference (plugin `theory-of-computation`), covering §12–§13. Sibling skills: `toc-automata-regex-and-parsing` (§0–§3), `toc-computability-and-complexity` (§4–§7), `toc-beyond-np-space-and-distributed-limits` (§8–§11), `toc-reference` (§14–§19). Section numbers are shared across the set; a reference written as §N → `skill` points into that sibling skill.\n>\n> **Currency:** Verified August 2026. See §16 → `toc-reference` for the currency snapshot and what goes stale first.\n\n> **How to read this.** Reference, not a course. Three markers:\n> - **[DURABLE]** — proven theorems and stable practice. **This is most of the document,\n>   and it does not expire.**\n> - **[VERSIONED]** — the small moving parts: recent results, solver capability, open\n>   problems.\n> - **[CONTESTED]** — genuine disagreement, mostly about pedagogy and practical relevance.\n>\n> **⚠️ GOTCHA** boxes mark places where ignorance of the theory produces a specific,\n> expensive production failure — which is the whole argument for learning it.\n>\n> **The three framings that organize everything below:**\n> 1. **This is the only branch of CS that tells you what you cannot do.** Everything else\n>    teaches techniques. Theory tells you when to stop looking — and **knowing a problem is\n>    undecidable or NP-hard is more valuable than any algorithm**, because it redirects\n>    you from an impossible goal to a tractable approximation of it.\n> 2. **You already use it; you may not know the names.** Regex is finite automata.\n>    Your parser is a pushdown automaton. Your state machine is a DFA. Your build system's\n>    cycle detection is graph theory. **The theory isn't an addition to your practice — it's\n>    a description of it**, and knowing the description tells you where the edges are.\n> 3. **\"Hard\" is not \"impossible,\" and this is the most consequential practical point.**\n>    NP-complete problems with thousands of variables are solved routinely (§9 → `toc-beyond-np-space-and-distributed-limits`). The\n>    theory tells you *no algorithm is fast on all inputs* — it says nothing about\n>    **your** inputs, which are usually structured. **Treating NP-hardness as a verdict\n>    rather than a warning is the single most common misapplication of this material.**\n\n---\n\n## §12. Type Systems, Logic, and Verification\n\n**[DURABLE] Type systems are decidable approximations of undecidable properties** (§4.1 → `toc-computability-and-complexity`) —\nwhich is the single most clarifying sentence about them.\n\n**The Curry–Howard correspondence**: **propositions are types; proofs are programs.**\nProving a theorem and writing a well-typed program are the same activity. This is not a\ncute analogy — it's the foundation of **Coq\u002FRocq, Lean, Agda, Idris**, and the reason\ndependent types let you encode \"this list has length n\" or \"this index is in bounds\" in the\ntype itself.\n\n**The expressiveness ladder, and its cost:**\n```\nSimply typed          decidable, restrictive\n+ polymorphism        Hindley–Milner: full inference, decidable, the ML\u002FHaskell sweet spot\n+ subtyping           inference gets harder\n+ higher-rank         ⚠️ full inference becomes undecidable — you must annotate\n+ dependent types     type checking decidable, inference generally not.\n                      Types can express arbitrary properties — and you now write proofs\n```\n**⚠️ The trade-off is fundamental and not fixable**: more expressive types catch more bugs\nand demand more annotation. **A type system that inferred everything and caught everything\nwould decide undecidable properties.**\n\n**Practical verification** (see §7 → `toc-computability-and-complexity` for the solvers underneath): **model checking** —\nexhaustively explore a finite state space, with **⚠️ state-space explosion** as the\npermanent enemy, mitigated by symbolic representation, abstraction, and partial-order\nreduction. **Abstract interpretation** — sound over-approximation, accepting false\npositives to guarantee no false negatives (this is where sound static analyzers live).\n**TLA+ \u002F Alloy** — specify and check designs before building them, and **[DURABLE] this is\nthe highest-leverage formal method for most engineers** because it catches design errors\nin distributed protocols where testing cannot.\n\n**[DURABLE] The pragmatic position**: full functional verification is expensive and\njustified for kernels, compilers, cryptography, and safety-critical control. **Lightweight\nformal methods — property-based testing, model checking a protocol, a TLA+ spec of your\nconsensus design — have a far better cost\u002Fbenefit ratio and are radically under-used.**\n\n---\n\n## §13. Randomness, Approximation, and Heuristics\n\n**Randomized complexity**: **BPP** (bounded-error probabilistic polynomial time) — and\n**[DURABLE] it is now widely conjectured that P = BPP**, i.e. randomness probably doesn't\nbuy asymptotic power, which was a genuine surprise. **Randomness buys simplicity and\npractical speed**, which is why randomized algorithms are everywhere: quicksort's pivot,\nMiller–Rabin primality, hashing, Monte Carlo methods, randomized load balancing.\n\n**⚠️ Monte Carlo vs. Las Vegas** is worth keeping straight: Monte Carlo is fast with a\nbounded error probability; Las Vegas is always correct with randomized runtime. **You need\nto know which one you're deploying**, because \"wrong 1 in 2^40 times\" is a very different\noperational posture from \"occasionally slow.\"\n\n**Approximation** (§6.2 → `toc-computability-and-complexity`), and the sharp edge: **the PCP theorem** implies many problems are\n**hard even to approximate well** — so \"just approximate it\" is not universally available,\nand for some problems the achievable ratio is provably capped unless P = NP.\n\n**Heuristics and metaheuristics** — greedy, local search, simulated annealing, tabu search,\ngenetic algorithms, beam search. **[DURABLE] No performance guarantees, frequently\nexcellent in practice**, and **the No Free Lunch theorem** says no optimizer beats all\nothers across all problems — which is the formal version of \"your heuristic works because\nit exploits structure in your instances,\" and a reason to be suspicious of anyone selling a\nuniversal optimizer.\n","# Theory of Computation: Type Systems, Logic and Verification, and Randomness and Approximation\n\n> **Part 4 of 5** of the *Theory of Computation* reference (plugin `theory-of-computation`), covering §12–§13. Sibling skills: `toc-automata-regex-and-parsing` (§0–§3), `toc-computability-and-complexity` (§4–§7), `toc-beyond-np-space-and-distributed-limits` (§8–§11), `toc-reference` (§14–§19). Section numbers are shared across the set; a reference written as §N → `skill` points into that sibling skill.\n>\n> **Currency:** Verified August 2026. See §16 → `toc-reference` for the currency snapshot and what goes stale first.\n\n> **How to read this.** Reference, not a course. Three markers:\n> - **[DURABLE]** — proven theorems and stable practice. **This is most of the document,\n>   and it does not expire.**\n> - **[VERSIONED]** — the small moving parts: recent results, solver capability, open\n>   problems.\n> - **[CONTESTED]** — genuine disagreement, mostly about pedagogy and practical relevance.\n>\n> **⚠️ GOTCHA** boxes mark places where ignorance of the theory produces a specific,\n> expensive production failure — which is the whole argument for learning it.\n>\n> **The three framings that organize everything below:**\n> 1. **This is the only branch of CS that tells you what you cannot do.** Everything else\n>    teaches techniques. Theory tells you when to stop looking — and **knowing a problem is\n>    undecidable or NP-hard is more valuable than any algorithm**, because it redirects\n>    you from an impossible goal to a tractable approximation of it.\n> 2. **You already use it; you may not know the names.** Regex is finite automata.\n>    Your parser is a pushdown automaton. Your state machine is a DFA. Your build system's\n>    cycle detection is graph theory. **The theory isn't an addition to your practice — it's\n>    a description of it**, and knowing the description tells you where the edges are.\n> 3. **\"Hard\" is not \"impossible,\" and this is the most consequential practical point.**\n>    NP-complete problems with thousands of variables are solved routinely (§9 → `toc-beyond-np-space-and-distributed-limits`). The\n>    theory tells you *no algorithm is fast on all inputs* — it says nothing about\n>    **your** inputs, which are usually structured. **Treating NP-hardness as a verdict\n>    rather than a warning is the single most common misapplication of this material.**\n\n---\n\n## §12. Type Systems, Logic, and Verification\n\n**[DURABLE] Type systems are decidable approximations of undecidable properties** (§4.1 → `toc-computability-and-complexity`) —\nwhich is the single most clarifying sentence about them.\n\n**The Curry–Howard correspondence**: **propositions are types; proofs are programs.**\nProving a theorem and writing a well-typed program are the same activity. This is not a\ncute analogy — it's the foundation of **Coq\u002FRocq, Lean, Agda, Idris**, and the reason\ndependent types let you encode \"this list has length n\" or \"this index is in bounds\" in the\ntype itself.\n\n**The expressiveness ladder, and its cost:**\n```\nSimply typed          decidable, restrictive\n+ polymorphism        Hindley–Milner: full inference, decidable, the ML\u002FHaskell sweet spot\n+ subtyping           inference gets harder\n+ higher-rank         ⚠️ full inference becomes undecidable — you must annotate\n+ dependent types     type checking decidable, inference generally not.\n                      Types can express arbitrary properties — and you now write proofs\n```\n**⚠️ The trade-off is fundamental and not fixable**: more expressive types catch more bugs\nand demand more annotation. **A type system that inferred everything and caught everything\nwould decide undecidable properties.**\n\n**Practical verification** (see §7 → `toc-computability-and-complexity` for the solvers underneath): **model checking** —\nexhaustively explore a finite state space, with **⚠️ state-space explosion** as the\npermanent enemy, mitigated by symbolic representation, abstraction, and partial-order\nreduction. **Abstract interpretation** — sound over-approximation, accepting false\npositives to guarantee no false negatives (this is where sound static analyzers live).\n**TLA+ \u002F Alloy** — specify and check designs before building them, and **[DURABLE] this is\nthe highest-leverage formal method for most engineers** because it catches design errors\nin distributed protocols where testing cannot.\n\n**[DURABLE] The pragmatic position**: full functional verification is expensive and\njustified for kernels, compilers, cryptography, and safety-critical control. **Lightweight\nformal methods — property-based testing, model checking a protocol, a TLA+ spec of your\nconsensus design — have a far better cost\u002Fbenefit ratio and are radically under-used.**\n\n---\n\n## §13. Randomness, Approximation, and Heuristics\n\n**Randomized complexity**: **BPP** (bounded-error probabilistic polynomial time) — and\n**[DURABLE] it is now widely conjectured that P = BPP**, i.e. randomness probably doesn't\nbuy asymptotic power, which was a genuine surprise. **Randomness buys simplicity and\npractical speed**, which is why randomized algorithms are everywhere: quicksort's pivot,\nMiller–Rabin primality, hashing, Monte Carlo methods, randomized load balancing.\n\n**⚠️ Monte Carlo vs. Las Vegas** is worth keeping straight: Monte Carlo is fast with a\nbounded error probability; Las Vegas is always correct with randomized runtime. **You need\nto know which one you're deploying**, because \"wrong 1 in 2^40 times\" is a very different\noperational posture from \"occasionally slow.\"\n\n**Approximation** (§6.2 → `toc-computability-and-complexity`), and the sharp edge: **the PCP theorem** implies many problems are\n**hard even to approximate well** — so \"just approximate it\" is not universally available,\nand for some problems the achievable ratio is provably capped unless P = NP.\n\n**Heuristics and metaheuristics** — greedy, local search, simulated annealing, tabu search,\ngenetic algorithms, beam search. **[DURABLE] No performance guarantees, frequently\nexcellent in practice**, and **the No Free Lunch theorem** says no optimizer beats all\nothers across all problems — which is the formal version of \"your heuristic works because\nit exploits structure in your instances,\" and a reason to be suspicious of anyone selling a\nuniversal optimizer.\n",{"name":5,"description":7},"develop","ae32736a1aabddabca5d2c96d665aa0ebc7d8700","src\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Ftheory-of-computation\u002Fskills\u002Ftoc-type-systems-and-randomization",3,"https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey","https:\u002F\u002Fthe-vibey-project.github.io\u002Fvibey\u002F","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project","https:\u002F\u002Fvibewithadam.matthewsteinberger.com","freedom for software engineers","2026-11-15 05:47:42",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add the-vibey-project\u002Fvibey --skill toc-type-systems-and-randomization",{"tool":40,"command":41},"bunx","bunx skills add the-vibey-project\u002Fvibey --skill toc-type-systems-and-randomization",{"tool":43,"command":44},"pnpm","pnpm dlx skills add the-vibey-project\u002Fvibey --skill toc-type-systems-and-randomization","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Ftheory-of-computation\u002Fskills\u002Ftoc-type-systems-and-randomization\u002FSKILL.md",true,[],[49,56,63,70,77,84],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":19},"01M7AT1FQJAE1FQYAMDTF490Y4","white-paper-writing","Use when writing white papers, technical reports, policy documents, thought leadership pieces, or any long-form authoritative document. Triggers on requests to write, structure, outline, or review white papers, technical reports, position papers, policy briefs, or evidence-driven arguments. Also use for B2B content marketing strategy, technical documentation requiring authority, academic-style reports, or any document that must educate while persuading. Use when someone asks \"how should I structure this\" for a long-form document.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Fwhite-paper-writing\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M7AT16BJRJJKK2MASXRZS76G","prose-technical-mechanics","Use when editing or writing prose at a technical\u002Fmechanical level: choosing between Anglo-Saxon and Latinate diction, placing information in topic vs stress positions, writing periodic vs cumulative sentences, handling sentence rhythm, punctuation as logic, transitions, paragraph structure, or phonesthetics. Use when someone wants to understand WHY prose works or doesn't, not just surface-level style advice. Triggers on word choice, sentence structure, emphasis, rhythm, diction, or any deep writing mechanics question.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Fprose-technical-mechanics\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7AT0W9HT0ZZ9Y287NW99MR3","prose-mechanics","Use when writing, editing, or analyzing prose style; when trying to avoid generic AI-sounding writing; when applying specific prose styles such as journalistic, academic, narrative, KJV biblical, Hemingway plain, Latinate\u002FJamesian, Orwellian, Augustan, Victorian, Early Modern (Bacon, Browne, Milton), or free indirect discourse; or when coaching someone on writing voice and mechanics. Triggers on any request to improve, analyze, or write in a specific prose style, to fix \"AI-sounding\" writing, to make prose more vivid or concrete, to vary sentence rhythm, or to understand how a particular writer achieves their effects.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Fprose-mechanics\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M7AT0KR635JX66X2X6F3E2CP","narrative-structure","Use when structuring stories, pitches, presentations, white papers, or any persuasive narrative; analyzing the hero's journey in fiction or non-fiction; applying StoryBrand for business communication; designing narrative arcs for thought leadership; or understanding Vogler, Snyder, Propp, or Campbell frameworks. Triggers on any narrative structure, storytelling, pitch structure, StoryBrand, hero's journey, three-act structure, Freytag, Save the Cat, narrative arc, or \"how should I structure this story\u002Fpitch\u002Fpresentation\" request.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Fnarrative-structure\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M7AT0AKGW09NKKZDYBT8VRDE","legal-brief-writing","Use when writing legal briefs, motions, or any court filing; when analyzing judicial cognition and persuasion; when applying elite brief-writing techniques from Roberts, Clement, Kagan, Garner; or when structuring legal arguments for maximum persuasion. Also use for autistic\u002Fneurodivergent advocates who need to understand how their natural communication style maps to elite legal advocacy. Triggers on any legal writing, brief drafting, motion preparation, or legal argument structuring request.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Flegal-brief-writing\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M7AT00VWPS4Q8B5VEMXX9NQT","journal-publishability-criteria","Use whenever a research paper, article or preprint is being written, revised, reviewed or published, and specifically before every publication of docs\u002Fpaper.md. Covers what legitimate journals actually gate on, in order of gating — the editor's desk screen (scope, novelty, package problems), what reviewers judge (methodological soundness, claims the evidence can carry, statistical and qualitative reporting), EQUATOR reporting guidelines, the ICMJE authorship criteria, COPE's view of text recycling, the near-universal generative-AI policy (no AI author, disclosure, author responsibility), TOP 2025 transparency standards, how to verify a journal is legitimate, submitting without an institution, and a pre-submission checklist. Triggers on requests to evaluate, review, prepare or submit a paper, to judge publishability, to write a declarations or data-availability section, to disclose AI use, or to check a journal.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Fjournal-publishability-criteria\u002FSKILL.md",[],[]]