Repository navigation
First 0.2.0
Changelog
All notable changes to the First compiler and standard library are documented here.
[0.2.0] — 2026-11-30
Highlights
0.2.0 is a major feature release. The language now has a complete proof system with 30+ tactics, dependent types, refinement types, compile-time metaprogramming, an LSP server, a VS Code extension, AI-powered error explanations, and a significantly expanded standard library covering algebra, analysis, topology, measure theory, and category theory.
Language
Dependent types
Vec<T, n>— length-indexed vectors; length checked at declaration site against array literalsFin<n>— bounded naturals; plaini64at runtime, constrained by the type system- Pi types — nat variables (
n,m,n+1, …) unified across function parameters - Sigma / DPair types —
mkSigma,projFst,projSnd - Type-level normalization —
Vec<T, n+0> == Vec<T, n>handled by the type checker - Dependent pattern matching —
[h|t]givestthe typeVec<T, n-1> - Computational
rfl—theorem addZeroRight(n: Int) -> Eq(n+0, n) by { rfl; }works - Dependent records — field types may reference prior field values
- Indexed inductive types —
type T<A, n: Int> = ...user-defined ADTs with nat parameters - Type-level functions —
typefun Foo<n: Int> = SomeType<n>(experimental)
Refinement types
{x: T | predicate}syntax with Z3-based discharge at assignment, call, and return sites- Counterexample output when a predicate is violated
NatandPosas refinement aliases in Prelude- Refinement subtyping via Z3 implication check
- Float predicate support
Proof system
theorem name(params) -> Prop by { tactics; }declarationsaxiom name(params) -> Prop;declarations@[simp]simp lemma registry- 30+ built-in tactics:
refl,rfl,decide,trivial,sorry,ring,omega,linarith,norm_num,simp,simp only,exact,assumption,have,rw,rw_rev,intro,induction,cases,obtain,use,apply,show,split,constructor,left,right,calc,by_contra,push_neg,contrapose,symm,exfalso,congr,specialize,discriminate,injection,absurd,norm_cast,field_simp,tauto,positivity,aesop,polyrith,fun_prop,gcongr - Tactic combinators:
try,repeat,first | ...,<;> - User-defined tactics:
tactic Name { body; }— module-exportable, composable
Type system
- Higher-kinded types:
F<_>kind annotations in interfaces; arity checking at implementation sites - Nested generic types:
Array<Array<T>>and similar>>forms now parse correctly - Type classes:
class Name<T>/instance Name<ConcreteType>/[Constraint<T>]on generic functions derive(ToString)for record types
Metaprogramming
macro name($p1, $p2) -> Syntax { body }— compile-time macros written in Firstquote { expr }— lifts an AST fragment to aSyntaxvalue$name/$(expr)— splices aSyntaxvalue back into the ASTSyntaxADT:SAtom | SInt | SStr | SBool | SList | SNode(tag, children)- Macros run before type-checking; can pattern-match on
Syntaxconstructors export macrofor module-level macros
Error handling
Result<T, E>in Prelude:Ok(T) | Err(E)?propagation operator in interactions
Other language features
loop { ... break; }withvarfor mutable state (interaction-only)for-inover ranges and arrays- Range expressions:
a..b,a..=b,a,b..c Channel<T>withsend/recv/selectfor concurrencyextern function/extern interactionFFI declarationsPropsort (proof-irrelevant)- Universe polymorphism (
Univkind)
Standard library
New modules added in 0.2.0:
| Module | Contents |
|---|---|
Nat |
Peano naturals, add/mul/sub/pred/leq, proved theorems |
Int |
Ring axioms + proved lemmas |
Real |
Opaque Real, field/order axioms |
Rat |
MkRat(Int,Int), arithmetic, axioms |
Complex |
MkComplex(Float,Float), field axioms |
Bool |
35+ proved theorems via decide |
Set |
Set = MkSet(A→Bool), De Morgan axioms |
List |
Nil|Cons, length/append/reverse/map/filter |
Vec |
Vec<T,n> length-indexed, vzip, head, replicate |
Fin |
Fin bounded naturals, mkFin, safeIndex |
Eq |
Eq type and refl axiom |
Prop |
Prop, True, False, And, Or, Not |
Void |
Empty type |
DPair |
Dependent pair Sigma type |
Finset |
Finite Int sets (ISEmpty/ISCons) |
GFinset |
Generic finite sets GSet[Equal] |
Algebra |
Ring/Field/Ord/Equal type class hierarchy |
NumberTheory |
GCD, primality, axioms |
Tactics |
auto, auto_arith, simp_ring, and other tactic macros |
Topology |
Open balls, continuity axioms |
Analysis |
Limits, derivatives, integrals (axiomatized) |
MeasureTheory |
Measures, Lebesgue integral (axiomatized) |
CategoryTheory |
Objects, morphisms, functors, natural transformations |
Macro |
Syntax ADT definition for metaprogramming |
NatList |
Nat-specific list utilities |
Modules present since 0.1.0 and further expanded: Prelude, Array, Math, Date, Strings, IO, Stdio, OS, Json, Http, HttpServer, Net, HashMap.
Tooling
first-lsp— LSP server with diagnostics, hover types, go-to-definition, and completion- VS Code extension — bundles
first-lsp; available ineditors/vscode/ firstc --format— source formatterfirstc --ai-errors— AI-powered error explanations via Anthropic, OpenAI, or DeepSeekfirstc --lib-path <dir>— repeatable extra library search path
Test suite
730 tests passing across 308 test cases (up from ~150 in 0.1.0).
Known limitations
- Cross-module macros (macros imported from other modules) not yet supported
- Interactive proof-state panel in LSP not yet implemented
- Windows native build untested (WSL 2 is the recommended path on Windows)
- Generic record field access on parameterized types has an IR gap
[0.1.0] — 2026-07-01 (initial release)
- Core language:
function,interaction,let,var,match, ADTs, records, generics, lambdas - Module system:
import,export,module - Basic type system:
Int,Float,Bool,Char,String,Array<T>,Option<T> - Interfaces (
interface/implementation) firpackage manager:new,build,run,add,install, git dependencies- LLVM backend targeting native binaries
- Homebrew formula (macOS); Linux install script
- Initial stdlib:
Prelude,Array,Math,Date,Strings,IO,Stdio,OS,Json,Http,HttpServer,Net,HashMap