Repository navigation
Releases
First 0.4.0
First 0.3.2
First 0.3.1
First 0.3.0
[0.3.0] — 2026-12-01
Highlights
0.3.0 closes the tactic gap with Lean 4. The proof system now has 68 built-in tactics — up from 30 in v0.2.0 — covering all of Lean 4's P1, P2, and P3 tactic categories. Every tactic is available in First source files today; interactive search tactics (exact?, apply?, simp?) are deferred to a future release.
Proof system — new tactics (38 additions)
Hypothesis management
clear h— remove a hypothesis from the proof contextrevert x— move a hypothesis or variable back into the goal (reverse ofintro)generalize [h :] e = x— replace an expression with a fresh variable in the goalsubst h/subst_vars— substitute a variable equality from a hypothesis everywhererename_i x— rename an inaccessible (auto-generated) hypothesisreplace h : T— replace a hypothesis with a new type
Rewriting control
rw [...] at h/rw [...] at *— rewrite inside a hypothesis instead of the goalsimp only [h1, h2]—simprestricted to an explicit lemma listsimp at h/simp only [...] at h/simp at *—simptargeting specific hypothesessimp_all—simpthe goal and all hypotheses simultaneouslyunfold f— unfold a definition in the goaldelta f— delta reduction (explicit unfolding)change T— change the goal to a definitionally equal typeconv => { ... }— focused rewriting inside a subtermreduce— normalize the goal by beta/delta/iota reduction
Pattern matching
rcases h with (a, b)— deep nested pattern matching on a hypothesisrintro (a, b)—introwith immediate destructuring
Goal management
all_goals { t }— apply a tactic to every open goalany_goals { t }— apply a tactic to any goal that accepts itcase name => { t }— select a named subgoaldone— assert all goals are closed; error if any remainskip— no-op tacticwith_reducible { t }— run tactics under reducible transparency
Numeric and cast tactics
zify— convert Nat goals to Intpush_cast— push coercions inwardpull_cast— pull coercions outwardmod_cast— simplify goals with modular castslinear_combination e— close a goal with an explicit linear combination certificatefin_cases x— enumerate all cases of aFin nvariableinterval_cases x— case-split overa ≤ x ≤ bnative_decide—decidevia native compiled codenorm_fin— normalizeFin narithmeticbitblast— bit-vector decision procedure
Typeclass and meta
infer_instance— close a typeclass/instance goal by synthesistrace "msg"— emit a debug message during proof checking; leaves goal open
push_neg upgraded
Full De Morgan laws, iterated to fixpoint:
¬(A∧B) → ¬A∨¬B, ¬(A∨B) → ¬A∧¬B, ¬(P→Q) → P∧¬Q, ¬¬P → P
Developer experience
- All 38 new tactics available in user-defined
tacticdeclarations in First source files - Full pretty-printer support for all new tactics (LSP hover, error messages)
- Parser supports
simp only,simp at,rw at,rcases with (...),case name =>,conv =>syntax
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