Repository navigation
Expand file tree
/
Copy pathformalization.yaml
More file actions
171 lines (161 loc) · 6.46 KB
/
Copy pathformalization.yaml
File metadata and controls
171 lines (161 loc) · 6.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
project:
name: TorchLean
title: "TorchLean: Formalizing Neural Networks in Lean"
short_description: >
A Lean 4 framework for writing, running, inspecting, and verifying
neural-network programs, with typed tensors, graph semantics, executable
runtime/autograd support, finite-precision models, verification checkers,
and explicit CUDA/runtime trust boundaries.
homepage: "https://lean-dojo.github.io/TorchLean/"
repository: "https://github.com/lean-dojo/TorchLean"
license: MIT
toolchain:
lean: "leanprover/lean4:v4.36.0"
package_manager: Lake
primary_package_file: lakefile.lean
documentation_package: home_page/blueprint/lakefile.toml
numeric_dependency:
name: FloatLib
repository: "https://github.com/lean-dojo/FloatLib"
version: "4.1.0"
revision: "fc2fad1f9c7de970f0a10a44c58cdf2909a867b4"
description: >
Shared floating-point formats, executable software arithmetic, rounding
theory, interval semantics, and native logical-model bridges. TorchLean
supplies tensor/model contexts and application-specific proof adapters.
paper:
title: "TorchLean: Formalizing Neural Networks in Lean"
arxiv: "2602.22631"
url: "https://arxiv.org/abs/2602.22631"
authors:
- Robert Joseph George
- Jennifer Cruden
- Will Adkisson
- Xiangru Zhong
- Huan Zhang
- Anima Anandkumar
scope:
includes:
- Shape-indexed tensor and layer specifications.
- Neural-network model APIs and reusable model constructors.
- Graph IR, graph denotations, and verified graph/spec bridges.
- Executable autograd, optimizers, training loops, and model examples.
- IEEE-style finite-precision semantics and floating-point bridge contracts.
- FloatLib configured binary scalars for tensor and model specifications.
- Robustness, IBP/CROWN, spline, and certificate-checking workflows.
- Native CPU/CUDA runtime entrypoints with documented FFI assumptions.
excludes:
- A proof of CUDA, cuBLAS, cuFFT, compiler, driver, or GPU hardware correctness.
- A proof that external Python, Julia, PyTorch, Arb, or CROWN producers are correct.
- A claim that every runnable model command is fully verified end to end.
status:
formalization_stage: active
lean_kernel_checked: true
sorry_free: true
notes:
- The repository contains no Lean `sorry` or `admit` outside its dependencies.
- Native runtime and oracle boundaries are documented explicitly rather than hidden behind proof names.
- Public claims should be read together with docs/TRUST_BOUNDARIES.md.
build_and_validation:
standard_build:
command: "scripts/lake.sh build"
full_build:
command: >-
scripts/lake.sh build TorchLean.Tensor TorchLean.CUDA TorchLean.NN TorchLean.Verify
TorchLeanExamples TorchLeanTest
cuda_build:
command: "scripts/lake.sh -Kcuda=true build"
note: >
Builds the C++ backend against a LibTorch SDK of torch 2.13 or later, whose
Stable ABI it calls, so it also runs with later releases, apart from the CUDA caching
allocator's statistics and controls, which fail unless the runtime is torch 2.13, 2.14 or
2.15. Its CMake configuration may require a CUDA development toolkit. Executing CUDA
examples additionally requires a working NVIDIA driver and GPU.
non_cuda_build:
command: "scripts/lake.sh -Kcuda=false build"
documentation_build:
working_directory: .
command: "TORCHLEAN_PACKAGE_ROOT=$PWD/home_page/blueprint scripts/lake.sh build"
repository_checks:
- "python3 scripts/checks/repo_lint.py"
- "git diff --check"
main_components:
tensors:
files:
- TorchLean/Tensor
description: >
Shapes, tensor operations and their mathematical definitions, the einops compiler, and
tensor algebra proofs.
neural_networks:
files:
- TorchLean/NN
description: >
Application API for model, data, runtime, and training workflows, with the layer, model,
and dynamical-system definitions, executable autograd, and the autograd-correctness,
robustness, and learning-theory proofs.
graph_semantics:
files:
- TorchLean/NN/IR
description: >
Graph representations, denotational semantics, and graph/spec bridge layers.
verification:
files:
- TorchLean/Verify
description: >
Runtime approximation, CROWN/LiRPA bounds, and certificate checking.
runtime:
files:
- TorchLean/CUDA
- csrc
description: >
Native CPU/CUDA entrypoints and external-runtime boundaries.
numeric_integration:
files:
- TorchLean/Tensor/Numeric
- TorchLean/Tensor/ConfiguredBinary.lean
- TorchLean/Verify/Floats
description: >
FloatLib scalar contexts, binary32 certificate adapters, rounded-real
model specializations, and numerical contracts for differentiation.
Configured binary scalars use software arithmetic; the native CUDA
tensor representation has its own supported precisions.
examples:
files:
- TorchLeanExamples
description: >
Quickstarts, model commands, interoperability demos, and verification examples.
manual:
files:
- home_page/blueprint/TorchLeanBlueprint/Guide
description: >
Lean-native Verso guide for the public documentation site.
trust_boundaries:
source_of_truth: docs/TRUST_BOUNDARIES.md
lean_axioms: []
opaque_runtime_declarations:
description: >
CUDA buffers, kernel entrypoints and native host kernels are `@[extern]` Lean
declarations, most of them opaque. They are trust boundaries, listed in
docs/TRUST_BOUNDARIES.md. scripts/checks/dependency_audit.py checks where they
live and that they agree with the C sources, and scripts/checks/repo_lint.py
checks that no axiom is declared and that the CUDA buffer externs are
`never_extract`.
external_producers:
- PyTorch import/export and training scripts
- Julia spline and Python PINN certificate producers
- alpha-beta-CROWN and related external certificate tools
native_runtime:
description: >
Lean checks shapes and contracts around native calls, but memory safety,
launch behavior, compiler behavior, and floating-point behavior of native
CUDA/C/C++ code are outside Lean's proof kernel.
references:
documentation:
- "https://lean-dojo.github.io/TorchLean/"
- "https://lean-dojo.github.io/TorchLean/blueprint/"
- "https://lean-dojo.github.io/TorchLean/docs/"
source_files:
- README.md
- docs/TRUST_BOUNDARIES.md
- docs/THIRD_PARTY_NOTICES.md
- docs/CONTRIBUTING.md