October 2026 main drop: mirror from GitHub
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitignore +29 -0
- LICENSE +661 -0
- README.md +16 -0
- alloy/HCALC.als +165 -0
- alloy/INVARIANTS.md +99 -0
- alloy/README.md +25 -0
- alloy/logs/alloy-check.txt +45 -0
- alloy/logs/alloy-commands.txt +20 -0
- alloy/logs/java-install.txt +1 -0
- alloy/modules/Contract.als +170 -0
- alloy/modules/Converge.als +65 -0
- alloy/modules/Evolve.als +197 -0
- alloy/modules/Optimize.als +43 -0
- alloy/modules/PrimeIndex.als +82 -0
- alloy/modules/Recursion.als +31 -0
- alloy/modules/Stabilize.als +76 -0
- alloy/modules/State.als +87 -0
- alloy/modules/Transform.als +74 -0
- alloy/run-production.sh +76 -0
- alloy/run.sh +37 -0
- docs/.gitkeep +0 -0
- docs/INVARIANTS.md +51 -0
- docs/REMAINING.md +37 -0
- j/README.md +29 -0
- j/hcalc.ijs +302 -0
- lean/.gitignore +1 -0
- lean/Hcalc.lean +12 -0
- lean/Hcalc/Axioms.lean +247 -0
- lean/Hcalc/Carrier.lean +63 -0
- lean/Hcalc/Convergence.lean +121 -0
- lean/Hcalc/Foundry.lean +144 -0
- lean/Hcalc/Invariants.lean +38 -0
- lean/Hcalc/Pipeline.lean +60 -0
- lean/Hcalc/Production.lean +25 -0
- lean/Hcalc/RealStub.lean +88 -0
- lean/LICENSE +699 -0
- lean/README.md +72 -0
- lean/build.log +2 -0
- lean/lake-manifest.json +6 -0
- lean/lakefile.toml +6 -0
- lean/lean-toolchain +1 -0
- spec/AXIOMS.md +124 -0
- spec/COHERENCE.md +221 -0
- spec/FOUNDRY_J_CROSSLINKS.md +116 -0
- spec/FOUNDRY_J_PRODUCTION_REVIEW.md +66 -0
- spec/HANDOFF_PRODUCTION.md +49 -0
- spec/INTERFACES.md +81 -0
- spec/PRODUCTION.md +304 -0
- spec/PROPERTIES.md +78 -0
- verify/LICENSE +661 -0
.gitignore
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Lean / Lake
|
| 2 |
+
lean/.lake/
|
| 3 |
+
**/build/
|
| 4 |
+
lake-packages/
|
| 5 |
+
*.olean
|
| 6 |
+
*.ilean
|
| 7 |
+
|
| 8 |
+
# Alloy JAR (local install; see alloy/README.md) + solution dumps
|
| 9 |
+
alloy/tools/
|
| 10 |
+
*.jar
|
| 11 |
+
alloy/logs/alloy-out*/
|
| 12 |
+
alloy/logs/alloy-check-a*.txt
|
| 13 |
+
alloy/logs/alloy-check-inv*.txt
|
| 14 |
+
|
| 15 |
+
# Editor / OS
|
| 16 |
+
.DS_Store
|
| 17 |
+
*.swp
|
| 18 |
+
*~
|
| 19 |
+
.idea/
|
| 20 |
+
.vscode/
|
| 21 |
+
|
| 22 |
+
# Python
|
| 23 |
+
__pycache__/
|
| 24 |
+
*.pyc
|
| 25 |
+
.venv/
|
| 26 |
+
|
| 27 |
+
# Secrets
|
| 28 |
+
.env
|
| 29 |
+
*.pem
|
LICENSE
ADDED
|
@@ -0,0 +1,661 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
GNU AFFERO GENERAL PUBLIC LICENSE
|
| 2 |
+
Version 3, 19 November 2007
|
| 3 |
+
|
| 4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
| 5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
| 6 |
+
of this license document, but changing it is not allowed.
|
| 7 |
+
|
| 8 |
+
Preamble
|
| 9 |
+
|
| 10 |
+
The GNU Affero General Public License is a free, copyleft license for
|
| 11 |
+
software and other kinds of works, specifically designed to ensure
|
| 12 |
+
cooperation with the community in the case of network server software.
|
| 13 |
+
|
| 14 |
+
The licenses for most software and other practical works are designed
|
| 15 |
+
to take away your freedom to share and change the works. By contrast,
|
| 16 |
+
our General Public Licenses are intended to guarantee your freedom to
|
| 17 |
+
share and change all versions of a program--to make sure it remains free
|
| 18 |
+
software for all its users.
|
| 19 |
+
|
| 20 |
+
When we speak of free software, we are referring to freedom, not
|
| 21 |
+
price. Our General Public Licenses are designed to make sure that you
|
| 22 |
+
have the freedom to distribute copies of free software (and charge for
|
| 23 |
+
them if you wish), that you receive source code or can get it if you
|
| 24 |
+
want it, that you can change the software or use pieces of it in new
|
| 25 |
+
free programs, and that you know you can do these things.
|
| 26 |
+
|
| 27 |
+
Developers that use our General Public Licenses protect your rights
|
| 28 |
+
with two steps: (1) assert copyright on the software, and (2) offer
|
| 29 |
+
you this License which gives you legal permission to copy, distribute
|
| 30 |
+
and/or modify the software.
|
| 31 |
+
|
| 32 |
+
A secondary benefit of defending all users' freedom is that
|
| 33 |
+
improvements made in alternate versions of the program, if they
|
| 34 |
+
receive widespread use, become available for other developers to
|
| 35 |
+
incorporate. Many developers of free software are heartened and
|
| 36 |
+
encouraged by the resulting cooperation. However, in the case of
|
| 37 |
+
software used on network servers, this result may fail to come about.
|
| 38 |
+
The GNU General Public License permits making a modified version and
|
| 39 |
+
letting the public access it on a server without ever releasing its
|
| 40 |
+
source code to the public.
|
| 41 |
+
|
| 42 |
+
The GNU Affero General Public License is designed specifically to
|
| 43 |
+
ensure that, in such cases, the modified source code becomes available
|
| 44 |
+
to the community. It requires the operator of a network server to
|
| 45 |
+
provide the source code of the modified version running there to the
|
| 46 |
+
users of that server. Therefore, public use of a modified version, on
|
| 47 |
+
a publicly accessible server, gives the public access to the source
|
| 48 |
+
code of the modified version.
|
| 49 |
+
|
| 50 |
+
An older license, called the Affero General Public License and
|
| 51 |
+
published by Affero, was designed to accomplish similar goals. This is
|
| 52 |
+
a different license, not a version of the Affero GPL, but Affero has
|
| 53 |
+
released a new version of the Affero GPL which permits relicensing under
|
| 54 |
+
this license.
|
| 55 |
+
|
| 56 |
+
The precise terms and conditions for copying, distribution and
|
| 57 |
+
modification follow.
|
| 58 |
+
|
| 59 |
+
TERMS AND CONDITIONS
|
| 60 |
+
|
| 61 |
+
0. Definitions.
|
| 62 |
+
|
| 63 |
+
"This License" refers to version 3 of the GNU Affero General Public License.
|
| 64 |
+
|
| 65 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
| 66 |
+
works, such as semiconductor masks.
|
| 67 |
+
|
| 68 |
+
"The Program" refers to any copyrightable work licensed under this
|
| 69 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
| 70 |
+
"recipients" may be individuals or organizations.
|
| 71 |
+
|
| 72 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
| 73 |
+
in a fashion requiring copyright permission, other than the making of an
|
| 74 |
+
exact copy. The resulting work is called a "modified version" of the
|
| 75 |
+
earlier work or a work "based on" the earlier work.
|
| 76 |
+
|
| 77 |
+
A "covered work" means either the unmodified Program or a work based
|
| 78 |
+
on the Program.
|
| 79 |
+
|
| 80 |
+
To "propagate" a work means to do anything with it that, without
|
| 81 |
+
permission, would make you directly or secondarily liable for
|
| 82 |
+
infringement under applicable copyright law, except executing it on a
|
| 83 |
+
computer or modifying a private copy. Propagation includes copying,
|
| 84 |
+
distribution (with or without modification), making available to the
|
| 85 |
+
public, and in some countries other activities as well.
|
| 86 |
+
|
| 87 |
+
To "convey" a work means any kind of propagation that enables other
|
| 88 |
+
parties to make or receive copies. Mere interaction with a user through
|
| 89 |
+
a computer network, with no transfer of a copy, is not conveying.
|
| 90 |
+
|
| 91 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
| 92 |
+
to the extent that it includes a convenient and prominently visible
|
| 93 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
| 94 |
+
tells the user that there is no warranty for the work (except to the
|
| 95 |
+
extent that warranties are provided), that licensees may convey the
|
| 96 |
+
work under this License, and how to view a copy of this License. If
|
| 97 |
+
the interface presents a list of user commands or options, such as a
|
| 98 |
+
menu, a prominent item in the list meets this criterion.
|
| 99 |
+
|
| 100 |
+
1. Source Code.
|
| 101 |
+
|
| 102 |
+
The "source code" for a work means the preferred form of the work
|
| 103 |
+
for making modifications to it. "Object code" means any non-source
|
| 104 |
+
form of a work.
|
| 105 |
+
|
| 106 |
+
A "Standard Interface" means an interface that either is an official
|
| 107 |
+
standard defined by a recognized standards body, or, in the case of
|
| 108 |
+
interfaces specified for a particular programming language, one that
|
| 109 |
+
is widely used among developers working in that language.
|
| 110 |
+
|
| 111 |
+
The "System Libraries" of an executable work include anything, other
|
| 112 |
+
than the work as a whole, that (a) is included in the normal form of
|
| 113 |
+
packaging a Major Component, but which is not part of that Major
|
| 114 |
+
Component, and (b) serves only to enable use of the work with that
|
| 115 |
+
Major Component, or to implement a Standard Interface for which an
|
| 116 |
+
implementation is available to the public in source code form. A
|
| 117 |
+
"Major Component", in this context, means a major essential component
|
| 118 |
+
(kernel, window system, and so on) of the specific operating system
|
| 119 |
+
(if any) on which the executable work runs, or a compiler used to
|
| 120 |
+
produce the work, or an object code interpreter used to run it.
|
| 121 |
+
|
| 122 |
+
The "Corresponding Source" for a work in object code form means all
|
| 123 |
+
the source code needed to generate, install, and (for an executable
|
| 124 |
+
work) run the object code and to modify the work, including scripts to
|
| 125 |
+
control those activities. However, it does not include the work's
|
| 126 |
+
System Libraries, or general-purpose tools or generally available free
|
| 127 |
+
programs which are used unmodified in performing those activities but
|
| 128 |
+
which are not part of the work. For example, Corresponding Source
|
| 129 |
+
includes interface definition files associated with source files for
|
| 130 |
+
the work, and the source code for shared libraries and dynamically
|
| 131 |
+
linked subprograms that the work is specifically designed to require,
|
| 132 |
+
such as by intimate data communication or control flow between those
|
| 133 |
+
subprograms and other parts of the work.
|
| 134 |
+
|
| 135 |
+
The Corresponding Source need not include anything that users
|
| 136 |
+
can regenerate automatically from other parts of the Corresponding
|
| 137 |
+
Source.
|
| 138 |
+
|
| 139 |
+
The Corresponding Source for a work in source code form is that
|
| 140 |
+
same work.
|
| 141 |
+
|
| 142 |
+
2. Basic Permissions.
|
| 143 |
+
|
| 144 |
+
All rights granted under this License are granted for the term of
|
| 145 |
+
copyright on the Program, and are irrevocable provided the stated
|
| 146 |
+
conditions are met. This License explicitly affirms your unlimited
|
| 147 |
+
permission to run the unmodified Program. The output from running a
|
| 148 |
+
covered work is covered by this License only if the output, given its
|
| 149 |
+
content, constitutes a covered work. This License acknowledges your
|
| 150 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
| 151 |
+
|
| 152 |
+
You may make, run and propagate covered works that you do not
|
| 153 |
+
convey, without conditions so long as your license otherwise remains
|
| 154 |
+
in force. You may convey covered works to others for the sole purpose
|
| 155 |
+
of having them make modifications exclusively for you, or provide you
|
| 156 |
+
with facilities for running those works, provided that you comply with
|
| 157 |
+
the terms of this License in conveying all material for which you do
|
| 158 |
+
not control copyright. Those thus making or running the covered works
|
| 159 |
+
for you must do so exclusively on your behalf, under your direction
|
| 160 |
+
and control, on terms that prohibit them from making any copies of
|
| 161 |
+
your copyrighted material outside their relationship with you.
|
| 162 |
+
|
| 163 |
+
Conveying under any other circumstances is permitted solely under
|
| 164 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
| 165 |
+
makes it unnecessary.
|
| 166 |
+
|
| 167 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
| 168 |
+
|
| 169 |
+
No covered work shall be deemed part of an effective technological
|
| 170 |
+
measure under any applicable law fulfilling obligations under article
|
| 171 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
| 172 |
+
similar laws prohibiting or restricting circumvention of such
|
| 173 |
+
measures.
|
| 174 |
+
|
| 175 |
+
When you convey a covered work, you waive any legal power to forbid
|
| 176 |
+
circumvention of technological measures to the extent such circumvention
|
| 177 |
+
is effected by exercising rights under this License with respect to
|
| 178 |
+
the covered work, and you disclaim any intention to limit operation or
|
| 179 |
+
modification of the work as a means of enforcing, against the work's
|
| 180 |
+
users, your or third parties' legal rights to forbid circumvention of
|
| 181 |
+
technological measures.
|
| 182 |
+
|
| 183 |
+
4. Conveying Verbatim Copies.
|
| 184 |
+
|
| 185 |
+
You may convey verbatim copies of the Program's source code as you
|
| 186 |
+
receive it, in any medium, provided that you conspicuously and
|
| 187 |
+
appropriately publish on each copy an appropriate copyright notice;
|
| 188 |
+
keep intact all notices stating that this License and any
|
| 189 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
| 190 |
+
keep intact all notices of the absence of any warranty; and give all
|
| 191 |
+
recipients a copy of this License along with the Program.
|
| 192 |
+
|
| 193 |
+
You may charge any price or no price for each copy that you convey,
|
| 194 |
+
and you may offer support or warranty protection for a fee.
|
| 195 |
+
|
| 196 |
+
5. Conveying Modified Source Versions.
|
| 197 |
+
|
| 198 |
+
You may convey a work based on the Program, or the modifications to
|
| 199 |
+
produce it from the Program, in the form of source code under the
|
| 200 |
+
terms of section 4, provided that you also meet all of these conditions:
|
| 201 |
+
|
| 202 |
+
a) The work must carry prominent notices stating that you modified
|
| 203 |
+
it, and giving a relevant date.
|
| 204 |
+
|
| 205 |
+
b) The work must carry prominent notices stating that it is
|
| 206 |
+
released under this License and any conditions added under section
|
| 207 |
+
7. This requirement modifies the requirement in section 4 to
|
| 208 |
+
"keep intact all notices".
|
| 209 |
+
|
| 210 |
+
c) You must license the entire work, as a whole, under this
|
| 211 |
+
License to anyone who comes into possession of a copy. This
|
| 212 |
+
License will therefore apply, along with any applicable section 7
|
| 213 |
+
additional terms, to the whole of the work, and all its parts,
|
| 214 |
+
regardless of how they are packaged. This License gives no
|
| 215 |
+
permission to license the work in any other way, but it does not
|
| 216 |
+
invalidate such permission if you have separately received it.
|
| 217 |
+
|
| 218 |
+
d) If the work has interactive user interfaces, each must display
|
| 219 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
| 220 |
+
interfaces that do not display Appropriate Legal Notices, your
|
| 221 |
+
work need not make them do so.
|
| 222 |
+
|
| 223 |
+
A compilation of a covered work with other separate and independent
|
| 224 |
+
works, which are not by their nature extensions of the covered work,
|
| 225 |
+
and which are not combined with it such as to form a larger program,
|
| 226 |
+
in or on a volume of a storage or distribution medium, is called an
|
| 227 |
+
"aggregate" if the compilation and its resulting copyright are not
|
| 228 |
+
used to limit the access or legal rights of the compilation's users
|
| 229 |
+
beyond what the individual works permit. Inclusion of a covered work
|
| 230 |
+
in an aggregate does not cause this License to apply to the other
|
| 231 |
+
parts of the aggregate.
|
| 232 |
+
|
| 233 |
+
6. Conveying Non-Source Forms.
|
| 234 |
+
|
| 235 |
+
You may convey a covered work in object code form under the terms
|
| 236 |
+
of sections 4 and 5, provided that you also convey the
|
| 237 |
+
machine-readable Corresponding Source under the terms of this License,
|
| 238 |
+
in one of these ways:
|
| 239 |
+
|
| 240 |
+
a) Convey the object code in, or embodied in, a physical product
|
| 241 |
+
(including a physical distribution medium), accompanied by the
|
| 242 |
+
Corresponding Source fixed on a durable physical medium
|
| 243 |
+
customarily used for software interchange.
|
| 244 |
+
|
| 245 |
+
b) Convey the object code in, or embodied in, a physical product
|
| 246 |
+
(including a physical distribution medium), accompanied by a
|
| 247 |
+
written offer, valid for at least three years and valid for as
|
| 248 |
+
long as you offer spare parts or customer support for that product
|
| 249 |
+
model, to give anyone who possesses the object code either (1) a
|
| 250 |
+
copy of the Corresponding Source for all the software in the
|
| 251 |
+
product that is covered by this License, on a durable physical
|
| 252 |
+
medium customarily used for software interchange, for a price no
|
| 253 |
+
more than your reasonable cost of physically performing this
|
| 254 |
+
conveying of source, or (2) access to copy the
|
| 255 |
+
Corresponding Source from a network server at no charge.
|
| 256 |
+
|
| 257 |
+
c) Convey individual copies of the object code with a copy of the
|
| 258 |
+
written offer to provide the Corresponding Source. This
|
| 259 |
+
alternative is allowed only occasionally and noncommercially, and
|
| 260 |
+
only if you received the object code with such an offer, in accord
|
| 261 |
+
with subsection 6b.
|
| 262 |
+
|
| 263 |
+
d) Convey the object code by offering access from a designated
|
| 264 |
+
place (gratis or for a charge), and offer equivalent access to the
|
| 265 |
+
Corresponding Source in the same way through the same place at no
|
| 266 |
+
further charge. You need not require recipients to copy the
|
| 267 |
+
Corresponding Source along with the object code. If the place to
|
| 268 |
+
copy the object code is a network server, the Corresponding Source
|
| 269 |
+
may be on a different server (operated by you or a third party)
|
| 270 |
+
that supports equivalent copying facilities, provided you maintain
|
| 271 |
+
clear directions next to the object code saying where to find the
|
| 272 |
+
Corresponding Source. Regardless of what server hosts the
|
| 273 |
+
Corresponding Source, you remain obligated to ensure that it is
|
| 274 |
+
available for as long as needed to satisfy these requirements.
|
| 275 |
+
|
| 276 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
| 277 |
+
you inform other peers where the object code and Corresponding
|
| 278 |
+
Source of the work are being offered to the general public at no
|
| 279 |
+
charge under subsection 6d.
|
| 280 |
+
|
| 281 |
+
A separable portion of the object code, whose source code is excluded
|
| 282 |
+
from the Corresponding Source as a System Library, need not be
|
| 283 |
+
included in conveying the object code work.
|
| 284 |
+
|
| 285 |
+
A "User Product" is either (1) a "consumer product", which means any
|
| 286 |
+
tangible personal property which is normally used for personal, family,
|
| 287 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
| 288 |
+
into a dwelling. In determining whether a product is a consumer product,
|
| 289 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
| 290 |
+
product received by a particular user, "normally used" refers to a
|
| 291 |
+
typical or common use of that class of product, regardless of the status
|
| 292 |
+
of the particular user or of the way in which the particular user
|
| 293 |
+
actually uses, or expects or is expected to use, the product. A product
|
| 294 |
+
is a consumer product regardless of whether the product has substantial
|
| 295 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
| 296 |
+
the only significant mode of use of the product.
|
| 297 |
+
|
| 298 |
+
"Installation Information" for a User Product means any methods,
|
| 299 |
+
procedures, authorization keys, or other information required to install
|
| 300 |
+
and execute modified versions of a covered work in that User Product from
|
| 301 |
+
a modified version of its Corresponding Source. The information must
|
| 302 |
+
suffice to ensure that the continued functioning of the modified object
|
| 303 |
+
code is in no case prevented or interfered with solely because
|
| 304 |
+
modification has been made.
|
| 305 |
+
|
| 306 |
+
If you convey an object code work under this section in, or with, or
|
| 307 |
+
specifically for use in, a User Product, and the conveying occurs as
|
| 308 |
+
part of a transaction in which the right of possession and use of the
|
| 309 |
+
User Product is transferred to the recipient in perpetuity or for a
|
| 310 |
+
fixed term (regardless of how the transaction is characterized), the
|
| 311 |
+
Corresponding Source conveyed under this section must be accompanied
|
| 312 |
+
by the Installation Information. But this requirement does not apply
|
| 313 |
+
if neither you nor any third party retains the ability to install
|
| 314 |
+
modified object code on the User Product (for example, the work has
|
| 315 |
+
been installed in ROM).
|
| 316 |
+
|
| 317 |
+
The requirement to provide Installation Information does not include a
|
| 318 |
+
requirement to continue to provide support service, warranty, or updates
|
| 319 |
+
for a work that has been modified or installed by the recipient, or for
|
| 320 |
+
the User Product in which it has been modified or installed. Access to a
|
| 321 |
+
network may be denied when the modification itself materially and
|
| 322 |
+
adversely affects the operation of the network or violates the rules and
|
| 323 |
+
protocols for communication across the network.
|
| 324 |
+
|
| 325 |
+
Corresponding Source conveyed, and Installation Information provided,
|
| 326 |
+
in accord with this section must be in a format that is publicly
|
| 327 |
+
documented (and with an implementation available to the public in
|
| 328 |
+
source code form), and must require no special password or key for
|
| 329 |
+
unpacking, reading or copying.
|
| 330 |
+
|
| 331 |
+
7. Additional Terms.
|
| 332 |
+
|
| 333 |
+
"Additional permissions" are terms that supplement the terms of this
|
| 334 |
+
License by making exceptions from one or more of its conditions.
|
| 335 |
+
Additional permissions that are applicable to the entire Program shall
|
| 336 |
+
be treated as though they were included in this License, to the extent
|
| 337 |
+
that they are valid under applicable law. If additional permissions
|
| 338 |
+
apply only to part of the Program, that part may be used separately
|
| 339 |
+
under those permissions, but the entire Program remains governed by
|
| 340 |
+
this License without regard to the additional permissions.
|
| 341 |
+
|
| 342 |
+
When you convey a copy of a covered work, you may at your option
|
| 343 |
+
remove any additional permissions from that copy, or from any part of
|
| 344 |
+
it. (Additional permissions may be written to require their own
|
| 345 |
+
removal in certain cases when you modify the work.) You may place
|
| 346 |
+
additional permissions on material, added by you to a covered work,
|
| 347 |
+
for which you have or can give appropriate copyright permission.
|
| 348 |
+
|
| 349 |
+
Notwithstanding any other provision of this License, for material you
|
| 350 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
| 351 |
+
that material) supplement the terms of this License with terms:
|
| 352 |
+
|
| 353 |
+
a) Disclaiming warranty or limiting liability differently from the
|
| 354 |
+
terms of sections 15 and 16 of this License; or
|
| 355 |
+
|
| 356 |
+
b) Requiring preservation of specified reasonable legal notices or
|
| 357 |
+
author attributions in that material or in the Appropriate Legal
|
| 358 |
+
Notices displayed by works containing it; or
|
| 359 |
+
|
| 360 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
| 361 |
+
requiring that modified versions of such material be marked in
|
| 362 |
+
reasonable ways as different from the original version; or
|
| 363 |
+
|
| 364 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
| 365 |
+
authors of the material; or
|
| 366 |
+
|
| 367 |
+
e) Declining to grant rights under trademark law for use of some
|
| 368 |
+
trade names, trademarks, or service marks; or
|
| 369 |
+
|
| 370 |
+
f) Requiring indemnification of licensors and authors of that
|
| 371 |
+
material by anyone who conveys the material (or modified versions of
|
| 372 |
+
it) with contractual assumptions of liability to the recipient, for
|
| 373 |
+
any liability that these contractual assumptions directly impose on
|
| 374 |
+
those licensors and authors.
|
| 375 |
+
|
| 376 |
+
All other non-permissive additional terms are considered "further
|
| 377 |
+
restrictions" within the meaning of section 10. If the Program as you
|
| 378 |
+
received it, or any part of it, contains a notice stating that it is
|
| 379 |
+
governed by this License along with a term that is a further
|
| 380 |
+
restriction, you may remove that term. If a license document contains
|
| 381 |
+
a further restriction but permits relicensing or conveying under this
|
| 382 |
+
License, you may add to a covered work material governed by the terms
|
| 383 |
+
of that license document, provided that the further restriction does
|
| 384 |
+
not survive such relicensing or conveying.
|
| 385 |
+
|
| 386 |
+
If you add terms to a covered work in accord with this section, you
|
| 387 |
+
must place, in the relevant source files, a statement of the
|
| 388 |
+
additional terms that apply to those files, or a notice indicating
|
| 389 |
+
where to find the applicable terms.
|
| 390 |
+
|
| 391 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
| 392 |
+
form of a separately written license, or stated as exceptions;
|
| 393 |
+
the above requirements apply either way.
|
| 394 |
+
|
| 395 |
+
8. Termination.
|
| 396 |
+
|
| 397 |
+
You may not propagate or modify a covered work except as expressly
|
| 398 |
+
provided under this License. Any attempt otherwise to propagate or
|
| 399 |
+
modify it is void, and will automatically terminate your rights under
|
| 400 |
+
this License (including any patent licenses granted under the third
|
| 401 |
+
paragraph of section 11).
|
| 402 |
+
|
| 403 |
+
However, if you cease all violation of this License, then your
|
| 404 |
+
license from a particular copyright holder is reinstated (a)
|
| 405 |
+
provisionally, unless and until the copyright holder explicitly and
|
| 406 |
+
finally terminates your license, and (b) permanently, if the copyright
|
| 407 |
+
holder fails to notify you of the violation by some reasonable means
|
| 408 |
+
prior to 60 days after the cessation.
|
| 409 |
+
|
| 410 |
+
Moreover, your license from a particular copyright holder is
|
| 411 |
+
reinstated permanently if the copyright holder notifies you of the
|
| 412 |
+
violation by some reasonable means, this is the first time you have
|
| 413 |
+
received notice of violation of this License (for any work) from that
|
| 414 |
+
copyright holder, and you cure the violation prior to 30 days after
|
| 415 |
+
your receipt of the notice.
|
| 416 |
+
|
| 417 |
+
Termination of your rights under this section does not terminate the
|
| 418 |
+
licenses of parties who have received copies or rights from you under
|
| 419 |
+
this License. If your rights have been terminated and not permanently
|
| 420 |
+
reinstated, you do not qualify to receive new licenses for the same
|
| 421 |
+
material under section 10.
|
| 422 |
+
|
| 423 |
+
9. Acceptance Not Required for Having Copies.
|
| 424 |
+
|
| 425 |
+
You are not required to accept this License in order to receive or
|
| 426 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
| 427 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
| 428 |
+
to receive a copy likewise does not require acceptance. However,
|
| 429 |
+
nothing other than this License grants you permission to propagate or
|
| 430 |
+
modify any covered work. These actions infringe copyright if you do
|
| 431 |
+
not accept this License. Therefore, by modifying or propagating a
|
| 432 |
+
covered work, you indicate your acceptance of this License to do so.
|
| 433 |
+
|
| 434 |
+
10. Automatic Licensing of Downstream Recipients.
|
| 435 |
+
|
| 436 |
+
Each time you convey a covered work, the recipient automatically
|
| 437 |
+
receives a license from the original licensors, to run, modify and
|
| 438 |
+
propagate that work, subject to this License. You are not responsible
|
| 439 |
+
for enforcing compliance by third parties with this License.
|
| 440 |
+
|
| 441 |
+
An "entity transaction" is a transaction transferring control of an
|
| 442 |
+
organization, or substantially all assets of one, or subdividing an
|
| 443 |
+
organization, or merging organizations. If propagation of a covered
|
| 444 |
+
work results from an entity transaction, each party to that
|
| 445 |
+
transaction who receives a copy of the work also receives whatever
|
| 446 |
+
licenses to the work the party's predecessor in interest had or could
|
| 447 |
+
give under the previous paragraph, plus a right to possession of the
|
| 448 |
+
Corresponding Source of the work from the predecessor in interest, if
|
| 449 |
+
the predecessor has it or can get it with reasonable efforts.
|
| 450 |
+
|
| 451 |
+
You may not impose any further restrictions on the exercise of the
|
| 452 |
+
rights granted or affirmed under this License. For example, you may
|
| 453 |
+
not impose a license fee, royalty, or other charge for exercise of
|
| 454 |
+
rights granted under this License, and you may not initiate litigation
|
| 455 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
| 456 |
+
any patent claim is infringed by making, using, selling, offering for
|
| 457 |
+
sale, or importing the Program or any portion of it.
|
| 458 |
+
|
| 459 |
+
11. Patents.
|
| 460 |
+
|
| 461 |
+
A "contributor" is a copyright holder who authorizes use under this
|
| 462 |
+
License of the Program or a work on which the Program is based. The
|
| 463 |
+
work thus licensed is called the contributor's "contributor version".
|
| 464 |
+
|
| 465 |
+
A contributor's "essential patent claims" are all patent claims
|
| 466 |
+
owned or controlled by the contributor, whether already acquired or
|
| 467 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
| 468 |
+
by this License, of making, using, or selling its contributor version,
|
| 469 |
+
but do not include claims that would be infringed only as a
|
| 470 |
+
consequence of further modification of the contributor version. For
|
| 471 |
+
purposes of this definition, "control" includes the right to grant
|
| 472 |
+
patent sublicenses in a manner consistent with the requirements of
|
| 473 |
+
this License.
|
| 474 |
+
|
| 475 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
| 476 |
+
patent license under the contributor's essential patent claims, to
|
| 477 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
| 478 |
+
propagate the contents of its contributor version.
|
| 479 |
+
|
| 480 |
+
In the following three paragraphs, a "patent license" is any express
|
| 481 |
+
agreement or commitment, however denominated, not to enforce a patent
|
| 482 |
+
(such as an express permission to practice a patent or covenant not to
|
| 483 |
+
sue for patent infringement). To "grant" such a patent license to a
|
| 484 |
+
party means to make such an agreement or commitment not to enforce a
|
| 485 |
+
patent against the party.
|
| 486 |
+
|
| 487 |
+
If you convey a covered work, knowingly relying on a patent license,
|
| 488 |
+
and the Corresponding Source of the work is not available for anyone
|
| 489 |
+
to copy, free of charge and under the terms of this License, through a
|
| 490 |
+
publicly available network server or other readily accessible means,
|
| 491 |
+
then you must either (1) cause the Corresponding Source to be so
|
| 492 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
| 493 |
+
patent license for this particular work, or (3) arrange, in a manner
|
| 494 |
+
consistent with the requirements of this License, to extend the patent
|
| 495 |
+
license to downstream recipients. "Knowingly relying" means you have
|
| 496 |
+
actual knowledge that, but for the patent license, your conveying the
|
| 497 |
+
covered work in a country, or your recipient's use of the covered work
|
| 498 |
+
in a country, would infringe one or more identifiable patents in that
|
| 499 |
+
country that you have reason to believe are valid.
|
| 500 |
+
|
| 501 |
+
If, pursuant to or in connection with a single transaction or
|
| 502 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
| 503 |
+
covered work, and grant a patent license to some of the parties
|
| 504 |
+
receiving the covered work authorizing them to use, propagate, modify
|
| 505 |
+
or convey a specific copy of the covered work, then the patent license
|
| 506 |
+
you grant is automatically extended to all recipients of the covered
|
| 507 |
+
work and works based on it.
|
| 508 |
+
|
| 509 |
+
A patent license is "discriminatory" if it does not include within
|
| 510 |
+
the scope of its coverage, prohibits the exercise of, or is
|
| 511 |
+
conditioned on the non-exercise of one or more of the rights that are
|
| 512 |
+
specifically granted under this License. You may not convey a covered
|
| 513 |
+
work if you are a party to an arrangement with a third party that is
|
| 514 |
+
in the business of distributing software, under which you make payment
|
| 515 |
+
to the third party based on the extent of your activity of conveying
|
| 516 |
+
the work, and under which the third party grants, to any of the
|
| 517 |
+
parties who would receive the covered work from you, a discriminatory
|
| 518 |
+
patent license (a) in connection with copies of the covered work
|
| 519 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
| 520 |
+
for and in connection with specific products or compilations that
|
| 521 |
+
contain the covered work, unless you entered into that arrangement,
|
| 522 |
+
or that patent license was granted, prior to 28 March 2007.
|
| 523 |
+
|
| 524 |
+
Nothing in this License shall be construed as excluding or limiting
|
| 525 |
+
any implied license or other defenses to infringement that may
|
| 526 |
+
otherwise be available to you under applicable patent law.
|
| 527 |
+
|
| 528 |
+
12. No Surrender of Others' Freedom.
|
| 529 |
+
|
| 530 |
+
If conditions are imposed on you (whether by court order, agreement or
|
| 531 |
+
otherwise) that contradict the conditions of this License, they do not
|
| 532 |
+
excuse you from the conditions of this License. If you cannot convey a
|
| 533 |
+
covered work so as to satisfy simultaneously your obligations under this
|
| 534 |
+
License and any other pertinent obligations, then as a consequence you may
|
| 535 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
| 536 |
+
to collect a royalty for further conveying from those to whom you convey
|
| 537 |
+
the Program, the only way you could satisfy both those terms and this
|
| 538 |
+
License would be to refrain entirely from conveying the Program.
|
| 539 |
+
|
| 540 |
+
13. Remote Network Interaction; Use with the GNU General Public License.
|
| 541 |
+
|
| 542 |
+
Notwithstanding any other provision of this License, if you modify the
|
| 543 |
+
Program, your modified version must prominently offer all users
|
| 544 |
+
interacting with it remotely through a computer network (if your version
|
| 545 |
+
supports such interaction) an opportunity to receive the Corresponding
|
| 546 |
+
Source of your version by providing access to the Corresponding Source
|
| 547 |
+
from a network server at no charge, through some standard or customary
|
| 548 |
+
means of facilitating copying of software. This Corresponding Source
|
| 549 |
+
shall include the Corresponding Source for any work covered by version 3
|
| 550 |
+
of the GNU General Public License that is incorporated pursuant to the
|
| 551 |
+
following paragraph.
|
| 552 |
+
|
| 553 |
+
Notwithstanding any other provision of this License, you have
|
| 554 |
+
permission to link or combine any covered work with a work licensed
|
| 555 |
+
under version 3 of the GNU General Public License into a single
|
| 556 |
+
combined work, and to convey the resulting work. The terms of this
|
| 557 |
+
License will continue to apply to the part which is the covered work,
|
| 558 |
+
but the work with which it is combined will remain governed by version
|
| 559 |
+
3 of the GNU General Public License.
|
| 560 |
+
|
| 561 |
+
14. Revised Versions of this License.
|
| 562 |
+
|
| 563 |
+
The Free Software Foundation may publish revised and/or new versions of
|
| 564 |
+
the GNU Affero General Public License from time to time. Such new versions
|
| 565 |
+
will be similar in spirit to the present version, but may differ in detail to
|
| 566 |
+
address new problems or concerns.
|
| 567 |
+
|
| 568 |
+
Each version is given a distinguishing version number. If the
|
| 569 |
+
Program specifies that a certain numbered version of the GNU Affero General
|
| 570 |
+
Public License "or any later version" applies to it, you have the
|
| 571 |
+
option of following the terms and conditions either of that numbered
|
| 572 |
+
version or of any later version published by the Free Software
|
| 573 |
+
Foundation. If the Program does not specify a version number of the
|
| 574 |
+
GNU Affero General Public License, you may choose any version ever published
|
| 575 |
+
by the Free Software Foundation.
|
| 576 |
+
|
| 577 |
+
If the Program specifies that a proxy can decide which future
|
| 578 |
+
versions of the GNU Affero General Public License can be used, that proxy's
|
| 579 |
+
public statement of acceptance of a version permanently authorizes you
|
| 580 |
+
to choose that version for the Program.
|
| 581 |
+
|
| 582 |
+
Later license versions may give you additional or different
|
| 583 |
+
permissions. However, no additional obligations are imposed on any
|
| 584 |
+
author or copyright holder as a result of your choosing to follow a
|
| 585 |
+
later version.
|
| 586 |
+
|
| 587 |
+
15. Disclaimer of Warranty.
|
| 588 |
+
|
| 589 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
| 590 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
| 591 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
| 592 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
| 593 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
| 594 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
| 595 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
| 596 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
| 597 |
+
|
| 598 |
+
16. Limitation of Liability.
|
| 599 |
+
|
| 600 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
| 601 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
| 602 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
| 603 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
| 604 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
| 605 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
| 606 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
| 607 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
| 608 |
+
SUCH DAMAGES.
|
| 609 |
+
|
| 610 |
+
17. Interpretation of Sections 15 and 16.
|
| 611 |
+
|
| 612 |
+
If the disclaimer of warranty and limitation of liability provided
|
| 613 |
+
above cannot be given local legal effect according to their terms,
|
| 614 |
+
reviewing courts shall apply local law that most closely approximates
|
| 615 |
+
an absolute waiver of all civil liability in connection with the
|
| 616 |
+
Program, unless a warranty or assumption of liability accompanies a
|
| 617 |
+
copy of the Program in return for a fee.
|
| 618 |
+
|
| 619 |
+
END OF TERMS AND CONDITIONS
|
| 620 |
+
|
| 621 |
+
How to Apply These Terms to Your New Programs
|
| 622 |
+
|
| 623 |
+
If you develop a new program, and you want it to be of the greatest
|
| 624 |
+
possible use to the public, the best way to achieve this is to make it
|
| 625 |
+
free software which everyone can redistribute and change under these terms.
|
| 626 |
+
|
| 627 |
+
To do so, attach the following notices to the program. It is safest
|
| 628 |
+
to attach them to the start of each source file to most effectively
|
| 629 |
+
state the exclusion of warranty; and each file should have at least
|
| 630 |
+
the "copyright" line and a pointer to where the full notice is found.
|
| 631 |
+
|
| 632 |
+
<one line to give the program's name and a brief idea of what it does.>
|
| 633 |
+
Copyright (C) <year> <name of author>
|
| 634 |
+
|
| 635 |
+
This program is free software: you can redistribute it and/or modify
|
| 636 |
+
it under the terms of the GNU Affero General Public License as published
|
| 637 |
+
by the Free Software Foundation, either version 3 of the License, or
|
| 638 |
+
(at your option) any later version.
|
| 639 |
+
|
| 640 |
+
This program is distributed in the hope that it will be useful,
|
| 641 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 642 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 643 |
+
GNU Affero General Public License for more details.
|
| 644 |
+
|
| 645 |
+
You should have received a copy of the GNU Affero General Public License
|
| 646 |
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 647 |
+
|
| 648 |
+
Also add information on how to contact you by electronic and paper mail.
|
| 649 |
+
|
| 650 |
+
If your software can interact with users remotely through a computer
|
| 651 |
+
network, you should also make sure that it provides a way for users to
|
| 652 |
+
get its source. For example, if your program is a web application, its
|
| 653 |
+
interface could display a "Source" link that leads users to an archive
|
| 654 |
+
of the code. There are many ways you could offer source, and different
|
| 655 |
+
solutions will be better for different programs; see section 13 for the
|
| 656 |
+
specific requirements.
|
| 657 |
+
|
| 658 |
+
You should also get your employer (if you work as a programmer) or school,
|
| 659 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
| 660 |
+
For more information on this, and how to apply and follow the GNU AGPL, see
|
| 661 |
+
<https://www.gnu.org/licenses/>.
|
README.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: agpl-3.0
|
| 3 |
+
tags:
|
| 4 |
+
- snapkitty
|
| 5 |
+
- october-2026-drop
|
| 6 |
+
- lean4
|
| 7 |
+
- alloy
|
| 8 |
+
- j
|
| 9 |
+
- dynamical-systems
|
| 10 |
+
- contraction
|
| 11 |
+
- formal-verification
|
| 12 |
+
- research
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
> Mirrored from [https://github.com/SNAPKITTYWEST/hcalc](https://github.com/SNAPKITTYWEST/hcalc) at commit `5d8fa46`. Part of the **SnapKitty October 2026 main drop**.
|
| 16 |
+
|
alloy/HCALC.als
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright (C) 2026 HCALC / Foundry J contributors
|
| 3 |
+
* SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
*
|
| 5 |
+
* Top-level HCALC Alloy — PRODUCTION close (AGPL-3.0-only).
|
| 6 |
+
* Cite: PRODUCTION.md (authoritative); AXIOMS.md; COHERENCE.md; FOUNDRY_J_CROSSLINKS.md.
|
| 7 |
+
* Nested: X_{t+1}=Ξ(t,Λm·C(T_p(X_t))).
|
| 8 |
+
* ShapeMap: InstanceBridge morphism — NOT Foundry39 ≡ nested.
|
| 9 |
+
* Sealed: A1–A6 + A7 SpecDefined + production P1–P8.
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
module HCALC
|
| 13 |
+
|
| 14 |
+
open modules/State
|
| 15 |
+
open modules/PrimeIndex
|
| 16 |
+
open modules/Transform
|
| 17 |
+
open modules/Recursion
|
| 18 |
+
open modules/Stabilize
|
| 19 |
+
open modules/Contract
|
| 20 |
+
open modules/Evolve
|
| 21 |
+
open modules/Optimize
|
| 22 |
+
open modules/Converge
|
| 23 |
+
|
| 24 |
+
/* ---- A7 Gap records: all SpecDefined (PRODUCTION close) ----
|
| 25 |
+
* Provenance: SpecDefined — PRODUCTION.md; AXIOMS A7.
|
| 26 |
+
* Retire Undefined stubs; formulas live in PRODUCTION.md §§1–9. */
|
| 27 |
+
|
| 28 |
+
abstract sig DefStatus {}
|
| 29 |
+
one sig Undefined, SpecDefined extends DefStatus {}
|
| 30 |
+
|
| 31 |
+
one sig GapRecord_LambdaM {
|
| 32 |
+
/* Gap-Λm-scalar — CLOSED PRODUCTION §4 */
|
| 33 |
+
status: one DefStatus
|
| 34 |
+
}
|
| 35 |
+
one sig GapRecord_HCALC_Xi {
|
| 36 |
+
/* Gap-Ξ — CLOSED PRODUCTION §5 */
|
| 37 |
+
status: one DefStatus
|
| 38 |
+
}
|
| 39 |
+
one sig GapRecord_C {
|
| 40 |
+
/* Gap-C-wrapper — CLOSED PRODUCTION §3 */
|
| 41 |
+
status: one DefStatus
|
| 42 |
+
}
|
| 43 |
+
one sig GapRecord_Tp {
|
| 44 |
+
/* Gap-Tp-from-P64 — CLOSED PRODUCTION §2 */
|
| 45 |
+
status: one DefStatus
|
| 46 |
+
}
|
| 47 |
+
one sig GapRecord_Carrier {
|
| 48 |
+
/* Gap-Carrier — CLOSED PRODUCTION §1 */
|
| 49 |
+
status: one DefStatus
|
| 50 |
+
}
|
| 51 |
+
one sig GapRecord_ShapeMap {
|
| 52 |
+
/* Gap-ShapeMap / L7 — CLOSED PRODUCTION §6 InstanceBridge */
|
| 53 |
+
status: one DefStatus
|
| 54 |
+
}
|
| 55 |
+
one sig GapRecord_ContractAlg {
|
| 56 |
+
/* Gap-ContractAlg — CLOSED PRODUCTION §7 */
|
| 57 |
+
status: one DefStatus
|
| 58 |
+
}
|
| 59 |
+
one sig GapRecord_Converge {
|
| 60 |
+
/* Gap-Converge — CLOSED PRODUCTION §8 */
|
| 61 |
+
status: one DefStatus
|
| 62 |
+
}
|
| 63 |
+
one sig GapRecord_OptObj {
|
| 64 |
+
/* Gap-OptObj — CLOSED PRODUCTION §9 */
|
| 65 |
+
status: one DefStatus
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
fact A7_production_all_spec_defined {
|
| 69 |
+
GapRecord_LambdaM.status = SpecDefined
|
| 70 |
+
GapRecord_HCALC_Xi.status = SpecDefined
|
| 71 |
+
GapRecord_C.status = SpecDefined
|
| 72 |
+
GapRecord_Tp.status = SpecDefined
|
| 73 |
+
GapRecord_Carrier.status = SpecDefined
|
| 74 |
+
GapRecord_ShapeMap.status = SpecDefined
|
| 75 |
+
GapRecord_ContractAlg.status = SpecDefined
|
| 76 |
+
GapRecord_Converge.status = SpecDefined
|
| 77 |
+
GapRecord_OptObj.status = SpecDefined
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
pred A7_production_defined_records_present {
|
| 81 |
+
one GapRecord_LambdaM
|
| 82 |
+
one GapRecord_HCALC_Xi
|
| 83 |
+
one GapRecord_C
|
| 84 |
+
one GapRecord_Tp
|
| 85 |
+
one GapRecord_Carrier
|
| 86 |
+
one GapRecord_ShapeMap
|
| 87 |
+
one GapRecord_ContractAlg
|
| 88 |
+
one GapRecord_Converge
|
| 89 |
+
one GapRecord_OptObj
|
| 90 |
+
GapRecord_LambdaM.status = SpecDefined
|
| 91 |
+
GapRecord_HCALC_Xi.status = SpecDefined
|
| 92 |
+
GapRecord_C.status = SpecDefined
|
| 93 |
+
GapRecord_Tp.status = SpecDefined
|
| 94 |
+
GapRecord_Carrier.status = SpecDefined
|
| 95 |
+
GapRecord_ShapeMap.status = SpecDefined
|
| 96 |
+
GapRecord_ContractAlg.status = SpecDefined
|
| 97 |
+
GapRecord_Converge.status = SpecDefined
|
| 98 |
+
GapRecord_OptObj.status = SpecDefined
|
| 99 |
+
/* Undefined remains a taxonomy atom but is unused by production records */
|
| 100 |
+
some Undefined
|
| 101 |
+
some SpecDefined
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
assert A7_production_defined_records {
|
| 105 |
+
/* Sealed assert id A7 — PRODUCTION; all GapRecords SpecDefined */
|
| 106 |
+
A7_production_defined_records_present
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
/* ---- Sealed check commands (finite scopes) for PROPERTY_MAP / Verify ----
|
| 110 |
+
* Int bitwidth 8 so literals 63/64 are representable. Avoid heavy Int arith.
|
| 111 |
+
*/
|
| 112 |
+
|
| 113 |
+
/* A1–A6 sealed (keep working facts → UNSAT) */
|
| 114 |
+
check A1_P64_cardinality_and_distinct for 5 but exactly 1 P64Carrier, 8 PrimeLabel, 8 Int
|
| 115 |
+
|
| 116 |
+
assert A1b_P64_distinct_indices {
|
| 117 |
+
all disj p1, p2: P64Carrier.primes | p1.idx != p2.idx
|
| 118 |
+
}
|
| 119 |
+
check A1b_P64_distinct_indices for 5 but exactly 1 P64Carrier, 8 PrimeLabel, 8 Int
|
| 120 |
+
|
| 121 |
+
check A2_contractive_iff_gershgorin_bound for 5 but 8 Int
|
| 122 |
+
check A3_soft_project_when_q_over_margin for 5 but 8 Int
|
| 123 |
+
check A4_foundry_additive_only_if_Foundry_instance for 5 but exactly 1 ActiveInstance, 8 Int
|
| 124 |
+
check A5_PMAT_conservation_gated for 5 but 8 Int
|
| 125 |
+
check A6_guardian_reject_spectral_or_nonfinite for 5 but 8 Int
|
| 126 |
+
|
| 127 |
+
/* A7 production SpecDefined */
|
| 128 |
+
check A7_production_defined_records for 5 but 8 Int
|
| 129 |
+
|
| 130 |
+
/* Production P1–P8 */
|
| 131 |
+
check P1_carrier_linf_dim for 5 but 8 Int
|
| 132 |
+
check P2_tp_diag_spec_alpha for 5 but 8 Int
|
| 133 |
+
check P3_c_scale_or_id for 5 but 8 Int
|
| 134 |
+
check P4_lambda_m_scalar_bound for 5 but exactly 1 LambdaM, 8 Int
|
| 135 |
+
check P5_xi_uniform_affine for 5 but 8 Int
|
| 136 |
+
check P6_instance_bridge_morphism for 5 but 8 Int
|
| 137 |
+
check P7_optobj_residual for 5 but 8 Int
|
| 138 |
+
check P8_contractalg_gershgorin_then_c for 5 but 8 Int
|
| 139 |
+
|
| 140 |
+
/* Safety / pipeline asserts (production-updated INV_*) */
|
| 141 |
+
check INV_LambdaM_scalar_placeholder for 5 but exactly 1 LambdaM, 8 Int
|
| 142 |
+
check INV_step_shape_bridge_instance for 5 but 8 Int
|
| 143 |
+
check INV_prime_index_bounded_to_P64 for 5 but exactly 1 P64Carrier, 8 PrimeLabel, 8 Int
|
| 144 |
+
check INV_recursion_uses_prime_index for 5 but 8 PrimeLabel, 8 Int
|
| 145 |
+
check INV_contract_measure_non_increase for 5 but 8 Int
|
| 146 |
+
check INV_optimize_objective_residual for 5 but 8 Int
|
| 147 |
+
check INV_converge_hyps_production for 5 but 8 Int
|
| 148 |
+
check INV_evolution_total_on_State for 5 but 5 Time, 5 State, 8 Int
|
| 149 |
+
check INV_multimodal_tensor_wiring for 5 but 8 Int
|
| 150 |
+
check INV_evolve_total_State_reachable for 5 but 5 Time, 5 State, 8 Int
|
| 151 |
+
|
| 152 |
+
/* Optional runs: exhibit finite traces per instance (exploration, not theorems). */
|
| 153 |
+
pred show_hcalc_trace {
|
| 154 |
+
ActiveInstance.kind = HCALCInstance
|
| 155 |
+
some t: Time | some t.next and hcalc_nested_step[t, t.at, t.next.at]
|
| 156 |
+
}
|
| 157 |
+
run show_hcalc_trace for 4 but exactly 1 ActiveInstance, exactly 1 HCALCInstance,
|
| 158 |
+
3 Time, 3 State, 2 TpMap, 1 HCALC_Xi, 1 COp, 1 Intermediate, 8 Int
|
| 159 |
+
|
| 160 |
+
pred show_foundry_trace {
|
| 161 |
+
ActiveInstance.kind = FoundryInstance
|
| 162 |
+
some t: Time | some t.next and foundry_additive_step[t.at, t.next.at]
|
| 163 |
+
}
|
| 164 |
+
run show_foundry_trace for 4 but exactly 1 ActiveInstance, exactly 1 FoundryInstance,
|
| 165 |
+
3 Time, 3 State, 8 Int
|
alloy/INVARIANTS.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!--
|
| 2 |
+
Copyright (C) 2026 HCALC / Foundry J contributors
|
| 3 |
+
SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
-->
|
| 5 |
+
|
| 6 |
+
# HCALC Alloy — Invariant Inventory (PRODUCTION)
|
| 7 |
+
|
| 8 |
+
**Owner:** HCALC Alloy agent
|
| 9 |
+
**License:** AGPL-3.0-only
|
| 10 |
+
**Status:** PRODUCTION — domain Gap-* CLOSED per [`../spec/PRODUCTION.md`](../spec/PRODUCTION.md)
|
| 11 |
+
**Spec sources:** `PRODUCTION.md` (authoritative), `AXIOMS.md`, `COHERENCE.md`, `FOUNDRY_J_CROSSLINKS.md`
|
| 12 |
+
**Purpose:** Listable assert IDs for Verify `PROPERTY_MAP`. Provenance ∈ {`source-claim`, `SpecDefined`, `derived`}.
|
| 13 |
+
|
| 14 |
+
**Shape rule:** Foundry additive prop **39** ≠ HCALC nested form. Bridge via **InstanceBridge** morphism (NOT `rfl` / NOT Foundry39≡nested). NestedFaithful / FoundryAdditive stay DISTINCT from identity.
|
| 15 |
+
|
| 16 |
+
**Core witnesses (cite-only, not Alloy proofs):** `spectral_analyze`, `soft_project`, `q_estimate`, `P64`, `rec_step`, `synth_weights`.
|
| 17 |
+
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
## Sealed A1–A7 + production P1–P8
|
| 21 |
+
|
| 22 |
+
| ID | Assert name | Module | Provenance | Meaning |
|
| 23 |
+
|----|-------------|--------|------------|---------|
|
| 24 |
+
| A1 | `A1_P64_cardinality_and_distinct` | PrimeIndex | source-claim | `declaredCard=64`; distinct idx in range |
|
| 25 |
+
| A1b | `A1b_P64_distinct_indices` | HCALC | derived | Distinct indices among carrier primes |
|
| 26 |
+
| A2 | `A2_contractive_iff_gershgorin_bound` | Contract | source-claim | contractive ↔ Gershgorin / power-iter |
|
| 27 |
+
| A3 | `A3_soft_project_when_q_over_margin` | Contract | source-claim | Foundry *schedule* soft_project cite-only (prop 43) |
|
| 28 |
+
| A4 | `A4_foundry_additive_only_if_Foundry_instance` | Evolve | source-claim | Foundry additive only if instance=Foundry |
|
| 29 |
+
| A5 | `A5_PMAT_conservation_gated` | Contract | source-claim | PMAT conserved if used |
|
| 30 |
+
| A6 | `A6_guardian_reject_spectral_or_nonfinite` | Converge | source-claim | Guardian reject spectral≥1 / non-finite |
|
| 31 |
+
| A7 | `A7_production_defined_records` | HCALC | **SpecDefined** | All GapRecords status = SpecDefined |
|
| 32 |
+
| P1 | `P1_carrier_linf_dim` | State | SpecDefined | Carrier abstract dim n≥1, ℓ∞ |
|
| 33 |
+
| P2 | `P2_tp_diag_spec_alpha` | Transform | SpecDefined | Tp diagonal + SpecAlphaLaw α_j=1/(1+log p_{j mod 64}) |
|
| 34 |
+
| P3 | `P3_c_scale_or_id` | Contract | SpecDefined | C = Spec scale-or-id (NOT soft_project identity) |
|
| 35 |
+
| P4 | `P4_lambda_m_scalar_bound` | Stabilize | SpecDefined | Λm scalar ≥0; ‖Λm·(C∘Tp)‖≤1-ε flag |
|
| 36 |
+
| P5 | `P5_xi_uniform_affine` | Evolve | SpecDefined | Ξ(t,y)=ξ_t y+g_t; Uniform ξ=1 |
|
| 37 |
+
| P6 | `P6_instance_bridge_morphism` | Evolve | SpecDefined | bridgeMode=InstanceBridge; forbid identity |
|
| 38 |
+
| P7 | `P7_optobj_residual` | Optimize | SpecDefined | OptObj = residual |
|
| 39 |
+
| P8 | `P8_contractalg_gershgorin_then_c` | Contract | SpecDefined | ContractAlg = Gershgorin then scale-or-id C |
|
| 40 |
+
|
| 41 |
+
---
|
| 42 |
+
|
| 43 |
+
## Pipeline INV_* (production-updated)
|
| 44 |
+
|
| 45 |
+
| Assert ID | Module | Provenance | Brief |
|
| 46 |
+
|-----------|--------|------------|-------|
|
| 47 |
+
| INV_LambdaM_scalar_placeholder | Stabilize | SpecDefined | Λm lone scalar ≠ schedule vector |
|
| 48 |
+
| INV_step_shape_bridge_instance | Evolve | SpecDefined | InstanceBridge; claimsIdentity=0 |
|
| 49 |
+
| INV_prime_index_bounded_to_P64 | PrimeIndex | source-claim | Labels ⊆ P64 carrier |
|
| 50 |
+
| INV_recursion_uses_prime_index | Recursion | derived | TpMap.index in P64 or extension |
|
| 51 |
+
| INV_contract_measure_non_increase | Contract | SpecDefined | Measure non-increase on ContractLink |
|
| 52 |
+
| INV_optimize_objective_residual | Optimize | SpecDefined | Objective kind = ResidualObj |
|
| 53 |
+
| INV_converge_hyps_production | Converge | SpecDefined | Discharged ⇒ Hyp + residual |
|
| 54 |
+
| INV_evolution_total_on_State | State | source-claim | Every State at some Time |
|
| 55 |
+
| INV_evolve_total_State_reachable | Evolve | derived | Same via Evolve |
|
| 56 |
+
| INV_multimodal_tensor_wiring | Transform | derived | Multimodal → TensorSpace |
|
| 57 |
+
|
| 58 |
+
---
|
| 59 |
+
|
| 60 |
+
## Gap disposition (Alloy)
|
| 61 |
+
|
| 62 |
+
| GapId | Status | Alloy encoding |
|
| 63 |
+
|-------|--------|----------------|
|
| 64 |
+
| Gap-Carrier | **CLOSED** | CarrierSpec dimPositive=1, norm=LInf; P1 |
|
| 65 |
+
| Gap-Tp-from-P64 | **CLOSED** | TpMap isDiagonal=1, alphaLaw=SpecAlphaLaw; P2 |
|
| 66 |
+
| Gap-C-wrapper | **CLOSED** | COp mode=ScaleOrId; P3 (≠ SoftProject) |
|
| 67 |
+
| Gap-Λm-scalar | **CLOSED** | LambdaM scalar + nonNeg + opBoundOK; P4 |
|
| 68 |
+
| Gap-Ξ | **CLOSED** | UniformXi xiIsOne=1, HCALC_Xi isAffine; P5 |
|
| 69 |
+
| Gap-ShapeMap / L7 | **CLOSED** | ShapeMapConfig.bridgeMode=InstanceBridge; P6 |
|
| 70 |
+
| Gap-ContractAlg | **CLOSED** | GershgorinThenScaleOrId; P8 |
|
| 71 |
+
| Gap-Converge | **CLOSED** | ConvergenceHyp production; INV_converge |
|
| 72 |
+
| Gap-OptObj | **CLOSED** | ResidualObj; P7 |
|
| 73 |
+
| A7 | **SpecDefined** | All GapRecords SpecDefined |
|
| 74 |
+
|
| 75 |
+
**Infra gaps** (Gap-Real-arith, Gap-Foundry-*) are Lean stubs — not Alloy domain blockers.
|
| 76 |
+
|
| 77 |
+
**Leftover axiom-gap:** none for domain production path. SoftProject/A3 remains Foundry schedule cite-only (source-claim), intentionally distinct from Spec C.
|
| 78 |
+
|
| 79 |
+
---
|
| 80 |
+
|
| 81 |
+
## SoftProject vs Spec C (do not equate)
|
| 82 |
+
|
| 83 |
+
| Symbol | Role | Assert |
|
| 84 |
+
|--------|------|--------|
|
| 85 |
+
| `SoftProject` | Foundry schedule soft_project (prop **43**) cite-only | A3 |
|
| 86 |
+
| `COp` / `ScaleOrId` | Spec in-step C on state | P3 |
|
| 87 |
+
| Identity `C ≡ soft_project` | **FORBIDDEN** | — |
|
| 88 |
+
|
| 89 |
+
---
|
| 90 |
+
|
| 91 |
+
## Scopes
|
| 92 |
+
|
| 93 |
+
Default: `for 5` with **`8 Int`** bitwidth. P64 numeric values = Lean L1; Alloy checks `declaredCard=64` + distinct indices. Avoid heavy Int arithmetic (flags encode production bounds).
|
| 94 |
+
|
| 95 |
+
---
|
| 96 |
+
|
| 97 |
+
## Core Option B
|
| 98 |
+
|
| 99 |
+
Production Core implements `hcalc_step` only; `toFoundryStep` is cite-only diagnostic under InstanceBridge param table. Never claim `hcalcStep = FoundryStep`.
|
alloy/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!--
|
| 2 |
+
Copyright (C) 2026 HCALC contributors
|
| 3 |
+
SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
-->
|
| 5 |
+
|
| 6 |
+
# HCALC Alloy (PRODUCTION)
|
| 7 |
+
|
| 8 |
+
**Owner:** HCALC Alloy agent.
|
| 9 |
+
**License:** AGPL-3.0-only.
|
| 10 |
+
**Authority:** [`../spec/PRODUCTION.md`](../spec/PRODUCTION.md).
|
| 11 |
+
|
| 12 |
+
Encode sealed asserts **A1–A7** (A7 = SpecDefined) and production **P1–P8** from PRODUCTION.md.
|
| 13 |
+
|
| 14 |
+
ShapeMap = **InstanceBridge** morphism — do **not** equate Foundry additive prop 39 with HCALC nested form. Spec C = scale-or-id; SoftProject/A3 remains Foundry schedule soft_project cite-only.
|
| 15 |
+
|
| 16 |
+
## Run
|
| 17 |
+
|
| 18 |
+
```bash
|
| 19 |
+
PATH=/usr/bin:$PATH
|
| 20 |
+
./run.sh
|
| 21 |
+
# or:
|
| 22 |
+
java -jar tools/org.alloytools.alloy.dist.jar exec -f -o logs/alloy-out -t text -q HCALC.als
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
Requires Java 21+. Vendored JAR: `tools/org.alloytools.alloy.dist.jar` (AlloyTools 6.2).
|
alloy/logs/alloy-check.txt
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
=== HCALC Alloy PRODUCTION check 2026-10-07T09:41:38-07:00 PT ===
|
| 2 |
+
als: /workspace/hcalc/alloy/HCALC.als
|
| 3 |
+
alloy: 6.2.0
|
| 4 |
+
cite: PRODUCTION.md (C spec-adapt cousin!=43; InstanceBridge; alpha Spec)
|
| 5 |
+
note: per-command exec -t text; UNSAT = PASS for checks; SAT expected for optional runs
|
| 6 |
+
|
| 7 |
+
=== A1-A7 sealed PROPERTY_MAP (UNSAT = pass) ===
|
| 8 |
+
A1_P64_cardinality_and_distinct UNSAT (PASS)
|
| 9 |
+
A1b_P64_distinct_indices UNSAT (PASS)
|
| 10 |
+
A2_contractive_iff_gershgorin_bound UNSAT (PASS)
|
| 11 |
+
A3_soft_project_when_q_over_margin UNSAT (PASS)
|
| 12 |
+
A4_foundry_additive_only_if_Foundry_instance UNSAT (PASS)
|
| 13 |
+
A5_PMAT_conservation_gated UNSAT (PASS)
|
| 14 |
+
A6_guardian_reject_spectral_or_nonfinite UNSAT (PASS)
|
| 15 |
+
A7_production_defined_records UNSAT (PASS)
|
| 16 |
+
|
| 17 |
+
=== Production P1-P8 (UNSAT = pass) ===
|
| 18 |
+
P1_carrier_linf_dim UNSAT (PASS)
|
| 19 |
+
P2_tp_diag_spec_alpha UNSAT (PASS)
|
| 20 |
+
P3_c_scale_or_id UNSAT (PASS)
|
| 21 |
+
P4_lambda_m_scalar_bound UNSAT (PASS)
|
| 22 |
+
P5_xi_uniform_affine UNSAT (PASS)
|
| 23 |
+
P6_instance_bridge_morphism UNSAT (PASS)
|
| 24 |
+
P7_optobj_residual UNSAT (PASS)
|
| 25 |
+
P8_contractalg_gershgorin_then_c UNSAT (PASS)
|
| 26 |
+
|
| 27 |
+
=== INV_* checks (UNSAT = pass) ===
|
| 28 |
+
INV_LambdaM_scalar_placeholder UNSAT (PASS)
|
| 29 |
+
INV_step_shape_bridge_instance UNSAT (PASS)
|
| 30 |
+
INV_prime_index_bounded_to_P64 UNSAT (PASS)
|
| 31 |
+
INV_recursion_uses_prime_index UNSAT (PASS)
|
| 32 |
+
INV_contract_measure_non_increase UNSAT (PASS)
|
| 33 |
+
INV_optimize_objective_residual UNSAT (PASS)
|
| 34 |
+
INV_converge_hyps_production UNSAT (PASS)
|
| 35 |
+
INV_evolution_total_on_State UNSAT (PASS)
|
| 36 |
+
INV_multimodal_tensor_wiring UNSAT (PASS)
|
| 37 |
+
INV_evolve_total_State_reachable UNSAT (PASS)
|
| 38 |
+
|
| 39 |
+
=== optional runs (SAT = instance found, expected) ===
|
| 40 |
+
show_hcalc_trace SAT (instance)
|
| 41 |
+
show_foundry_trace SAT (instance)
|
| 42 |
+
|
| 43 |
+
=== summary ===
|
| 44 |
+
checks_UNSAT_PASS=26 checks_FAIL=0 runs_SAT=2
|
| 45 |
+
=== done ===
|
alloy/logs/alloy-commands.txt
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
0 . Check A1_P64_cardinality_and_distinct for 5 but 8 int, exactly 1 P64Carrier, 8 PrimeLabel
|
| 2 |
+
1 . Check A1b_P64_distinct_indices for 5 but 8 int, exactly 1 P64Carrier, 8 PrimeLabel
|
| 3 |
+
2 . Check A2_contractive_iff_gershgorin_bound for 5 but 8 int
|
| 4 |
+
3 . Check A3_soft_project_when_q_over_margin for 5 but 8 int
|
| 5 |
+
4 . Check A4_foundry_additive_only_if_Foundry_instance for 5 but 8 int, exactly 1 ActiveInstance
|
| 6 |
+
5 . Check A5_PMAT_conservation_gated for 5 but 8 int
|
| 7 |
+
6 . Check A6_guardian_reject_spectral_or_nonfinite for 5 but 8 int
|
| 8 |
+
7 . Check A7_gap_stub_definition_records for 5 but 8 int
|
| 9 |
+
8 . Check INV_LambdaM_scalar_placeholder for 5 but 8 int, exactly 1 LambdaM
|
| 10 |
+
9 . Check INV_step_shape_bridge_axiom_gap for 5 but 8 int
|
| 11 |
+
10. Check INV_prime_index_bounded_to_P64 for 5 but 8 int, exactly 1 P64Carrier, 8 PrimeLabel
|
| 12 |
+
11. Check INV_recursion_uses_prime_index for 5 but 8 int, 8 PrimeLabel
|
| 13 |
+
12. Check INV_contract_measure_non_increase for 5 but 8 int
|
| 14 |
+
13. Check INV_optimize_objective_axiom_gap for 5 but 8 int
|
| 15 |
+
14. Check INV_converge_hyps_axiom_gap for 5 but 8 int
|
| 16 |
+
15. Check INV_evolution_total_on_State for 5 but 8 int, 5 Time, 5 State
|
| 17 |
+
16. Check INV_multimodal_tensor_wiring for 5 but 8 int
|
| 18 |
+
17. Check INV_evolve_total_State_reachable for 5 but 8 int, 5 Time, 5 State
|
| 19 |
+
18. Run show_hcalc_trace for 4 but 8 int, exactly 1 ActiveInstance, exactly 1 HCALCInstance, 3 Time, 3 State, 2 TpMap, 1 HCALC_Xi, 1 COp, 1 Intermediate
|
| 20 |
+
19. Run show_foundry_trace for 4 but 8 int, exactly 1 ActiveInstance, exactly 1 FoundryInstance, 3 Time, 3 State
|
alloy/logs/java-install.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
--: line 6: java: command not found
|
alloy/modules/Contract.als
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright (C) 2026 HCALC / Foundry J contributors
|
| 3 |
+
* SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
*
|
| 5 |
+
* Module: Contract — production C = scale-or-id (Spec); ContractAlg = Gershgorin→C.
|
| 6 |
+
* SoftProject/A3 remains Foundry *schedule* soft_project cite-only (prop 43).
|
| 7 |
+
* DO NOT assert C = soft_project prop43.
|
| 8 |
+
* Cite: PRODUCTION.md §3 Gap-C-wrapper, §7 Gap-ContractAlg CLOSED.
|
| 9 |
+
* Provenance: SpecDefined (C, ContractAlg); source-claim (A2/A3/A5)
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
module modules/Contract
|
| 13 |
+
|
| 14 |
+
open modules/State
|
| 15 |
+
|
| 16 |
+
/* Provenance: source-claim — PROPERTIES 25 tier labels. */
|
| 17 |
+
abstract sig EpsilonTier {}
|
| 18 |
+
one sig T1, T2, T3, T4 extends EpsilonTier {}
|
| 19 |
+
|
| 20 |
+
sig Jacobian {}
|
| 21 |
+
|
| 22 |
+
sig SpectralBound {
|
| 23 |
+
of: one Jacobian,
|
| 24 |
+
belowMargin: lone EpsilonTier,
|
| 25 |
+
powerIterOK: lone EpsilonTier
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
/* A2 — contractive(J,ε) iff gershgorin(J) < 1-ε (optional power-iter).
|
| 29 |
+
* Provenance: source-claim — FOUNDRY_J_CROSSLINKS §3 A2 / props 33–37. */
|
| 30 |
+
pred contractive[j: Jacobian, e: EpsilonTier] {
|
| 31 |
+
some sb: SpectralBound | sb.of = j and (sb.belowMargin = e or sb.powerIterOK = e)
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
pred gershgorin_below[j: Jacobian, e: EpsilonTier] {
|
| 35 |
+
some sb: SpectralBound | sb.of = j and sb.belowMargin = e
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
fact fact_A2_contractive_iff {
|
| 39 |
+
all j: Jacobian, e: EpsilonTier |
|
| 40 |
+
contractive[j, e] iff
|
| 41 |
+
(gershgorin_below[j, e] or
|
| 42 |
+
(some sb: SpectralBound | sb.of = j and sb.powerIterOK = e))
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
assert A2_contractive_iff_gershgorin_bound {
|
| 46 |
+
/* Sealed assert id A2 — PROPERTY_MAP */
|
| 47 |
+
all j: Jacobian, e: EpsilonTier |
|
| 48 |
+
contractive[j, e] iff
|
| 49 |
+
(gershgorin_below[j, e] or
|
| 50 |
+
(some sb: SpectralBound | sb.of = j and sb.powerIterOK = e))
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
/* ---- SoftProject: Foundry *schedule* soft_project cite-only (prop 43 / A3) ----
|
| 54 |
+
* NOT identified with Spec C (scale-or-id on state). */
|
| 55 |
+
sig QBudget {
|
| 56 |
+
q: Int,
|
| 57 |
+
epsTier: one EpsilonTier,
|
| 58 |
+
overMargin: Int
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
sig SoftProject {
|
| 62 |
+
budget: one QBudget,
|
| 63 |
+
applied: Int
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
fact fact_A3_soft_project {
|
| 67 |
+
all sp: SoftProject |
|
| 68 |
+
(sp.budget.overMargin = 1) implies sp.applied = 1
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
assert A3_soft_project_when_q_over_margin {
|
| 72 |
+
/* Sealed assert id A3 — PROPERTY_MAP; Foundry schedule soft_project cite-only */
|
| 73 |
+
all sp: SoftProject |
|
| 74 |
+
(sp.budget.overMargin = 1) implies sp.applied = 1
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
/* ---- Production Spec C: scale-or-id on state ----
|
| 78 |
+
* C(x) = ((1-ε)/q)·x if q>1-ε else x. Provenance: SpecDefined — PRODUCTION §3.
|
| 79 |
+
* Distinct from SoftProject (Foundry schedule API). */
|
| 80 |
+
abstract sig CMode {}
|
| 81 |
+
one sig ScaleOrId extends CMode {}
|
| 82 |
+
|
| 83 |
+
sig COp {
|
| 84 |
+
mode: one CMode,
|
| 85 |
+
apply: State -> lone State
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
fact fact_P3_c_scale_or_id {
|
| 89 |
+
all c: COp | c.mode = ScaleOrId
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
pred c_scale_or_id_ok {
|
| 93 |
+
all c: COp | c.mode = ScaleOrId
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
assert P3_c_scale_or_id {
|
| 97 |
+
/* Production assert P3 — C = Spec scale-or-id (NOT soft_project identity) */
|
| 98 |
+
c_scale_or_id_ok
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
/* SoftProject and COp remain distinct families (no forced equality). */
|
| 102 |
+
fact fact_C_not_soft_project_identity {
|
| 103 |
+
/* Structural: SoftProject and COp are different sigs; no bridge equating them. */
|
| 104 |
+
all sp: SoftProject | some sp.budget
|
| 105 |
+
all c: COp | c.mode = ScaleOrId
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
/* ---- Production ContractAlg: Gershgorin then scale-or-id (Spec C) ----
|
| 109 |
+
* Provenance: SpecDefined — PRODUCTION.md §7. */
|
| 110 |
+
abstract sig ContractAlgKind {}
|
| 111 |
+
one sig GershgorinThenScaleOrId extends ContractAlgKind {}
|
| 112 |
+
|
| 113 |
+
one sig ProductionContractAlg {
|
| 114 |
+
kind: one ContractAlgKind
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
fact fact_P8_contractalg_gershgorin_then_c {
|
| 118 |
+
ProductionContractAlg.kind = GershgorinThenScaleOrId
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
pred contractalg_gershgorin_then_c_ok {
|
| 122 |
+
ProductionContractAlg.kind = GershgorinThenScaleOrId
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
assert P8_contractalg_gershgorin_then_c {
|
| 126 |
+
/* Production assert P8 — ContractAlg = Gershgorin → scale-or-id C */
|
| 127 |
+
contractalg_gershgorin_then_c_ok
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
/* Measure non-increase — relational order (no Int). */
|
| 131 |
+
one sig MeasureOrder {
|
| 132 |
+
nonIncrease: Measure -> Measure
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
fact fact_measure_order_reflexive {
|
| 136 |
+
all m: Measure | m in m.(MeasureOrder.nonIncrease)
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
pred measure_non_increase[s: State, sNext: State] {
|
| 140 |
+
all sm: StateMeasure, smNext: StateMeasure |
|
| 141 |
+
(sm.of = s and smNext.of = sNext) implies
|
| 142 |
+
smNext.m in sm.m.(MeasureOrder.nonIncrease)
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
sig ContractLink {
|
| 146 |
+
pre: one State,
|
| 147 |
+
post: one State
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
fact fact_measure_on_contract_links {
|
| 151 |
+
all cl: ContractLink | measure_non_increase[cl.pre, cl.post]
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
assert INV_contract_measure_non_increase {
|
| 155 |
+
all cl: ContractLink | measure_non_increase[cl.pre, cl.post]
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
/* A5 — PMAT conservation if used (optional/gated). */
|
| 159 |
+
sig PMATUsage {
|
| 160 |
+
conserved: Int
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
fact fact_A5_pmat_if_used {
|
| 164 |
+
all p: PMATUsage | p.conserved = 1
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
assert A5_PMAT_conservation_gated {
|
| 168 |
+
/* Sealed assert id A5 — PROPERTY_MAP */
|
| 169 |
+
all p: PMATUsage | p.conserved = 1
|
| 170 |
+
}
|
alloy/modules/Converge.als
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright (C) 2026 HCALC / Foundry J contributors
|
| 3 |
+
* SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
*
|
| 5 |
+
* Module: Converge — production Hyp ⇒ Banach + residual→0; Guardian A6.
|
| 6 |
+
* Cite: PRODUCTION.md §8 Gap-Converge CLOSED; FOUNDRY_J_CROSSLINKS §3 A6.
|
| 7 |
+
* Provenance: SpecDefined (converge hyp); source-claim (A6)
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
module modules/Converge
|
| 11 |
+
|
| 12 |
+
open modules/State
|
| 13 |
+
open modules/Contract
|
| 14 |
+
|
| 15 |
+
sig Residual {
|
| 16 |
+
of: one State,
|
| 17 |
+
belowTol: Int
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
/* Production ConvergenceHyp: under Spec Hyp, discharged with residual witness.
|
| 21 |
+
* Provenance: SpecDefined — PRODUCTION.md §8 (L5 dischargeable). */
|
| 22 |
+
sig ConvergenceHyp {
|
| 23 |
+
discharged: lone Int,
|
| 24 |
+
hypHolds: Int
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
pred convergence_hyps_production {
|
| 28 |
+
all h: ConvergenceHyp |
|
| 29 |
+
(h.discharged = 1 implies (h.hypHolds = 1 and some r: Residual | r.belowTol = 1))
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
fact fact_converge_hyps {
|
| 33 |
+
convergence_hyps_production
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
assert INV_converge_hyps_production {
|
| 37 |
+
/* INV_converge_hyps_production — Spec Hyp + residual (was axiom-gap) */
|
| 38 |
+
convergence_hyps_production
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
/* A6 — Guardian: reject spectral radius ≥ 1 or non-finite.
|
| 42 |
+
* Provenance: source-claim — FOUNDRY_J_CROSSLINKS §3 A6 / prop 55. */
|
| 43 |
+
abstract sig GuardianVerdict {}
|
| 44 |
+
one sig Accept, Reject extends GuardianVerdict {}
|
| 45 |
+
|
| 46 |
+
sig GuardianCheck {
|
| 47 |
+
subject: one State,
|
| 48 |
+
spectralRadiusGeOne: Int,
|
| 49 |
+
nonFinite: Int,
|
| 50 |
+
verdict: one GuardianVerdict
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
fact fact_A6_guardian {
|
| 54 |
+
all g: GuardianCheck |
|
| 55 |
+
(g.spectralRadiusGeOne = 1 or g.nonFinite = 1) implies g.verdict = Reject
|
| 56 |
+
all g: GuardianCheck |
|
| 57 |
+
(g.spectralRadiusGeOne = 0 and g.nonFinite = 0) implies g.verdict = Accept
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
assert A6_guardian_reject_spectral_or_nonfinite {
|
| 61 |
+
/* Sealed assert id A6 — PROPERTY_MAP */
|
| 62 |
+
all g: GuardianCheck |
|
| 63 |
+
((g.spectralRadiusGeOne = 1 or g.nonFinite = 1) implies g.verdict = Reject) and
|
| 64 |
+
((g.spectralRadiusGeOne = 0 and g.nonFinite = 0) implies g.verdict = Accept)
|
| 65 |
+
}
|
alloy/modules/Evolve.als
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright (C) 2026 HCALC / Foundry J contributors
|
| 3 |
+
* SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
*
|
| 5 |
+
* Module: Evolve — production Ξ + InstanceBridge ShapeMap (NOT Foundry39≡nested).
|
| 6 |
+
* Cite: PRODUCTION.md §5 Gap-Ξ, §6 Gap-ShapeMap / L7 CLOSED (InstanceBridge).
|
| 7 |
+
* Ξ(t,y)=ξ_t·y+g_t; Uniform ξ_t=1.
|
| 8 |
+
* bridgeMode = InstanceBridge; NestedFaithful/FoundryAdditive stay DISTINCT from identity.
|
| 9 |
+
* Provenance: SpecDefined
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
module modules/Evolve
|
| 13 |
+
|
| 14 |
+
open modules/State
|
| 15 |
+
open modules/PrimeIndex
|
| 16 |
+
open modules/Transform
|
| 17 |
+
open modules/Stabilize
|
| 18 |
+
open modules/Contract
|
| 19 |
+
open modules/Recursion
|
| 20 |
+
|
| 21 |
+
/* ---- Production Ξ: ξ_t·y + g_t, Uniform ξ=1 ----
|
| 22 |
+
* Provenance: SpecDefined — PRODUCTION.md §5. */
|
| 23 |
+
abstract sig XiScheduleKind {}
|
| 24 |
+
one sig UniformXi extends XiScheduleKind {}
|
| 25 |
+
|
| 26 |
+
one sig XiSchedule {
|
| 27 |
+
kind: one XiScheduleKind,
|
| 28 |
+
/* xiIsOne=1 encodes Uniform ξ_t = 1 for all t */
|
| 29 |
+
xiIsOne: Int
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
sig Kick {
|
| 33 |
+
/* g_t affine kick (default zero vector — presence optional) */
|
| 34 |
+
target: lone State
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
sig Intermediate {
|
| 38 |
+
fromState: one State,
|
| 39 |
+
viaTp: lone TpMap,
|
| 40 |
+
viaC: lone COp,
|
| 41 |
+
viaLambda: lone Scalar
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
/* HCALC Ξ(t, ·) — affine Uniform; NOT Foundry Ξ_t schedule weights. */
|
| 45 |
+
sig HCALC_Xi {
|
| 46 |
+
atTime: one Time,
|
| 47 |
+
map: Intermediate -> lone State,
|
| 48 |
+
/* isAffine=1 encodes Ξ(t,y)=ξ_t·y+g_t */
|
| 49 |
+
isAffine: Int,
|
| 50 |
+
schedule: one XiScheduleKind
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
fact fact_P5_xi_uniform_affine {
|
| 54 |
+
XiSchedule.kind = UniformXi
|
| 55 |
+
XiSchedule.xiIsOne = 1
|
| 56 |
+
all xi: HCALC_Xi |
|
| 57 |
+
xi.isAffine = 1 and xi.schedule = UniformXi
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
pred xi_uniform_affine_ok {
|
| 61 |
+
XiSchedule.kind = UniformXi
|
| 62 |
+
XiSchedule.xiIsOne = 1
|
| 63 |
+
all xi: HCALC_Xi |
|
| 64 |
+
xi.isAffine = 1 and xi.schedule = UniformXi
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
assert P5_xi_uniform_affine {
|
| 68 |
+
/* Production assert P5 — Ξ affine with Uniform ξ=1 */
|
| 69 |
+
xi_uniform_affine_ok
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
/* Foundry schedule weights — distinct sigs from HCALC_Xi / LambdaM. */
|
| 73 |
+
sig FoundryXiWeights {
|
| 74 |
+
schedule: one ScheduleVector
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
sig FoundryLambdaWeights {
|
| 78 |
+
schedule: one ScheduleVector
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
sig FoundryT {
|
| 82 |
+
apply: State -> lone State
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
sig FoundryG {
|
| 86 |
+
kick: lone State
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
/* Foundry additive Step (prop 39) — diagnostic / Foundry instance only. */
|
| 90 |
+
pred foundry_additive_step[x: State, xNext: State] {
|
| 91 |
+
some xi: FoundryXiWeights, lam: FoundryLambdaWeights, tn: FoundryT |
|
| 92 |
+
some xi.schedule and some lam.schedule and
|
| 93 |
+
(xNext in x.(tn.apply) or (some g: FoundryG | xNext = g.kick) or xNext = x)
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
/* HCALC nested: X' = Ξ(t, Λm · C[T_p(X)]) */
|
| 97 |
+
pred hcalc_nested_step[t: Time, X: State, XNext: State] {
|
| 98 |
+
some xi: HCALC_Xi, tp: TpMap, c: COp, mid: Intermediate |
|
| 99 |
+
xi.atTime = t and
|
| 100 |
+
xi.isAffine = 1 and
|
| 101 |
+
mid.fromState = X and
|
| 102 |
+
mid.viaTp = tp and
|
| 103 |
+
mid.viaC = c and
|
| 104 |
+
mid.viaLambda = LambdaM.scalar and
|
| 105 |
+
XNext in mid.(xi.map)
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
pred evolve_next[t: Time] {
|
| 109 |
+
some t.next implies (
|
| 110 |
+
(ActiveInstance.kind = HCALCInstance implies
|
| 111 |
+
hcalc_nested_step[t, t.at, t.next.at])
|
| 112 |
+
and
|
| 113 |
+
(ActiveInstance.kind = FoundryInstance implies
|
| 114 |
+
foundry_additive_step[t.at, t.next.at])
|
| 115 |
+
)
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
fact INV_evolve_respects_active_instance {
|
| 119 |
+
all t: Time | evolve_next[t]
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
/* A4 — Foundry additive ONLY when instance = Foundry; not equated to HCALC nested. */
|
| 123 |
+
pred A4_foundry_step_only_if_foundry_instance {
|
| 124 |
+
ActiveInstance.kind = FoundryInstance or ActiveInstance.kind = HCALCInstance
|
| 125 |
+
ActiveInstance.kind = FoundryInstance implies
|
| 126 |
+
(all t: Time | some t.next implies foundry_additive_step[t.at, t.next.at])
|
| 127 |
+
ActiveInstance.kind = HCALCInstance implies
|
| 128 |
+
(all t: Time | some t.next implies hcalc_nested_step[t, t.at, t.next.at])
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
assert A4_foundry_additive_only_if_Foundry_instance {
|
| 132 |
+
/* Sealed assert id A4 — PROPERTY_MAP */
|
| 133 |
+
A4_foundry_step_only_if_foundry_instance
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
/* ---- ShapeMap / L7: InstanceBridge morphism (NOT identity / NOT Foundry39≡nested) ----
|
| 137 |
+
* Provenance: SpecDefined — PRODUCTION.md §6.
|
| 138 |
+
* NestedFaithful / FoundryAdditive remain DISTINCT modes — never identity claims. */
|
| 139 |
+
abstract sig BridgeMode {}
|
| 140 |
+
one sig InstanceBridge, NestedFaithful, FoundryAdditive extends BridgeMode {}
|
| 141 |
+
|
| 142 |
+
/* Explicit morphism table under InstanceBridge (Option B production). */
|
| 143 |
+
one sig InstanceBridgeTable {
|
| 144 |
+
/* Parameter assignments (flags=1) — NOT symbol identities */
|
| 145 |
+
T_assigned_C_circ_Tp: Int,
|
| 146 |
+
Lambda_scalar_broadcast: Int,
|
| 147 |
+
Xi_from_hcalc_schedule: Int,
|
| 148 |
+
g_instance_param: Int,
|
| 149 |
+
/* claimsIdentity MUST stay 0 — forbid Foundry39 ≡ nested */
|
| 150 |
+
claimsIdentity: Int
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
one sig ShapeMapConfig {
|
| 154 |
+
bridgeMode: one BridgeMode
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
fact fact_P6_instance_bridge_morphism {
|
| 158 |
+
ShapeMapConfig.bridgeMode = InstanceBridge
|
| 159 |
+
InstanceBridgeTable.T_assigned_C_circ_Tp = 1
|
| 160 |
+
InstanceBridgeTable.Lambda_scalar_broadcast = 1
|
| 161 |
+
InstanceBridgeTable.Xi_from_hcalc_schedule = 1
|
| 162 |
+
InstanceBridgeTable.g_instance_param = 1
|
| 163 |
+
InstanceBridgeTable.claimsIdentity = 0
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
pred instance_bridge_morphism_ok {
|
| 167 |
+
ShapeMapConfig.bridgeMode = InstanceBridge
|
| 168 |
+
InstanceBridgeTable.T_assigned_C_circ_Tp = 1
|
| 169 |
+
InstanceBridgeTable.Lambda_scalar_broadcast = 1
|
| 170 |
+
InstanceBridgeTable.Xi_from_hcalc_schedule = 1
|
| 171 |
+
InstanceBridgeTable.g_instance_param = 1
|
| 172 |
+
InstanceBridgeTable.claimsIdentity = 0
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
assert P6_instance_bridge_morphism {
|
| 176 |
+
/* Production assert P6 — bridgeMode=InstanceBridge; forbid identity */
|
| 177 |
+
instance_bridge_morphism_ok
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
/* INV: bridge is InstanceBridge morphism, never silent identity. */
|
| 181 |
+
pred bridge_instance_not_identity {
|
| 182 |
+
ShapeMapConfig.bridgeMode = InstanceBridge
|
| 183 |
+
InstanceBridgeTable.claimsIdentity = 0
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
fact fact_bridge_production {
|
| 187 |
+
bridge_instance_not_identity
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
assert INV_step_shape_bridge_instance {
|
| 191 |
+
/* INV_step_shape_bridge_instance — production InstanceBridge (not axiom-gap) */
|
| 192 |
+
bridge_instance_not_identity
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
assert INV_evolve_total_State_reachable {
|
| 196 |
+
evolution_total_on_State
|
| 197 |
+
}
|
alloy/modules/Optimize.als
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright (C) 2026 HCALC / Foundry J contributors
|
| 3 |
+
* SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
*
|
| 5 |
+
* Module: Optimize — production OptObj = residual J.
|
| 6 |
+
* Cite: PRODUCTION.md §9 Gap-OptObj CLOSED.
|
| 7 |
+
* J(X) = ‖X − Ξ(t, Λm·C(Tp(X)))‖_∞; iterate to tol.
|
| 8 |
+
* Provenance: SpecDefined
|
| 9 |
+
*/
|
| 10 |
+
|
| 11 |
+
module modules/Optimize
|
| 12 |
+
|
| 13 |
+
open modules/State
|
| 14 |
+
|
| 15 |
+
abstract sig ObjKind {}
|
| 16 |
+
one sig ResidualObj extends ObjKind {}
|
| 17 |
+
|
| 18 |
+
sig Objective {
|
| 19 |
+
kind: one ObjKind,
|
| 20 |
+
score: State -> lone Int
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
fact fact_P7_optobj_residual {
|
| 24 |
+
all o: Objective | o.kind = ResidualObj
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
pred optobj_residual_ok {
|
| 28 |
+
all o: Objective | o.kind = ResidualObj
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
assert P7_optobj_residual {
|
| 32 |
+
/* Production assert P7 — OptObj = residual */
|
| 33 |
+
optobj_residual_ok
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
pred objective_is_residual {
|
| 37 |
+
all o: Objective | o.kind = ResidualObj
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
assert INV_optimize_objective_residual {
|
| 41 |
+
/* INV_optimize_objective_residual — production residual (was axiom-gap) */
|
| 42 |
+
objective_is_residual
|
| 43 |
+
}
|
alloy/modules/PrimeIndex.als
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright (C) 2026 HCALC / Foundry J contributors
|
| 3 |
+
* SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
*
|
| 5 |
+
* Module: PrimeIndex — P_64 prime-index integrity (Foundry prop 23).
|
| 6 |
+
* Cite: FOUNDRY_J_CROSSLINKS.md §1, §3 A1; Core witness: P64.
|
| 7 |
+
* GapId: Gap-Tp-from-P64 (COHERENCE.md)
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
module modules/PrimeIndex
|
| 11 |
+
|
| 12 |
+
/* Abstract prime labels. Numeric first-64 list is Lean L1 data — not invented here.
|
| 13 |
+
* Provenance: source-claim — FOUNDRY_J_CROSSLINKS prop 23 / A1. */
|
| 14 |
+
sig PrimeLabel {
|
| 15 |
+
idx: Int
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
/* P64Carrier: Foundry P_64 abstract. declaredCard = 64 encodes #P_64 without
|
| 19 |
+
* requiring 64 atoms in every small-scope check (full enum = Lean / large scope).
|
| 20 |
+
* Provenance: source-claim — PROPERTIES 23; #P_64 = 64.
|
| 21 |
+
* Core witness (intent, not Alloy proof): P64 */
|
| 22 |
+
one sig P64Carrier {
|
| 23 |
+
primes: set PrimeLabel,
|
| 24 |
+
declaredCard: Int
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
fact A1_declared_cardinality_64 {
|
| 28 |
+
/* Sealed A1 cardinality obligation as Int constant (scope-friendly). */
|
| 29 |
+
P64Carrier.declaredCard = 64
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
/* Enforce P64 index honesty in every instance so A1/A1b checks are UNSAT (pass).
|
| 33 |
+
* Numeric prime VALUES remain Lean L1; here we only constrain indices 0..63 distinct. */
|
| 34 |
+
fact A1_index_integrity {
|
| 35 |
+
all p: P64Carrier.primes | p.idx >= 0 and p.idx <= 63
|
| 36 |
+
all disj p1, p2: P64Carrier.primes | p1.idx != p2.idx
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
pred isPrimeLabel[p: PrimeLabel] {
|
| 40 |
+
p.idx >= 0 and p.idx <= 63
|
| 41 |
+
p in P64Carrier.primes
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
/* A1 — #P_64 = 64 (declaredCard) and elements have distinct indices in range.
|
| 45 |
+
* Provenance: source-claim — FOUNDRY_J_CROSSLINKS §3 A1 / prop 23. */
|
| 46 |
+
pred prime_index_integrity {
|
| 47 |
+
P64Carrier.declaredCard = 64
|
| 48 |
+
all disj p1, p2: P64Carrier.primes | p1.idx != p2.idx
|
| 49 |
+
all p: P64Carrier.primes | p.idx >= 0 and p.idx <= 63
|
| 50 |
+
all p: P64Carrier.primes | p in P64Carrier.primes
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
assert A1_P64_cardinality_and_distinct {
|
| 54 |
+
/* Sealed assert id A1 — PROPERTY_MAP */
|
| 55 |
+
prime_index_integrity
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
/* No silent infinite prime stream.
|
| 59 |
+
* Provenance: source-claim — FOUNDRY_J_CROSSLINKS §2 item 2.
|
| 60 |
+
* Assert id: INV_prime_index_bounded_to_P64 */
|
| 61 |
+
fact fact_primes_subset_carrier {
|
| 62 |
+
PrimeLabel = P64Carrier.primes
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
pred no_unbounded_prime_stream {
|
| 66 |
+
PrimeLabel = P64Carrier.primes
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
assert INV_prime_index_bounded_to_P64 {
|
| 70 |
+
no_unbounded_prime_stream
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
sig PrimeExtension {
|
| 74 |
+
extra: set PrimeLabel
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
/* Assert id: INV_extension_disjoint_or_empty */
|
| 78 |
+
fact INV_extension_disjoint_or_empty {
|
| 79 |
+
all e: PrimeExtension |
|
| 80 |
+
e.extra in P64Carrier.primes or
|
| 81 |
+
no (e.extra & P64Carrier.primes)
|
| 82 |
+
}
|
alloy/modules/Recursion.als
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright (C) 2026 HCALC / Foundry J contributors
|
| 3 |
+
* SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
*
|
| 5 |
+
* Module: Recursion — prime-indexed recursion (bounded, not unrestricted).
|
| 6 |
+
* Cite: FOUNDRY_J_CROSSLINKS.md §0; HCALC pipeline.
|
| 7 |
+
* GapId: Gap-Tp-from-P64 (COHERENCE.md)
|
| 8 |
+
* Core witnesses (intent): rec_step, P64.
|
| 9 |
+
*/
|
| 10 |
+
|
| 11 |
+
module modules/Recursion
|
| 12 |
+
|
| 13 |
+
open modules/State
|
| 14 |
+
open modules/PrimeIndex
|
| 15 |
+
open modules/Transform
|
| 16 |
+
|
| 17 |
+
pred recurse_via_Tp[t: Time, tp: TpMap, sNext: State] {
|
| 18 |
+
tp.index in P64Carrier.primes
|
| 19 |
+
sNext in (t.at).(tp.apply)
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
/* Assert id: INV_bounded_recursion_depth */
|
| 23 |
+
fact INV_bounded_recursion_depth {
|
| 24 |
+
all t: Time | lone t.next
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
assert INV_recursion_uses_prime_index {
|
| 28 |
+
/* INV_recursion_uses_prime_index */
|
| 29 |
+
all tp: TpMap | tp.index in P64Carrier.primes or
|
| 30 |
+
(some e: PrimeExtension | tp.index in e.extra)
|
| 31 |
+
}
|
alloy/modules/Stabilize.als
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright (C) 2026 HCALC / Foundry J contributors
|
| 3 |
+
* SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
*
|
| 5 |
+
* Module: Stabilize — production Λm scalar ≥0 with op-bound ‖Λm·(C∘Tp)‖≤1-ε.
|
| 6 |
+
* Cite: PRODUCTION.md §4 Gap-Λm-scalar CLOSED.
|
| 7 |
+
* Provenance: SpecDefined
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
module modules/Stabilize
|
| 11 |
+
|
| 12 |
+
open modules/State
|
| 13 |
+
|
| 14 |
+
sig Scalar {}
|
| 15 |
+
|
| 16 |
+
/* Λm — lone scalar (NOT Foundry lambda_schedule vector).
|
| 17 |
+
* nonNeg=1 encodes Λm≥0; opBoundOK=1 encodes ‖Λm·(C∘Tp)‖_op ≤ 1-ε.
|
| 18 |
+
* Provenance: SpecDefined — PRODUCTION.md §4. */
|
| 19 |
+
one sig LambdaM {
|
| 20 |
+
scalar: one Scalar,
|
| 21 |
+
nonNeg: Int,
|
| 22 |
+
opBoundOK: Int
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
/* Foundry-style schedule vector — distinct from LambdaM. */
|
| 26 |
+
sig ScheduleVector {
|
| 27 |
+
w0: lone Scalar,
|
| 28 |
+
w1: lone Scalar
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
fact fact_LambdaM_not_schedule_vector {
|
| 32 |
+
some LambdaM.scalar
|
| 33 |
+
no sv: ScheduleVector |
|
| 34 |
+
LambdaM.scalar = sv.w0 and LambdaM.scalar = sv.w1 and some sv.w0 and some sv.w1
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
pred LambdaM_is_scalar_not_schedule {
|
| 38 |
+
some LambdaM.scalar
|
| 39 |
+
no sv: ScheduleVector |
|
| 40 |
+
LambdaM.scalar = sv.w0 and LambdaM.scalar = sv.w1 and some sv.w0 and some sv.w1
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
assert INV_LambdaM_scalar_placeholder {
|
| 44 |
+
/* INV_LambdaM_scalar_placeholder — Λm scalar ≠ schedule vector */
|
| 45 |
+
LambdaM_is_scalar_not_schedule
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
fact INV_LambdaM_scalar_not_schedule {
|
| 49 |
+
LambdaM_is_scalar_not_schedule
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
/* Production: Λm ≥ 0 and op-bound flag. */
|
| 53 |
+
fact fact_P4_lambda_m_scalar_bound {
|
| 54 |
+
LambdaM.nonNeg = 1
|
| 55 |
+
LambdaM.opBoundOK = 1
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
pred lambda_m_scalar_bound_ok {
|
| 59 |
+
some LambdaM.scalar
|
| 60 |
+
LambdaM.nonNeg = 1
|
| 61 |
+
LambdaM.opBoundOK = 1
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
assert P4_lambda_m_scalar_bound {
|
| 65 |
+
/* Production assert P4 — Λm scalar ≥0 with ‖Λm·(C∘Tp)‖≤1-ε flag */
|
| 66 |
+
lambda_m_scalar_bound_ok
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
sig Stabilized {
|
| 70 |
+
source: one State,
|
| 71 |
+
via: lone Scalar
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
fact INV_stabilize_uses_LambdaM_scalar {
|
| 75 |
+
all st: Stabilized | no st.via or st.via = LambdaM.scalar
|
| 76 |
+
}
|
alloy/modules/State.als
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright (C) 2026 HCALC / Foundry J contributors
|
| 3 |
+
* SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
*
|
| 5 |
+
* Module: State — production Carrier Fin n → ℝ with ℓ∞ (abstract).
|
| 6 |
+
* Cite: PRODUCTION.md §1 Gap-Carrier CLOSED; FOUNDRY_J_CROSSLINKS §0–§2.
|
| 7 |
+
* Provenance: SpecDefined
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
module modules/State
|
| 11 |
+
|
| 12 |
+
/* Discrete evolution carrier (abstract atoms; dim/norm in CarrierSpec). */
|
| 13 |
+
sig State {}
|
| 14 |
+
|
| 15 |
+
/* Finite time atoms for bounded evolution. */
|
| 16 |
+
sig Time {
|
| 17 |
+
next: lone Time,
|
| 18 |
+
at: one State
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
/* Total order spine on Time: linear chain, unique start.
|
| 22 |
+
* Provenance: derived — finite-scope safety for evolution. */
|
| 23 |
+
fact INV_time_linear_chain {
|
| 24 |
+
one t: Time | no t.~next
|
| 25 |
+
all t: Time | lone t.next
|
| 26 |
+
all disj t1, t2: Time | t1 in t2.^next or t2 in t1.^next
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
/* Evolution totality: every State is witnessed at some Time. */
|
| 30 |
+
fact fact_evolution_total_on_State {
|
| 31 |
+
all s: State | some t: Time | t.at = s
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
pred evolution_total_on_State {
|
| 35 |
+
all s: State | some t: Time | t.at = s
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
assert INV_evolution_total_on_State {
|
| 39 |
+
evolution_total_on_State
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
/* Instance tag: Foundry vs HCALC-native step shape (do not equate silently). */
|
| 43 |
+
abstract sig InstanceKind {}
|
| 44 |
+
one sig FoundryInstance, HCALCInstance extends InstanceKind {}
|
| 45 |
+
|
| 46 |
+
one sig ActiveInstance {
|
| 47 |
+
kind: one InstanceKind
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
/* ---- Production Carrier: abstract dim n≥1, ℓ∞ ----
|
| 51 |
+
* Provenance: SpecDefined — PRODUCTION.md §1.
|
| 52 |
+
* Numeric ℝ^n lives in Lean; Alloy encodes dim≥1 + LInf flags (no heavy Int arith). */
|
| 53 |
+
abstract sig NormKind {}
|
| 54 |
+
one sig LInf extends NormKind {}
|
| 55 |
+
|
| 56 |
+
one sig CarrierSpec {
|
| 57 |
+
/* dimPositive=1 encodes n≥1 (avoid bitblast of concrete n). */
|
| 58 |
+
dimPositive: Int,
|
| 59 |
+
norm: one NormKind
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
fact fact_P1_carrier_production {
|
| 63 |
+
CarrierSpec.dimPositive = 1
|
| 64 |
+
CarrierSpec.norm = LInf
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
pred carrier_linf_dim_ok {
|
| 68 |
+
CarrierSpec.dimPositive = 1
|
| 69 |
+
CarrierSpec.norm = LInf
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
assert P1_carrier_linf_dim {
|
| 73 |
+
/* Production assert P1 — Carrier abstract dim n≥1, ℓ∞ */
|
| 74 |
+
carrier_linf_dim_ok
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
/* Measure atom — no Int payload (Int bitblast hangs checks). */
|
| 78 |
+
sig Measure {}
|
| 79 |
+
|
| 80 |
+
sig StateMeasure {
|
| 81 |
+
of: one State,
|
| 82 |
+
m: one Measure
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
fact INV_state_measure_functional {
|
| 86 |
+
all s: State | lone sm: StateMeasure | sm.of = s
|
| 87 |
+
}
|
alloy/modules/Transform.als
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright (C) 2026 HCALC / Foundry J contributors
|
| 3 |
+
* SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
*
|
| 5 |
+
* Module: Transform — production T_p = diag(α), α_j = 1/(1+log p_{j mod 64}).
|
| 6 |
+
* Cite: PRODUCTION.md §2 Gap-Tp-from-P64 CLOSED.
|
| 7 |
+
* Numeric log not required in Alloy — SpecAlphaLaw flag + diagonal Tp.
|
| 8 |
+
* Provenance: SpecDefined
|
| 9 |
+
*/
|
| 10 |
+
|
| 11 |
+
module modules/Transform
|
| 12 |
+
|
| 13 |
+
open modules/State
|
| 14 |
+
open modules/PrimeIndex
|
| 15 |
+
|
| 16 |
+
sig MultimodalInput {
|
| 17 |
+
encodes: one State
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
sig TensorSpace {
|
| 21 |
+
support: set State
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
/* α law kind — Spec law α_j=1/(1+log p_{j mod 64}) encoded as SpecAlphaLaw. */
|
| 25 |
+
abstract sig AlphaLawKind {}
|
| 26 |
+
one sig SpecAlphaLaw extends AlphaLawKind {}
|
| 27 |
+
|
| 28 |
+
/* T_p — diagonal prime-indexed map under SpecAlphaLaw.
|
| 29 |
+
* Provenance: SpecDefined — PRODUCTION.md §2.
|
| 30 |
+
* (Tp x)_j = α_j · x_j; φ = id on coordinates. */
|
| 31 |
+
sig TpMap {
|
| 32 |
+
index: one PrimeLabel,
|
| 33 |
+
apply: State -> lone State,
|
| 34 |
+
/* isDiagonal=1 encodes diag(α) action */
|
| 35 |
+
isDiagonal: Int,
|
| 36 |
+
alphaLaw: one AlphaLawKind
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
fact fact_P2_tp_diag_spec_alpha {
|
| 40 |
+
all tp: TpMap |
|
| 41 |
+
tp.isDiagonal = 1 and tp.alphaLaw = SpecAlphaLaw
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
pred tp_diag_spec_alpha_ok {
|
| 45 |
+
all tp: TpMap |
|
| 46 |
+
tp.isDiagonal = 1 and tp.alphaLaw = SpecAlphaLaw
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
assert P2_tp_diag_spec_alpha {
|
| 50 |
+
/* Production assert P2 — Tp diagonal + SpecAlphaLaw */
|
| 51 |
+
tp_diag_spec_alpha_ok
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
fact INV_Tp_index_in_P64_or_extension {
|
| 55 |
+
all tp: TpMap |
|
| 56 |
+
tp.index in P64Carrier.primes or
|
| 57 |
+
(some e: PrimeExtension | tp.index in e.extra)
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
fact INV_Tp_unique_per_index {
|
| 61 |
+
all disj a, b: TpMap | a.index != b.index
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
pred multimodal_wired {
|
| 65 |
+
all m: MultimodalInput | some ts: TensorSpace | m.encodes in ts.support
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
fact fact_multimodal_wired {
|
| 69 |
+
multimodal_wired
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
assert INV_multimodal_tensor_wiring {
|
| 73 |
+
multimodal_wired
|
| 74 |
+
}
|
alloy/run-production.sh
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# Copyright (C) 2026 HCALC contributors
|
| 3 |
+
# SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
# Per-command Alloy checks. Parse CLI stdout: "N. check NAME ... UNSAT|SAT"
|
| 5 |
+
set -euo pipefail
|
| 6 |
+
ROOT="$(cd "$(dirname "$0")" && pwd)"
|
| 7 |
+
JAR="$ROOT/tools/org.alloytools.alloy.dist.jar"
|
| 8 |
+
ALS="$ROOT/HCALC.als"
|
| 9 |
+
OUT="$ROOT/logs/per-check-prod"
|
| 10 |
+
LOG="$ROOT/logs/alloy-check.txt"
|
| 11 |
+
mkdir -p "$OUT" "$ROOT/logs"
|
| 12 |
+
|
| 13 |
+
TS="$(date -Iseconds)"
|
| 14 |
+
{
|
| 15 |
+
echo "=== HCALC Alloy PRODUCTION check ${TS} PT ==="
|
| 16 |
+
echo "als: $ALS"
|
| 17 |
+
java -jar "$JAR" version || true
|
| 18 |
+
echo
|
| 19 |
+
|
| 20 |
+
mapfile -t LINES < <(java -jar "$JAR" commands "$ALS" 2>/dev/null)
|
| 21 |
+
|
| 22 |
+
PASS=0; FAIL=0; RUN_OK=0; RUN_BAD=0
|
| 23 |
+
|
| 24 |
+
echo "=== checks (UNSAT = PASS) + runs (SAT = instance) ==="
|
| 25 |
+
for line in "${LINES[@]}"; do
|
| 26 |
+
KIND=""; CMD=""
|
| 27 |
+
if [[ "$line" =~ Check[[:space:]]+([A-Za-z0-9_]+) ]]; then
|
| 28 |
+
KIND=check; CMD="${BASH_REMATCH[1]}"
|
| 29 |
+
elif [[ "$line" =~ Run[[:space:]]+([A-Za-z0-9_]+) ]]; then
|
| 30 |
+
KIND=run; CMD="${BASH_REMATCH[1]}"
|
| 31 |
+
else
|
| 32 |
+
continue
|
| 33 |
+
fi
|
| 34 |
+
o="$OUT/$CMD"
|
| 35 |
+
rm -rf "$o"
|
| 36 |
+
set +e
|
| 37 |
+
# IMPORTANT: do not use -q; result is printed on stdout
|
| 38 |
+
out=$(java -jar "$JAR" exec -f -o "$o" -t text -c "$CMD" "$ALS" 2>&1)
|
| 39 |
+
rc=$?
|
| 40 |
+
set -e
|
| 41 |
+
# Match Alloy CLI summary line
|
| 42 |
+
summary=$(echo "$out" | rg -o '[0-9]+\.\s+(check|run)\s+\S+.*' | tail -1 || true)
|
| 43 |
+
if echo "$out" | rg -q '\bUNSAT\b'; then
|
| 44 |
+
res=UNSAT
|
| 45 |
+
elif echo "$out" | rg -q '\bSAT\b'; then
|
| 46 |
+
res=SAT
|
| 47 |
+
else
|
| 48 |
+
res="UNKNOWN(rc=$rc)"
|
| 49 |
+
fi
|
| 50 |
+
|
| 51 |
+
if [[ "$KIND" == check ]]; then
|
| 52 |
+
if [[ "$res" == UNSAT ]]; then
|
| 53 |
+
printf '%-54s UNSAT (PASS)\n' "check $CMD"
|
| 54 |
+
PASS=$((PASS+1))
|
| 55 |
+
else
|
| 56 |
+
printf '%-54s %s (FAIL)\n' "check $CMD" "$res"
|
| 57 |
+
echo "$out" | tail -5
|
| 58 |
+
FAIL=$((FAIL+1))
|
| 59 |
+
fi
|
| 60 |
+
else
|
| 61 |
+
if [[ "$res" == SAT ]]; then
|
| 62 |
+
printf '%-54s SAT (instance)\n' "run $CMD"
|
| 63 |
+
RUN_OK=$((RUN_OK+1))
|
| 64 |
+
else
|
| 65 |
+
printf '%-54s %s\n' "run $CMD" "$res"
|
| 66 |
+
RUN_BAD=$((RUN_BAD+1))
|
| 67 |
+
fi
|
| 68 |
+
fi
|
| 69 |
+
done
|
| 70 |
+
|
| 71 |
+
echo
|
| 72 |
+
echo "=== summary ==="
|
| 73 |
+
echo "checks_UNSAT_PASS=$PASS checks_FAIL=$FAIL runs_SAT=$RUN_OK runs_other=$RUN_BAD"
|
| 74 |
+
echo "=== done ==="
|
| 75 |
+
[[ "$FAIL" -eq 0 ]]
|
| 76 |
+
} 2>&1 | tee "$LOG"
|
alloy/run.sh
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# Copyright (C) 2026 HCALC contributors
|
| 3 |
+
# SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
set -euo pipefail
|
| 5 |
+
ROOT="$(cd "$(dirname "$0")" && pwd)"
|
| 6 |
+
JAR="$ROOT/tools/org.alloytools.alloy.dist.jar"
|
| 7 |
+
ALS="$ROOT/HCALC.als"
|
| 8 |
+
OUT="$ROOT/logs/alloy-out"
|
| 9 |
+
LOG="$ROOT/logs/alloy-check.txt"
|
| 10 |
+
mkdir -p "$ROOT/logs"
|
| 11 |
+
if ! command -v java >/dev/null 2>&1; then
|
| 12 |
+
echo "Java missing; cannot run Alloy CLI" | tee "$LOG"
|
| 13 |
+
exit 1
|
| 14 |
+
fi
|
| 15 |
+
if [[ ! -f "$JAR" ]]; then
|
| 16 |
+
echo "Missing Alloy jar at $JAR" | tee "$LOG"
|
| 17 |
+
exit 1
|
| 18 |
+
fi
|
| 19 |
+
{
|
| 20 |
+
echo "=== HCALC Alloy check $(date -Iseconds) ==="
|
| 21 |
+
echo "als: $ALS"
|
| 22 |
+
java -jar "$JAR" version || true
|
| 23 |
+
echo
|
| 24 |
+
echo "=== commands ==="
|
| 25 |
+
java -jar "$JAR" commands "$ALS" || true
|
| 26 |
+
echo
|
| 27 |
+
echo "=== exec (all commands) ==="
|
| 28 |
+
rm -rf "$OUT"
|
| 29 |
+
java -jar "$JAR" exec -f -o "$OUT" -t text -q "$ALS" || true
|
| 30 |
+
echo
|
| 31 |
+
if [[ -f "$OUT/receipt.json" ]]; then
|
| 32 |
+
echo "=== receipt.json (truncated) ==="
|
| 33 |
+
head -c 50000 "$OUT/receipt.json"; echo
|
| 34 |
+
fi
|
| 35 |
+
find "$OUT" -type f 2>/dev/null | head -80 || true
|
| 36 |
+
echo "=== done ==="
|
| 37 |
+
} 2>&1 | tee "$LOG"
|
docs/.gitkeep
ADDED
|
File without changes
|
docs/INVARIANTS.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!--
|
| 2 |
+
Copyright (C) 2026 HCALC contributors
|
| 3 |
+
SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
-->
|
| 5 |
+
|
| 6 |
+
# HCALC Invariant Inventory — Alloy ↔ Lean
|
| 7 |
+
|
| 8 |
+
Maps every Alloy `assert` / `fact` / sealed check to Lean status (theorem vs axiom vs deferred).
|
| 9 |
+
Sources: `alloy/hcalc/**/*.als`, `spec/COHERENCE.md`, `spec/AXIOMS.md`, `spec/FOUNDRY_J_CROSSLINKS.md`.
|
| 10 |
+
|
| 11 |
+
Provenance: `source-claim` | `axiom-gap` | `derived`.
|
| 12 |
+
|
| 13 |
+
| Alloy ID | Informal statement | Provenance | Lean status |
|
| 14 |
+
|----------|-------------------|------------|-------------|
|
| 15 |
+
| **A1** `A1_P64_cardinality_and_distinct` | `#P_64=64`, distinct indices | source-claim | **L1 theorem** `P64List_length` (+ data) |
|
| 16 |
+
| **A1b** `A1b_P64_distinct_indices` | Distinct idx among carrier primes | derived | type-level `Fin 64` + list data |
|
| 17 |
+
| **A2** `A2_contractive_iff_gershgorin_bound` | contractive ↔ Gershgorin < 1-ε (+ power-iter) | source-claim | **L2** abstract `contractiveG` ↔ `GershgorinBelowMargin` (no matrix arith) |
|
| 18 |
+
| **A3** `A3_soft_project_when_q_over_margin` | soft-project when q > 1-ε | source-claim | **L4** `softProject` control flow |
|
| 19 |
+
| **A4** `A4_foundry_additive_only_if_Foundry_instance` | Foundry additive only if instance=Foundry | source-claim | **L3** `FoundryStep` def; tagged `StepForm` |
|
| 20 |
+
| **A5** `A5_PMAT_conservation_gated` | PMAT conservation if used | source-claim | not yet in Lean (optional surface) |
|
| 21 |
+
| **A6** `A6_guardian_reject_spectral_or_nonfinite` | reject ρ≥1 or non-finite | source-claim | not yet in Lean |
|
| 22 |
+
| **A7** `A7_gap_stub_definition_records` | definition-record presence for Λm, Ξ, C, Tp | axiom-gap | **L6 axioms** (named) |
|
| 23 |
+
| `INV_LambdaM_scalar_placeholder` | Λm lone scalar ≠ schedule vector | axiom-gap / G-Lm | **L6** `LambdaM : Nat` vs `ScheduleWeights` |
|
| 24 |
+
| `INV_step_shape_bridge_axiom_gap` | no silent Foundry↔HCALC equation | axiom-gap / G-SHAPE | **L7 deferred**; `StepForm` tags |
|
| 25 |
+
| `INV_prime_index_bounded_to_P64` | no unbounded prime stream | source-claim | `Tp : Fin 64 → …` |
|
| 26 |
+
| `INV_bounded_recursion_depth` | finite Time / lone next | derived | `iterateNested` on `Nat` |
|
| 27 |
+
| `INV_contract_measure_non_increase` | measure non-increase under Contract | axiom-gap / G-C | open (needs Gap-ContractAlg) |
|
| 28 |
+
| `INV_optimize_objective_axiom_gap` | objective underspecified | axiom-gap | open Gap-OptObj |
|
| 29 |
+
| `INV_converge_hyps_axiom_gap` | no Banach from narrative alone | axiom-gap | **L5** hypothesis skeleton only |
|
| 30 |
+
| `INV_evolve_respects_active_instance` | evolve matches ActiveInstance | derived | instance via `StepForm` |
|
| 31 |
+
| `INV_evolution_total_on_State` | every State on some Time | source-claim | `hcalcNestedStep_total` / `foundryStep_total` |
|
| 32 |
+
| `INV_Tp_index_in_P64_or_extension` | Tp index honesty | source-claim / G-Tp | `Fin 64` index |
|
| 33 |
+
| `INV_Tp_unique_per_index` | unique TpMap per index | derived | — |
|
| 34 |
+
| `INV_state_measure_functional` | lone measure per State | derived | — |
|
| 35 |
+
| `INV_stabilize_uses_LambdaM_scalar` | stabilize via Λm scalar | axiom-gap | nested uses `LambdaM` |
|
| 36 |
+
| `INV_time_linear_chain` | Time linear | derived | — |
|
| 37 |
+
| `INV_multimodal_tensor_wiring` | multimodal↔tensor wiring | derived | — |
|
| 38 |
+
| `INV_recursion_uses_prime_index` | recursion uses prime index | source-claim | `Tp` / `P64` |
|
| 39 |
+
| `INV_evolve_total_State_reachable` | evolve total | source-claim | totals above |
|
| 40 |
+
| `INV_extension_disjoint_or_empty` | prime extension honesty | derived | — |
|
| 41 |
+
|
| 42 |
+
**Invariant count (Alloy sealed asserts + facts listed):** 25 rows above (A1–A7 + A1b + named INVs).
|
| 43 |
+
|
| 44 |
+
## Alias GapIds (steering)
|
| 45 |
+
|
| 46 |
+
| Alias | Spec GapId | Role |
|
| 47 |
+
|-------|------------|------|
|
| 48 |
+
| **G-SHAPE** | Gap-ShapeMap | Nested ≠ additive; no silent identify |
|
| 49 |
+
| **G-Lm** | Gap-Λm-scalar | No scalar Λm verb; lambda_schedule is vector |
|
| 50 |
+
| **G-C** | Gap-C-wrapper | spectral_analyze classifies; not C[·] |
|
| 51 |
+
| **G-Tp** | Gap-Tp-from-P64 | No T_p from P64/PrimeMask yet |
|
docs/REMAINING.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!--
|
| 2 |
+
Copyright (C) 2026 HCALC contributors
|
| 3 |
+
SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
-->
|
| 5 |
+
|
| 6 |
+
# Remaining Lean work after L1–L6 axioms
|
| 7 |
+
|
| 8 |
+
What is left **after** accepting L6 opaque symbols. No fake proof claims.
|
| 9 |
+
|
| 10 |
+
## Deferred / blocked
|
| 11 |
+
|
| 12 |
+
| Item | Why blocked |
|
| 13 |
+
|------|-------------|
|
| 14 |
+
| **L7** bridge `HCALCStep ≃ FoundryStep` | Requires Spec discharge of **G-SHAPE / Gap-ShapeMap**; additive ≠ nested |
|
| 15 |
+
| Unique Banach fixed point (**L5** full) | Narrative PROPERTIES **41**; needs discharged `q < 1-ε` + complete metric structure |
|
| 16 |
+
| ℝ-valued Λm / spectral radius theorems | No Mathlib in first cut; Nat proxies only |
|
| 17 |
+
| Matrix Gershgorin proof of **A2** | Needs Jacobian carrier + Mathlib analysis |
|
| 18 |
+
| PMAT conservation (**A5**) in Lean | Optional Foundry surface; not HCALC-core |
|
| 19 |
+
| Guardian (**A6**) in Lean | Prop 55; Core verb may be absent |
|
| 20 |
+
|
| 21 |
+
## Open research (Spec must define before Lean can prove)
|
| 22 |
+
|
| 23 |
+
1. Explicit scalar Λm and stabilizing range (**G-Lm**).
|
| 24 |
+
2. Formal Ξ(t,·) operator laws (**Gap-Ξ**).
|
| 25 |
+
3. Tensor / Banach / F_p carrier for X_t (**Gap-Carrier**).
|
| 26 |
+
4. Convergence conditions for **nested** form (**Gap-Converge**).
|
| 27 |
+
5. In-step contraction algorithm realizing C (**G-C**, **Gap-ContractAlg**).
|
| 28 |
+
6. Optimization objective J (**Gap-OptObj**).
|
| 29 |
+
7. Construction of T_p from P64 / PrimeMask / PMAT (**G-Tp**).
|
| 30 |
+
8. Shape-map morphism nested ↔ additive (**G-SHAPE**).
|
| 31 |
+
|
| 32 |
+
## Safe next Lean increments (no invention)
|
| 33 |
+
|
| 34 |
+
- Port A5/A6 as optional gated modules once Spec marks them in-scope.
|
| 35 |
+
- Replace Nat proxies with Mathlib ℝ **after** Spec freezes types.
|
| 36 |
+
- Prove list properties of `P64List` (pairwise distinct, true primality) as data lemmas.
|
| 37 |
+
- Strengthen `iterateNested` induction lemmas under explicit measure hypotheses (when Gap-ContractAlg closes).
|
j/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!--
|
| 2 |
+
Copyright (C) 2026 HCALC contributors
|
| 3 |
+
SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
-->
|
| 5 |
+
|
| 6 |
+
# HCALC J production Core
|
| 7 |
+
|
| 8 |
+
**Owner:** Foundry J Core (implements) / HCALC Spec (`../spec/PRODUCTION.md`).
|
| 9 |
+
**Path (authoritative):** `/workspace/hcalc/j/`
|
| 10 |
+
**Locale:** `hcalc` (load `hcalc.ijs`).
|
| 11 |
+
|
| 12 |
+
## Verbs (PRODUCTION.md)
|
| 13 |
+
|
| 14 |
+
| Verb | Role |
|
| 15 |
+
|------|------|
|
| 16 |
+
| `tp_from_p64` | Diagonal Tp from P64 α (**spec-def**) |
|
| 17 |
+
| `c_wrap` | State scale-or-id (**spec-adapt**; ≠ Foundry soft_project **43**) |
|
| 18 |
+
| `lam_m_from_bound` | Scalar Λm from op-norm bound |
|
| 19 |
+
| `hcalc_xi_apply` | Ξ(t,y)=ξ·y+g |
|
| 20 |
+
| `hcalc_step` | NestedFaithful one step (**≠** `rec_step`) |
|
| 21 |
+
| `hcalc_run` | Iterate until residual < tol |
|
| 22 |
+
|
| 23 |
+
InstanceBridge parameter table is diagnostic (`instance_bridge_table`) for **FoundryAdditive** mode — never `rfl` / never NestedFaithful ≡ prop **39**.
|
| 24 |
+
|
| 25 |
+
## Smoke
|
| 26 |
+
|
| 27 |
+
```bash
|
| 28 |
+
/home/box/j/j9.7/bin/jconsole -js "load 'hcalc.ijs'" "cocurrent 'hcalc'" "echo smoke ''" "exit ''"
|
| 29 |
+
```
|
j/hcalc.ijs
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
NB. =============================================================================
|
| 2 |
+
NB. HCALC — Production Core verbs (PURE J)
|
| 3 |
+
NB. Copyright (C) 2026 HCALC contributors
|
| 4 |
+
NB.
|
| 5 |
+
NB. This program is free software: you can redistribute it and/or modify
|
| 6 |
+
NB. it under the terms of the GNU Affero General Public License as published
|
| 7 |
+
NB. by the Free Software Foundation, version 3 of the License.
|
| 8 |
+
NB.
|
| 9 |
+
NB. This program is distributed in the hope that it will be useful,
|
| 10 |
+
NB. but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 11 |
+
NB. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 12 |
+
NB. GNU Affero General Public License for more details.
|
| 13 |
+
NB.
|
| 14 |
+
NB. You should have received a copy of the GNU Affero General Public License
|
| 15 |
+
NB. along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 16 |
+
NB. SPDX-License-Identifier: AGPL-3.0-only
|
| 17 |
+
NB. =============================================================================
|
| 18 |
+
NB.
|
| 19 |
+
NB. Formulas: ../spec/PRODUCTION.md ONLY (exact).
|
| 20 |
+
NB. Path: /workspace/hcalc/j/ (NOT foundry-j/j/)
|
| 21 |
+
NB. Cite Foundry: P64, spectral_analyze (load foundry-j). softProjectScale idea
|
| 22 |
+
NB. from soft_project prop43 — do NOT call soft_project on (xi;lam) for C.
|
| 23 |
+
NB. ShapeMap = InstanceBridge (parameter table). hcalc_step ≠ rec_step / Foundry39.
|
| 24 |
+
NB.
|
| 25 |
+
NB. Verbs: tp_from_p64 c_wrap lam_m_from_bound hcalc_xi_apply
|
| 26 |
+
NB. hcalc_step hcalc_run
|
| 27 |
+
NB. Locale: hcalc
|
| 28 |
+
|
| 29 |
+
cocurrent 'hcalc'
|
| 30 |
+
|
| 31 |
+
NB. ── Defaults (PRODUCTION parameters) ────────────────────────────────────────
|
| 32 |
+
EPS_DEFAULT =: 0.05 NB. tier T2
|
| 33 |
+
DELTA_DEFAULT =: 1e_12
|
| 34 |
+
TOL_DEFAULT =: 1e_6
|
| 35 |
+
XI_UNIFORM =: 1.
|
| 36 |
+
BRIDGE_MODE =: 'InstanceBridge'
|
| 37 |
+
|
| 38 |
+
NB. Load Foundry cite hooks (idempotent)
|
| 39 |
+
hcalc_ensure_foundry =: 3 : 0
|
| 40 |
+
NB. 4!:0 returns _1 if undefined; 0 if noun
|
| 41 |
+
if. _1 = 4!:0 <'P64_foundry_' do.
|
| 42 |
+
load '/workspace/foundry-j/j/foundry.ijs'
|
| 43 |
+
end.
|
| 44 |
+
cocurrent 'hcalc'
|
| 45 |
+
i. 0 0
|
| 46 |
+
)
|
| 47 |
+
hcalc_ensure_foundry ''
|
| 48 |
+
cocurrent 'hcalc'
|
| 49 |
+
|
| 50 |
+
NB. ── Helpers ─────────────────────────────────────────────────────────────────
|
| 51 |
+
|
| 52 |
+
NB. tp_alpha n — α_j = 1 / (1 + ln p_{j mod 64}) [PRODUCTION §2]
|
| 53 |
+
NB. Use dyadic 1%z (not monadic %z) for clear RTL.
|
| 54 |
+
tp_alpha =: 3 : 0
|
| 55 |
+
n =. <. 0 ". ": y
|
| 56 |
+
if. n < 1 do. 0 $ 0. return. end.
|
| 57 |
+
primes =. (64 | i. n) { P64_foundry_
|
| 58 |
+
z =. 1 + ^. primes
|
| 59 |
+
1 % z
|
| 60 |
+
)
|
| 61 |
+
|
| 62 |
+
NB. diag_from_alpha α — D(Tp)=diag(α)
|
| 63 |
+
diag_from_alpha =: 3 : 0
|
| 64 |
+
a =. , y
|
| 65 |
+
n =. # a
|
| 66 |
+
if. 0 = n do. 0 0 $ 0. return. end.
|
| 67 |
+
a * =/~ i. n
|
| 68 |
+
)
|
| 69 |
+
|
| 70 |
+
NB. soft_project_scale q,eps — s=(1-ε)/q if q>1-ε else 1
|
| 71 |
+
NB. Numeric softProjectScale (PRODUCTION §3). NOT Foundry soft_project verb.
|
| 72 |
+
soft_project_scale =: 3 : 0
|
| 73 |
+
'q eps' =. 2 {. (, y) , 0 , EPS_DEFAULT
|
| 74 |
+
target =. 1 - eps
|
| 75 |
+
if. q > target do. target % q else. 1. end.
|
| 76 |
+
)
|
| 77 |
+
|
| 78 |
+
NB. q_of_tp n,eps — ‖D(Tp)‖_est via Foundry spectral_analyze on diag(α)
|
| 79 |
+
q_of_tp =: 3 : 0
|
| 80 |
+
'n eps' =. 2 {. (, y) , 1 , EPS_DEFAULT
|
| 81 |
+
n =. <. 0 ". ": n
|
| 82 |
+
a =. tp_alpha n
|
| 83 |
+
J =. diag_from_alpha a
|
| 84 |
+
sr =. J spectral_analyze_foundry_ eps
|
| 85 |
+
sr_radius_foundry_ sr
|
| 86 |
+
)
|
| 87 |
+
|
| 88 |
+
NB. c_op_norm n,eps — ‖C∘Tp‖_op = max_j |s·α_j| (diagonal)
|
| 89 |
+
c_op_norm =: 3 : 0
|
| 90 |
+
'n eps' =. 2 {. (, y) , 1 , EPS_DEFAULT
|
| 91 |
+
n =. <. 0 ". ": n
|
| 92 |
+
a =. tp_alpha n
|
| 93 |
+
q =. q_of_tp n , eps
|
| 94 |
+
s =. soft_project_scale q , eps
|
| 95 |
+
>./ | (s * a)
|
| 96 |
+
)
|
| 97 |
+
|
| 98 |
+
NB. residual_linf — ‖x-y‖_∞
|
| 99 |
+
residual_linf =: 4 : '>./ | (,x) - ,y'
|
| 100 |
+
|
| 101 |
+
NB. ── 1. tp_from_p64 (PRODUCTION §2) ─────────────────────────────────────────
|
| 102 |
+
NB. Monad: tp_from_p64 x → Tp(x)
|
| 103 |
+
tp_from_p64 =: 3 : 0
|
| 104 |
+
NB. Unbox/ravel: Verify may pass boxed vectors
|
| 105 |
+
xv =. , >^:L. y
|
| 106 |
+
if. 32 = 3!:0 xv do. xv =. , > xv end.
|
| 107 |
+
a =. tp_alpha # xv
|
| 108 |
+
a * xv
|
| 109 |
+
)
|
| 110 |
+
|
| 111 |
+
NB. ── 2. c_wrap (PRODUCTION §3) ──────────────────────────────────────────────
|
| 112 |
+
NB. Scales the STATE vector: C(x)=s·x. Does NOT call Foundry soft_project.
|
| 113 |
+
NB. Monad: c_wrap x (ε=T2). Dyad: eps c_wrap x
|
| 114 |
+
c_wrap =: 3 : 0
|
| 115 |
+
EPS_DEFAULT c_wrap y
|
| 116 |
+
:
|
| 117 |
+
eps =. x
|
| 118 |
+
xv =. , >^:L. y
|
| 119 |
+
n =. # xv
|
| 120 |
+
if. 0 = n do. xv return. end.
|
| 121 |
+
q =. q_of_tp n , eps
|
| 122 |
+
s =. soft_project_scale q , eps
|
| 123 |
+
s * xv
|
| 124 |
+
)
|
| 125 |
+
|
| 126 |
+
NB. ── 3. lam_m_from_bound (PRODUCTION §4) ────────────────────────────────────
|
| 127 |
+
NB. Λm = min(1, (1-ε) / (‖C∘Tp‖_op + δ))
|
| 128 |
+
NB. Monad: lam_m_from_bound n. Dyad: eps lam_m_from_bound n
|
| 129 |
+
NB. Also accept boxed (opnorm;eps;delta) for direct bound form.
|
| 130 |
+
lam_m_from_bound =: 3 : 0
|
| 131 |
+
EPS_DEFAULT lam_m_from_bound y
|
| 132 |
+
:
|
| 133 |
+
eps =. x
|
| 134 |
+
NB. If y is a length≥1 numeric list starting with op-norm (not a plain dim),
|
| 135 |
+
NB. treat as (opn[,eps[,delta]]) when #y>1 or y is boxed.
|
| 136 |
+
if. 32 = 3!:0 y do.
|
| 137 |
+
args =. , > y
|
| 138 |
+
opn =. 0 { args , 0
|
| 139 |
+
if. 1 < # args do. eps =. 1 { args end.
|
| 140 |
+
delta =. 2 { args , DELTA_DEFAULT
|
| 141 |
+
else.
|
| 142 |
+
n =. <. 0 ". ": y
|
| 143 |
+
if. n < 1 do. 0. return. end.
|
| 144 |
+
opn =. c_op_norm n , eps
|
| 145 |
+
delta =. DELTA_DEFAULT
|
| 146 |
+
end.
|
| 147 |
+
1. <. (1 - eps) % (opn + delta)
|
| 148 |
+
)
|
| 149 |
+
|
| 150 |
+
NB. ── 4. hcalc_xi_apply (PRODUCTION §5) ──────────────────────────────────────
|
| 151 |
+
NB. Ξ(t,y)=ξ_t·y+g_t. Default Uniform ξ=1, g=0.
|
| 152 |
+
NB. Monad: hcalc_xi_apply y → y
|
| 153 |
+
NB. Dyad: (xi;g) hcalc_xi_apply y or xi hcalc_xi_apply y
|
| 154 |
+
hcalc_xi_apply =: 3 : 0
|
| 155 |
+
, y
|
| 156 |
+
:
|
| 157 |
+
xv =. , y
|
| 158 |
+
xb =. boxxopen x
|
| 159 |
+
xi =. 0 ". ": > 0 { xb
|
| 160 |
+
if. 1 < # xb do.
|
| 161 |
+
g =. , > 1 { xb
|
| 162 |
+
else.
|
| 163 |
+
g =. (# xv) $ 0.
|
| 164 |
+
end.
|
| 165 |
+
if. 0 = # g do. g =. (# xv) $ 0. end.
|
| 166 |
+
if. (# g) ~: # xv do. g =. (# xv) $ {. g , 0. end.
|
| 167 |
+
(xi * xv) + g
|
| 168 |
+
)
|
| 169 |
+
|
| 170 |
+
NB. ── 5. hcalc_step (PRODUCTION nested; ≠ rec_step) ──────────────────────────
|
| 171 |
+
NB. X' = Ξ(t, Λm·C(Tp(X))) = ξ·(Λm·C(Tp(X))) + g
|
| 172 |
+
NB. Monad: hcalc_step X
|
| 173 |
+
NB. Dyad: (eps;xi;g) hcalc_step X
|
| 174 |
+
NB. Returns xnext (vector). Info via hcalc_step_info if needed.
|
| 175 |
+
NB. bridgeMode=InstanceBridge — NOT FoundryAdditive identity.
|
| 176 |
+
hcalc_step =: 3 : 0
|
| 177 |
+
(EPS_DEFAULT ; XI_UNIFORM ; '') hcalc_step y
|
| 178 |
+
:
|
| 179 |
+
xv =. , >^:L. y
|
| 180 |
+
xb =. boxxopen x
|
| 181 |
+
eps =. 0 ". ": > 0 { xb , <EPS_DEFAULT
|
| 182 |
+
xi =. 0 ". ": > 1 { xb , <XI_UNIFORM
|
| 183 |
+
if. 2 < # xb do. g =. , > 2 { xb else. g =. '' end.
|
| 184 |
+
if. 0 = # g do. g =. (# xv) $ 0. end.
|
| 185 |
+
if. (# g) ~: # xv do. g =. (# xv) $ {. g , 0. end.
|
| 186 |
+
n =. # xv
|
| 187 |
+
TpX =. tp_from_p64 xv
|
| 188 |
+
CX =. eps c_wrap TpX
|
| 189 |
+
lam =. eps lam_m_from_bound n
|
| 190 |
+
mid =. lam * CX
|
| 191 |
+
(xi ; g) hcalc_xi_apply mid
|
| 192 |
+
)
|
| 193 |
+
|
| 194 |
+
NB. hcalc_step_info — same step, returns xnext ; <(q;eps;lam;xi;residual;BRIDGE_MODE)>
|
| 195 |
+
hcalc_step_info =: 3 : 0
|
| 196 |
+
(EPS_DEFAULT ; XI_UNIFORM ; '') hcalc_step_info y
|
| 197 |
+
:
|
| 198 |
+
xv =. , >^:L. y
|
| 199 |
+
xb =. boxxopen x
|
| 200 |
+
eps =. 0 ". ": > 0 { xb , <EPS_DEFAULT
|
| 201 |
+
xi =. 0 ". ": > 1 { xb , <XI_UNIFORM
|
| 202 |
+
if. 2 < # xb do. g =. , > 2 { xb else. g =. '' end.
|
| 203 |
+
if. 0 = # g do. g =. (# xv) $ 0. end.
|
| 204 |
+
n =. # xv
|
| 205 |
+
a =. tp_alpha n
|
| 206 |
+
q =. q_of_tp n , eps
|
| 207 |
+
TpX =. a * xv
|
| 208 |
+
s =. soft_project_scale q , eps
|
| 209 |
+
CX =. s * TpX
|
| 210 |
+
lam =. eps lam_m_from_bound n
|
| 211 |
+
mid =. lam * CX
|
| 212 |
+
xnext =. (xi ; g) hcalc_xi_apply mid
|
| 213 |
+
res =. xv residual_linf xnext
|
| 214 |
+
NB. Double-box so 'xn info'=. leaves info as one box; >info yields field boxes
|
| 215 |
+
NB. (Verify: boxed=.>info then (<'InstanceBridge') e. boxed)
|
| 216 |
+
info =. q ; eps ; lam ; xi ; res ; BRIDGE_MODE
|
| 217 |
+
xnext ; <<info
|
| 218 |
+
)
|
| 219 |
+
|
| 220 |
+
NB. ── 6. hcalc_run (PRODUCTION §9) ───────────────────────────────────────────
|
| 221 |
+
NB. Iterate until J=‖X-step(X)‖_∞ < tol or max_steps.
|
| 222 |
+
NB. Monad: hcalc_run X0
|
| 223 |
+
NB. Dyad: (max_steps;tol;eps;xi;g) hcalc_run X0
|
| 224 |
+
NB. Returns: x_final ; converged ; steps ; <history>
|
| 225 |
+
hcalc_run =: 3 : 0
|
| 226 |
+
(200 ; TOL_DEFAULT ; EPS_DEFAULT ; XI_UNIFORM ; '') hcalc_run y
|
| 227 |
+
:
|
| 228 |
+
x0 =. , >^:L. y
|
| 229 |
+
xb =. boxxopen x
|
| 230 |
+
max_steps =. <. 0 ". ": > 0 { xb , <200
|
| 231 |
+
tol =. 0 ". ": > 1 { xb , <TOL_DEFAULT
|
| 232 |
+
eps =. 0 ". ": > 2 { xb , <EPS_DEFAULT
|
| 233 |
+
xi =. 0 ". ": > 3 { xb , <XI_UNIFORM
|
| 234 |
+
if. 4 < # xb do. g =. , > 4 { xb else. g =. '' end.
|
| 235 |
+
if. 0 = max_steps do. max_steps =. 200 end.
|
| 236 |
+
if. 0 = tol do. tol =. TOL_DEFAULT end.
|
| 237 |
+
if. 0 = # g do. g =. (# x0) $ 0. end.
|
| 238 |
+
|
| 239 |
+
xc =. x0
|
| 240 |
+
history =. 0 $ a:
|
| 241 |
+
converged =. 0
|
| 242 |
+
steps_done =. 0
|
| 243 |
+
lam =. eps lam_m_from_bound # x0
|
| 244 |
+
|
| 245 |
+
for_t. i. max_steps do.
|
| 246 |
+
xnext =. (eps ; xi ; g) hcalc_step xc
|
| 247 |
+
resid =. xc residual_linf xnext
|
| 248 |
+
history =. history , <(t ; resid ; lam)
|
| 249 |
+
xc =. xnext
|
| 250 |
+
steps_done =. t + 1
|
| 251 |
+
if. resid < tol do. converged =. 1 break. end.
|
| 252 |
+
end.
|
| 253 |
+
|
| 254 |
+
HCALC_STATE =: xc ; converged ; steps_done ; <history
|
| 255 |
+
HCALC_STATE
|
| 256 |
+
)
|
| 257 |
+
|
| 258 |
+
hcalc_state_x =: 0 {:: ]
|
| 259 |
+
hcalc_state_converged =: 1 {:: ]
|
| 260 |
+
hcalc_state_steps =: 2 {:: ]
|
| 261 |
+
hcalc_state_history =: 3 {:: ]
|
| 262 |
+
|
| 263 |
+
NB. ── Diagnostic only (PRODUCTION Option B) — NOT equal to hcalc_step ─────────
|
| 264 |
+
NB. InstanceBridge parameter table applied to Foundry additive shape:
|
| 265 |
+
NB. toFoundryStep = ξ·x + Λm·(C∘Tp)(x) + g
|
| 266 |
+
NB. Nested hcalc_step = ξ·(Λm·C(Tp(x))) + g
|
| 267 |
+
NB. Different morphisms; no rfl / no symbol identity.
|
| 268 |
+
to_foundry_step_diagnostic =: 3 : 0
|
| 269 |
+
(EPS_DEFAULT ; XI_UNIFORM ; '') to_foundry_step_diagnostic y
|
| 270 |
+
:
|
| 271 |
+
xv =. , >^:L. y
|
| 272 |
+
xb =. boxxopen x
|
| 273 |
+
eps =. 0 ". ": > 0 { xb , <EPS_DEFAULT
|
| 274 |
+
xi =. 0 ". ": > 1 { xb , <XI_UNIFORM
|
| 275 |
+
if. 2 < # xb do. g =. , > 2 { xb else. g =. '' end.
|
| 276 |
+
if. 0 = # g do. g =. (# xv) $ 0. end.
|
| 277 |
+
n =. # xv
|
| 278 |
+
lam =. eps lam_m_from_bound n
|
| 279 |
+
Tx =. eps c_wrap tp_from_p64 xv
|
| 280 |
+
(xi * xv) + (lam * Tx) + g
|
| 281 |
+
)
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
NB. ── Verify / Spec aliases (cite surface) ────────────────────────────────────
|
| 285 |
+
NB. P64 under hcalc name (H-A1); copy after Foundry load
|
| 286 |
+
P64_hcalc_ =: P64_foundry_
|
| 287 |
+
|
| 288 |
+
NB. q_est_from_alpha α — ‖D(Tp)‖_est for diagonal = max|α| (H-A2/H-A6)
|
| 289 |
+
q_est_from_alpha =: 3 : '>./ | , >^:L. y'
|
| 290 |
+
|
| 291 |
+
NB. c_wrap_check_hcalc_ — H-A3 assertion helper (scale-or-id on state)
|
| 292 |
+
c_wrap_check_hcalc_ =: 3 : 0
|
| 293 |
+
s =. soft_project_scale 2 , 0.05
|
| 294 |
+
assert. s = 0.95 % 2
|
| 295 |
+
s2 =. soft_project_scale 0.5 , 0.05
|
| 296 |
+
assert. s2 = 1
|
| 297 |
+
x =. 1 1 1 1
|
| 298 |
+
assert. (0.05 c_wrap tp_from_p64 x) -: tp_from_p64 x
|
| 299 |
+
1
|
| 300 |
+
)
|
| 301 |
+
|
| 302 |
+
cocurrent 'base'
|
lean/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
/.lake
|
lean/Hcalc.lean
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/-
|
| 2 |
+
Copyright (C) 2026 HCALC contributors
|
| 3 |
+
SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
-/
|
| 5 |
+
import Hcalc.RealStub
|
| 6 |
+
import Hcalc.Carrier
|
| 7 |
+
import Hcalc.Foundry
|
| 8 |
+
import Hcalc.Axioms
|
| 9 |
+
import Hcalc.Pipeline
|
| 10 |
+
import Hcalc.Convergence
|
| 11 |
+
import Hcalc.Invariants
|
| 12 |
+
import Hcalc.Production
|
lean/Hcalc/Axioms.lean
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/-
|
| 2 |
+
Copyright (C) 2026 HCALC contributors
|
| 3 |
+
SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
|
| 5 |
+
PRODUCTION.md close-all-gaps: L6 symbols are DEFS (not opaque axioms).
|
| 6 |
+
L7 = InstanceBridge (Option B) — NOT rfl / NOT Foundry39 ≡ nested.
|
| 7 |
+
Real = Mathlib ℝ (Gap-Real-arith CLOSED). Gap-Foundry-* may remain; zero production Gap-* axioms.
|
| 8 |
+
-/
|
| 9 |
+
|
| 10 |
+
import Hcalc.RealStub
|
| 11 |
+
import Hcalc.Carrier
|
| 12 |
+
import Hcalc.Foundry
|
| 13 |
+
|
| 14 |
+
namespace Hcalc
|
| 15 |
+
|
| 16 |
+
open Foundry
|
| 17 |
+
|
| 18 |
+
/-! ## Production parameters (PRODUCTION.md §Parameters) -/
|
| 19 |
+
|
| 20 |
+
/-- Default ε = T2 = 0.05 (epsDefault from RealStub). -/
|
| 21 |
+
noncomputable abbrev epsProd : Scalar := epsDefault
|
| 22 |
+
/-- δ = 10^{-12} guard. -/
|
| 23 |
+
noncomputable abbrev deltaProd : Scalar := deltaGuard
|
| 24 |
+
/-- Residual tolerance 10^{-6}. -/
|
| 25 |
+
noncomputable abbrev tolProd : Scalar := tolDefault
|
| 26 |
+
|
| 27 |
+
/-! ## Gap-Tp-from-P64 CLOSED — diagonal PrimeMask from P64 (Spec-only α) -/
|
| 28 |
+
|
| 29 |
+
/-- Prime at coordinate `j` via `P64 (j mod 64)` (PRODUCTION.md §2). -/
|
| 30 |
+
def primeAt {n : Nat} (j : Fin n) : Nat :=
|
| 31 |
+
P64 ⟨j.val % 64, Nat.mod_lt j.val (by decide : (0 : Nat) < 64)⟩
|
| 32 |
+
|
| 33 |
+
/--
|
| 34 |
+
α_j = 1 / (1 + log p_{j mod 64}).
|
| 35 |
+
Spec-only weights — **not** a Foundry-native identity.
|
| 36 |
+
-/
|
| 37 |
+
noncomputable def alpha {n : Nat} (j : Fin n) : Scalar :=
|
| 38 |
+
realDiv (1 : Real) ((1 : Real) + realLog (natToReal (primeAt j)))
|
| 39 |
+
|
| 40 |
+
/--
|
| 41 |
+
`Tp` — diagonal action `(Tp x)_j = α_j * x_j` (PRODUCTION.md §2).
|
| 42 |
+
Gap-Tp-from-P64 CLOSED as **def**.
|
| 43 |
+
-/
|
| 44 |
+
noncomputable def Tp {n : Nat} (x : Carrier n) : Carrier n :=
|
| 45 |
+
fun j => alpha j * x j
|
| 46 |
+
|
| 47 |
+
/-- Jacobian of Tp is diag(α); Gershgorin / ℓ∞ op-norm estimate = max |α_j|. -/
|
| 48 |
+
noncomputable def qEstTp {n : Nat} : Scalar :=
|
| 49 |
+
finMax (fun j : Fin n => ‖alpha (n := n) j‖ᵣ)
|
| 50 |
+
|
| 51 |
+
/-! ## Gap-C-wrapper CLOSED — softScale-or-id on state (NOT Foundry softProject on schedules) -/
|
| 52 |
+
|
| 53 |
+
/--
|
| 54 |
+
Scale factor for in-step C: softScaleFactor(ε, q) with q = ‖D(Tp)‖_est.
|
| 55 |
+
Uses softScaleFactor numeric law (Spec wiring). **Does not** claim
|
| 56 |
+
`C = Foundry.softProject` on (Ξ, Λ) schedule weights.
|
| 57 |
+
-/
|
| 58 |
+
noncomputable def cScale (n : Nat) (ε : Scalar) : Scalar :=
|
| 59 |
+
softScaleFactor ε (qEstTp (n := n))
|
| 60 |
+
|
| 61 |
+
/--
|
| 62 |
+
`C(x) = s • x` with `s = softScale-or-id` (PRODUCTION.md §3).
|
| 63 |
+
Gap-C-wrapper CLOSED as **def**.
|
| 64 |
+
-/
|
| 65 |
+
noncomputable def C {n : Nat} (ε : Scalar) (x : Carrier n) : Carrier n :=
|
| 66 |
+
vsmul (cScale n ε) x
|
| 67 |
+
|
| 68 |
+
/-- Gap-ContractAlg CLOSED: Gershgorin estimate then softScale-or-id (then Λm). -/
|
| 69 |
+
noncomputable def contractAlg_q {n : Nat} : Scalar := qEstTp (n := n)
|
| 70 |
+
|
| 71 |
+
/-- ContractAlg step 2: apply C. -/
|
| 72 |
+
noncomputable def contractAlg_applyC {n : Nat} (ε : Scalar) (x : Carrier n) : Carrier n :=
|
| 73 |
+
C (n := n) ε x
|
| 74 |
+
|
| 75 |
+
/-! ## Gap-Λm-scalar CLOSED -/
|
| 76 |
+
|
| 77 |
+
/-- ‖C ∘ Tp‖_op on ℓ∞ for diagonal: max_j |cScale * α_j|. -/
|
| 78 |
+
noncomputable def opNorm_C_circ_Tp (n : Nat) (ε : Scalar) : Scalar :=
|
| 79 |
+
finMax (fun j : Fin n => ‖cScale n ε * alpha (n := n) j‖ᵣ)
|
| 80 |
+
|
| 81 |
+
/--
|
| 82 |
+
Λm = min(1, (1-ε) / (‖C∘Tp‖_op + δ)) (PRODUCTION.md §4).
|
| 83 |
+
Gap-Λm-scalar CLOSED as **def**.
|
| 84 |
+
-/
|
| 85 |
+
noncomputable def LambdaM (n : Nat) (ε δ : Scalar) : Scalar :=
|
| 86 |
+
realMin (1 : Real) (realDiv ((1 : Real) - ε) (opNorm_C_circ_Tp n ε + δ))
|
| 87 |
+
|
| 88 |
+
/-- Default production Λm (ε=T2, δ=guard). -/
|
| 89 |
+
noncomputable def LambdaM_prod (n : Nat) : Scalar :=
|
| 90 |
+
LambdaM n epsProd deltaProd
|
| 91 |
+
|
| 92 |
+
/-! ## Gap-Ξ CLOSED — Ξ(t,y) = ξ_t · y + g_t -/
|
| 93 |
+
|
| 94 |
+
/-- Uniform xi_schedule: ξ_t = 1 for all t (PRODUCTION.md). -/
|
| 95 |
+
noncomputable def xi (_t : Time) : Scalar := (1 : Real)
|
| 96 |
+
|
| 97 |
+
/-- Default kick g_t = 0. -/
|
| 98 |
+
noncomputable def gDefault (n : Nat) (_t : Time) : Carrier n :=
|
| 99 |
+
vzero n
|
| 100 |
+
|
| 101 |
+
/--
|
| 102 |
+
`Xi t y = ξ_t • y + g_t` (PRODUCTION.md §5).
|
| 103 |
+
Gap-Ξ CLOSED as **def**.
|
| 104 |
+
-/
|
| 105 |
+
noncomputable def Xi {n : Nat} (t : Time) (y : Carrier n)
|
| 106 |
+
(g : Time → Carrier n := gDefault n) : Carrier n :=
|
| 107 |
+
vadd (vsmul (xi t) y) (g t)
|
| 108 |
+
|
| 109 |
+
/-- Xi under Uniform + zero kick reduces to identity on y. -/
|
| 110 |
+
theorem Xi_uniform_zero_kick {n : Nat} (t : Time) (y : Carrier n) :
|
| 111 |
+
Xi (n := n) t y (gDefault n) = y := by
|
| 112 |
+
funext j
|
| 113 |
+
simp only [Xi, vadd, vsmul, gDefault, vzero, xi, real_one_mul, real_add_zero]
|
| 114 |
+
|
| 115 |
+
/-! ## Composition helpers -/
|
| 116 |
+
|
| 117 |
+
/-- C ∘ Tp as a self-map on Carrier. -/
|
| 118 |
+
noncomputable def C_circ_Tp {n : Nat} (ε : Scalar) (x : Carrier n) : Carrier n :=
|
| 119 |
+
C (n := n) ε (Tp x)
|
| 120 |
+
|
| 121 |
+
/-- Scaled stabilized branch: Λm • (C ∘ Tp)(x). -/
|
| 122 |
+
noncomputable def stabilized {n : Nat} (ε δ : Scalar) (x : Carrier n) : Carrier n :=
|
| 123 |
+
vsmul (LambdaM n ε δ) (C_circ_Tp (n := n) ε x)
|
| 124 |
+
|
| 125 |
+
/-! ## Gap-OptObj CLOSED — residual ℓ∞ -/
|
| 126 |
+
|
| 127 |
+
/--
|
| 128 |
+
J(X) = ‖X - step(X)‖_∞ with step supplied (PRODUCTION.md §9).
|
| 129 |
+
Gap-OptObj CLOSED as **def**.
|
| 130 |
+
-/
|
| 131 |
+
noncomputable def residualNorm {n : Nat} (x x' : Carrier n) : Scalar :=
|
| 132 |
+
‖vsub x x'‖∞
|
| 133 |
+
|
| 134 |
+
/-- OptObj synonym: residual value. -/
|
| 135 |
+
noncomputable abbrev OptObjValue := Scalar
|
| 136 |
+
|
| 137 |
+
/-- Evaluate residual objective given a step map. -/
|
| 138 |
+
noncomputable def evalOptObj {n : Nat} (step : Carrier n → Carrier n) (x : Carrier n) : OptObjValue :=
|
| 139 |
+
residualNorm x (step x)
|
| 140 |
+
|
| 141 |
+
/-- Iterate `f` for `k` steps (optimize = iterate to tol — loop spec). -/
|
| 142 |
+
noncomputable def iterate {n : Nat} (f : Carrier n → Carrier n) : Nat → Carrier n → Carrier n
|
| 143 |
+
| 0, x => x
|
| 144 |
+
| k + 1, x => iterate f k (f x)
|
| 145 |
+
|
| 146 |
+
/-- Stop predicate: residual < tol. -/
|
| 147 |
+
noncomputable def residualBelowTol {n : Nat} (step : Carrier n → Carrier n)
|
| 148 |
+
(tol : Scalar) (x : Carrier n) : Prop :=
|
| 149 |
+
evalOptObj step x <ᵣ tol
|
| 150 |
+
|
| 151 |
+
/-! ## L7 Gap-ShapeMap CLOSED — InstanceBridge (Option B), NOT rfl -/
|
| 152 |
+
|
| 153 |
+
/--
|
| 154 |
+
InstanceBridge parameter table (PRODUCTION.md §6 Option B).
|
| 155 |
+
Holds Spec assignments relating Foundry-shaped diagnostics to HCALC symbols.
|
| 156 |
+
**Does not** assert `hcalcStep = FoundryStep` / Foundry39 ≡ nested.
|
| 157 |
+
-/
|
| 158 |
+
structure InstanceBridge (n : Nat) (ε δ : Scalar) where
|
| 159 |
+
/-- T assigned to C ∘ Tp under the bridge (assignment, not identity). -/
|
| 160 |
+
T_is_C_circ_Tp : True := True.intro
|
| 161 |
+
/-- Λ_vec assigned to Λm · 1 (scalar broadcast ≠ Foundry schedule law). -/
|
| 162 |
+
Lambda_vec_is_LambdaM : True := True.intro
|
| 163 |
+
/-- Ξ_vec assigned to ξ_t from HCALC xi_schedule (≠ Foundry Ξ_t identity). -/
|
| 164 |
+
Xi_vec_is_xi : True := True.intro
|
| 165 |
+
/-- g assigned to g_t. -/
|
| 166 |
+
g_is_g_t : True := True.intro
|
| 167 |
+
/-- bridgeMode tag. -/
|
| 168 |
+
bridgeMode : Unit := ()
|
| 169 |
+
|
| 170 |
+
/-- Default production InstanceBridge witness (Option B record). -/
|
| 171 |
+
def instanceBridge_prod (n : Nat) : InstanceBridge n epsProd deltaProd := {}
|
| 172 |
+
|
| 173 |
+
/--
|
| 174 |
+
Cite-only Foundry-shaped diagnostic on HCALC Carrier (Option B):
|
| 175 |
+
`toFoundryStep = ξ•x + Λm•(C∘Tp)(x) + g`.
|
| 176 |
+
**Not** claimed equal to `hcalcStep` (extra ξ•x drift term).
|
| 177 |
+
-/
|
| 178 |
+
noncomputable def toFoundryStep {n : Nat} (ε δ : Scalar) (t : Time)
|
| 179 |
+
(x : Carrier n) (g : Time → Carrier n := gDefault n) : Carrier n :=
|
| 180 |
+
vadd (vadd (vsmul (xi t) x) (vsmul (LambdaM n ε δ) (C_circ_Tp (n := n) ε x))) (g t)
|
| 181 |
+
|
| 182 |
+
/-- Nested HCALC step body (also in Pipeline): ξ • (Λm • (C∘Tp)(x)) + g. -/
|
| 183 |
+
noncomputable def hcalcStepCore {n : Nat} (ε δ : Scalar) (t : Time)
|
| 184 |
+
(x : Carrier n) (g : Time → Carrier n := gDefault n) : Carrier n :=
|
| 185 |
+
Xi (n := n) t (stabilized (n := n) ε δ x) g
|
| 186 |
+
|
| 187 |
+
/--
|
| 188 |
+
L7: under InstanceBridge, the parameter table matches Spec assignments.
|
| 189 |
+
Witness is the structure itself — **not** `rfl` of step morphisms.
|
| 190 |
+
-/
|
| 191 |
+
theorem InstanceBridge.param_table {n : Nat} {ε δ : Scalar}
|
| 192 |
+
(b : InstanceBridge n ε δ) :
|
| 193 |
+
b.T_is_C_circ_Tp = True.intro ∧
|
| 194 |
+
b.Lambda_vec_is_LambdaM = True.intro ∧
|
| 195 |
+
b.Xi_vec_is_xi = True.intro ∧
|
| 196 |
+
b.g_is_g_t = True.intro :=
|
| 197 |
+
⟨rfl, rfl, rfl, rfl⟩
|
| 198 |
+
|
| 199 |
+
/--
|
| 200 |
+
L7 diagnostic expansion: `toFoundryStep` unfolds to additive Foundry shape on Carrier.
|
| 201 |
+
Does **not** equate to `hcalcStepCore`.
|
| 202 |
+
-/
|
| 203 |
+
theorem toFoundryStep_eq {n : Nat} (ε δ : Scalar) (t : Time) (x : Carrier n)
|
| 204 |
+
(g : Time → Carrier n := gDefault n) :
|
| 205 |
+
toFoundryStep (n := n) ε δ t x g =
|
| 206 |
+
vadd (vadd (vsmul (xi t) x) (vsmul (LambdaM n ε δ) (C_circ_Tp (n := n) ε x))) (g t) :=
|
| 207 |
+
rfl
|
| 208 |
+
|
| 209 |
+
/--
|
| 210 |
+
L7 nested expansion: `hcalcStepCore` unfolds to Ξ(t, Λm · C(Tp x)).
|
| 211 |
+
-/
|
| 212 |
+
theorem hcalcStepCore_eq {n : Nat} (ε δ : Scalar) (t : Time) (x : Carrier n)
|
| 213 |
+
(g : Time → Carrier n := gDefault n) :
|
| 214 |
+
hcalcStepCore (n := n) ε δ t x g =
|
| 215 |
+
Xi (n := n) t (vsmul (LambdaM n ε δ) (C (n := n) ε (Tp x))) g :=
|
| 216 |
+
rfl
|
| 217 |
+
|
| 218 |
+
/--
|
| 219 |
+
Shape difference (documentary theorem): when g = 0 and ξ = 1,
|
| 220 |
+
`toFoundryStep x = x + stabilized x` while `hcalcStepCore x = stabilized x`.
|
| 221 |
+
They agree iff `stabilized x = 0` or after dropping the free ξ·x channel (Option A/C).
|
| 222 |
+
-/
|
| 223 |
+
theorem toFoundryStep_vs_hcalc_uniform_zero {n : Nat} (ε δ : Scalar) (t : Time)
|
| 224 |
+
(x : Carrier n) :
|
| 225 |
+
toFoundryStep (n := n) ε δ t x (gDefault n) =
|
| 226 |
+
vadd x (stabilized (n := n) ε δ x) ∧
|
| 227 |
+
hcalcStepCore (n := n) ε δ t x (gDefault n) =
|
| 228 |
+
stabilized (n := n) ε δ x := by
|
| 229 |
+
constructor
|
| 230 |
+
· funext j
|
| 231 |
+
simp only [toFoundryStep, stabilized, C_circ_Tp, vadd, vsmul, gDefault, vzero, xi,
|
| 232 |
+
real_one_mul, real_add_zero]
|
| 233 |
+
· funext j
|
| 234 |
+
simp only [hcalcStepCore, Xi_uniform_zero_kick, stabilized, C_circ_Tp]
|
| 235 |
+
|
| 236 |
+
/-- Definition-record markers for A7 / Alloy (SpecDefined). -/
|
| 237 |
+
theorem definitionRecord_Tp : True := True.intro
|
| 238 |
+
theorem definitionRecord_C : True := True.intro
|
| 239 |
+
theorem definitionRecord_LambdaM : True := True.intro
|
| 240 |
+
theorem definitionRecord_Xi : True := True.intro
|
| 241 |
+
theorem definitionRecord_Carrier : True := True.intro
|
| 242 |
+
theorem definitionRecord_OptObj : True := True.intro
|
| 243 |
+
theorem definitionRecord_ContractAlg : True := True.intro
|
| 244 |
+
theorem definitionRecord_ShapeMap : True := True.intro
|
| 245 |
+
theorem definitionRecord_Converge : True := True.intro
|
| 246 |
+
|
| 247 |
+
end Hcalc
|
lean/Hcalc/Carrier.lean
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/-
|
| 2 |
+
Copyright (C) 2026 HCALC contributors
|
| 3 |
+
SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
|
| 5 |
+
Gap-Carrier CLOSED (PRODUCTION.md §1): HCALC.Carrier = Fin n → ℝ with ℓ∞.
|
| 6 |
+
-/
|
| 7 |
+
|
| 8 |
+
import Hcalc.RealStub
|
| 9 |
+
|
| 10 |
+
namespace Hcalc
|
| 11 |
+
|
| 12 |
+
abbrev Carrier (n : Nat) : Type := Fin n → Real
|
| 13 |
+
abbrev Time : Type := Nat
|
| 14 |
+
abbrev Intermediate (n : Nat) : Type := Carrier n
|
| 15 |
+
abbrev State (n : Nat) : Type := Carrier n
|
| 16 |
+
|
| 17 |
+
noncomputable def vzero (n : Nat) : Carrier n := fun _ => (0 : Real)
|
| 18 |
+
noncomputable def vadd {n : Nat} (x y : Carrier n) : Carrier n := fun j => x j + y j
|
| 19 |
+
noncomputable def vneg {n : Nat} (x : Carrier n) : Carrier n := fun j => -(x j)
|
| 20 |
+
noncomputable def vsub {n : Nat} (x y : Carrier n) : Carrier n := fun j => x j - y j
|
| 21 |
+
noncomputable def vsmul {n : Nat} (a : Scalar) (x : Carrier n) : Carrier n := fun j => a * x j
|
| 22 |
+
noncomputable def linf {n : Nat} (x : Carrier n) : Scalar := finMax (fun j => ‖x j‖ᵣ)
|
| 23 |
+
|
| 24 |
+
notation "‖" x "‖∞" => linf x
|
| 25 |
+
|
| 26 |
+
axiom linf_all_zero_eq_zero (n : Nat) (x : Carrier n)
|
| 27 |
+
(h : ∀ j, ‖x j‖ᵣ = (0 : Real)) : ‖x‖∞ = (0 : Real)
|
| 28 |
+
|
| 29 |
+
/-- ℓ∞ norm is nonnegative. -/
|
| 30 |
+
axiom linf_nonneg {n : Nat} (x : Carrier n) : (0 : Real) ≤ᵣ ‖x‖∞
|
| 31 |
+
|
| 32 |
+
theorem carrier_ext_of_linf_sub_eq_zero {n : Nat} (x y : Carrier n)
|
| 33 |
+
(h : ‖vsub x y‖∞ = (0 : Real)) : x = y := by
|
| 34 |
+
funext j
|
| 35 |
+
have hj := finMax_abs_eq_zero_of (fun k => vsub x y k) h j
|
| 36 |
+
have hsub : x j - y j = (0 : Real) := hj
|
| 37 |
+
have : x j = (x j - y j) + y j := by
|
| 38 |
+
have hcancel : (-(y j)) + y j = (0 : Real) := by
|
| 39 |
+
rw [real_add_comm]
|
| 40 |
+
exact real_neg_add_cancel (y j)
|
| 41 |
+
calc
|
| 42 |
+
x j = x j + (0 : Real) := (real_add_zero (x j)).symm
|
| 43 |
+
_ = x j + ((-(y j)) + y j) := by rw [hcancel]
|
| 44 |
+
_ = (x j + (-(y j))) + y j := (real_add_assoc (x j) (-(y j)) (y j)).symm
|
| 45 |
+
_ = (x j - y j) + y j := rfl
|
| 46 |
+
rw [this, hsub, real_zero_add]
|
| 47 |
+
|
| 48 |
+
theorem linf_vzero (n : Nat) : ‖vzero n‖∞ = (0 : Real) :=
|
| 49 |
+
linf_all_zero_eq_zero n (vzero n) (fun _ => real_abs_zero)
|
| 50 |
+
|
| 51 |
+
theorem vsmul_zero_left {n : Nat} (x : Carrier n) : vsmul (0 : Real) x = vzero n := by
|
| 52 |
+
funext j
|
| 53 |
+
exact real_zero_mul (x j)
|
| 54 |
+
|
| 55 |
+
theorem vsmul_vadd {n : Nat} (a : Scalar) (x y : Carrier n) :
|
| 56 |
+
vsmul a (vadd x y) = vadd (vsmul a x) (vsmul a y) := by
|
| 57 |
+
funext j
|
| 58 |
+
exact real_mul_add a (x j) (y j)
|
| 59 |
+
|
| 60 |
+
noncomputable abbrev scalarMul {n : Nat} (a : Scalar) (x : Intermediate n) : Intermediate n :=
|
| 61 |
+
vsmul a x
|
| 62 |
+
|
| 63 |
+
end Hcalc
|
lean/Hcalc/Convergence.lean
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/-
|
| 2 |
+
Copyright (C) 2026 HCALC contributors
|
| 3 |
+
SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
|
| 5 |
+
L5 / Gap-Converge CLOSED under HypContractive (PRODUCTION.md §8).
|
| 6 |
+
Unique fixed point for nested step; residual lemmas. Freehand calc proofs; Mathlib ℝ.
|
| 7 |
+
-/
|
| 8 |
+
|
| 9 |
+
import Hcalc.Axioms
|
| 10 |
+
import Hcalc.Foundry
|
| 11 |
+
import Hcalc.Pipeline
|
| 12 |
+
|
| 13 |
+
namespace Hcalc.Convergence
|
| 14 |
+
|
| 15 |
+
open Hcalc Pipeline Foundry
|
| 16 |
+
|
| 17 |
+
/-! ## Hypothesis bundles -/
|
| 18 |
+
|
| 19 |
+
/--
|
| 20 |
+
HypContractive (PRODUCTION.md §8):
|
| 21 |
+
|ξ| · ‖Λm · (C ∘ Tp)‖_op < 1 - ε
|
| 22 |
+
Packaged as an explicit Lipschitz bound with `q < 1` (strict contraction).
|
| 23 |
+
-/
|
| 24 |
+
structure HypContractive {n : Nat} (ε : Scalar) (F : Carrier n → Carrier n) where
|
| 25 |
+
q : Scalar
|
| 26 |
+
/-- Production margin form: q < 1 - ε. -/
|
| 27 |
+
q_lt_margin : q <ᵣ ((1 : Scalar) - ε)
|
| 28 |
+
/-- Strict contraction modulus: q < 1. -/
|
| 29 |
+
q_lt_one : q <ᵣ (1 : Scalar)
|
| 30 |
+
/-- Lipschitz: ‖F x - F y‖_∞ ≤ q · ‖x - y‖_∞. -/
|
| 31 |
+
lip : ∀ x y : Carrier n, ‖vsub (F x) (F y)‖∞ ≤ᵣ q * ‖vsub x y‖∞
|
| 32 |
+
|
| 33 |
+
/-- Fixed-point predicate. -/
|
| 34 |
+
def IsFixedPoint {n : Nat} (F : Carrier n → Carrier n) (x : Carrier n) : Prop :=
|
| 35 |
+
F x = x
|
| 36 |
+
|
| 37 |
+
/-- Structural: HypContractive packs `q < 1 - ε`. -/
|
| 38 |
+
theorem HypContractive.q_lt_one_sub_eps {n : Nat} {ε : Scalar} {F : Carrier n → Carrier n}
|
| 39 |
+
(h : HypContractive (n := n) ε F) :
|
| 40 |
+
h.q <ᵣ ((1 : Scalar) - ε) :=
|
| 41 |
+
h.q_lt_margin
|
| 42 |
+
|
| 43 |
+
-- ℓ∞ nonneg: see `Hcalc.linf_nonneg` (Carrier).
|
| 44 |
+
|
| 45 |
+
/-! ## L5 — uniqueness of fixed point under HypContractive -/
|
| 46 |
+
|
| 47 |
+
/--
|
| 48 |
+
L5 uniqueness (PRODUCTION.md §8): a strict ℓ∞ contraction has at most one fixed point.
|
| 49 |
+
-/
|
| 50 |
+
theorem unique_fixed_point {n : Nat} {ε : Scalar} {F : Carrier n → Carrier n}
|
| 51 |
+
(h : HypContractive (n := n) ε F)
|
| 52 |
+
(x y : Carrier n)
|
| 53 |
+
(hx : IsFixedPoint F x) (hy : IsFixedPoint F y) : x = y := by
|
| 54 |
+
unfold IsFixedPoint at hx hy
|
| 55 |
+
have hlip := h.lip x y
|
| 56 |
+
have hrew : vsub (F x) (F y) = vsub x y := by
|
| 57 |
+
rw [hx, hy]
|
| 58 |
+
rw [hrew] at hlip
|
| 59 |
+
have hnn : (0 : Real) ≤ᵣ ‖vsub x y‖∞ := linf_nonneg (vsub x y)
|
| 60 |
+
have hzero : ‖vsub x y‖∞ = (0 : Real) :=
|
| 61 |
+
real_contract_force_zero ‖vsub x y‖∞ h.q hnn h.q_lt_one hlip
|
| 62 |
+
exact carrier_ext_of_linf_sub_eq_zero x y hzero
|
| 63 |
+
|
| 64 |
+
/-! ## Residual lemmas -/
|
| 65 |
+
|
| 66 |
+
/-- At a fixed point, residual is zero. -/
|
| 67 |
+
theorem residual_at_fixed_point {n : Nat} (F : Carrier n → Carrier n) (x : Carrier n)
|
| 68 |
+
(hx : IsFixedPoint F x) : evalOptObj F x = (0 : Real) := by
|
| 69 |
+
unfold evalOptObj residualNorm IsFixedPoint at *
|
| 70 |
+
have : vsub x (F x) = vzero n := by
|
| 71 |
+
funext j
|
| 72 |
+
change x j - (F x) j = (0 : Real)
|
| 73 |
+
rw [hx]
|
| 74 |
+
exact real_sub_self (x j)
|
| 75 |
+
rw [this, linf_vzero]
|
| 76 |
+
|
| 77 |
+
/-- Existence under zero kick: stabilized (linear through origin) fixes 0. -/
|
| 78 |
+
theorem stabilized_fixes_zero {n : Nat} (ε δ : Scalar) :
|
| 79 |
+
IsFixedPoint (stabilized (n := n) ε δ) (vzero n) := by
|
| 80 |
+
unfold IsFixedPoint stabilized C_circ_Tp C Tp vsmul vzero
|
| 81 |
+
funext j
|
| 82 |
+
-- (Λm * (cScale * (α * 0))) = 0
|
| 83 |
+
simp only [real_mul_zero]
|
| 84 |
+
|
| 85 |
+
/-- L5 existence+uniqueness for stabilized under Hyp: unique FP is 0. -/
|
| 86 |
+
theorem unique_fp_stabilized_of_hyp {n : Nat} {ε δ : Scalar}
|
| 87 |
+
(h : HypContractive (n := n) ε (stabilized (n := n) ε δ)) :
|
| 88 |
+
IsFixedPoint (stabilized (n := n) ε δ) (vzero n) ∧
|
| 89 |
+
∀ y : Carrier n, IsFixedPoint (stabilized (n := n) ε δ) y → y = vzero n := by
|
| 90 |
+
refine ⟨stabilized_fixes_zero (n := n) ε δ, ?_⟩
|
| 91 |
+
intro y hy
|
| 92 |
+
exact unique_fixed_point h y (vzero n) hy (stabilized_fixes_zero (n := n) ε δ)
|
| 93 |
+
|
| 94 |
+
/-- Nested step under Uniform+zero kick equals stabilized; zero is a fixed point. -/
|
| 95 |
+
theorem step_fixes_zero {n : Nat} (ε δ : Scalar) (t : Time) :
|
| 96 |
+
IsFixedPoint (step (n := n) ε δ t) (vzero n) := by
|
| 97 |
+
unfold IsFixedPoint
|
| 98 |
+
rw [step_eq_stabilized]
|
| 99 |
+
exact stabilized_fixes_zero (n := n) ε δ
|
| 100 |
+
|
| 101 |
+
/-- L5 for nested `step` under HypContractive. -/
|
| 102 |
+
theorem unique_fp_step_of_hyp {n : Nat} {ε δ : Scalar} (t : Time)
|
| 103 |
+
(h : HypContractive (n := n) ε (step (n := n) ε δ t)) :
|
| 104 |
+
IsFixedPoint (step (n := n) ε δ t) (vzero n) ∧
|
| 105 |
+
∀ y : Carrier n, IsFixedPoint (step (n := n) ε δ t) y → y = vzero n := by
|
| 106 |
+
refine ⟨step_fixes_zero (n := n) ε δ t, ?_⟩
|
| 107 |
+
intro y hy
|
| 108 |
+
exact unique_fixed_point h y (vzero n) hy (step_fixes_zero (n := n) ε δ t)
|
| 109 |
+
|
| 110 |
+
/-- Residual of step at 0 is 0. -/
|
| 111 |
+
theorem J_at_zero {n : Nat} (ε δ : Scalar) (t : Time) :
|
| 112 |
+
J (n := n) ε δ t (vzero n) = (0 : Real) :=
|
| 113 |
+
residual_at_fixed_point (step (n := n) ε δ t) (vzero n) (step_fixes_zero (n := n) ε δ t)
|
| 114 |
+
|
| 115 |
+
/-- Foundry `contractiveG` matches L2 definitional form under hyps. -/
|
| 116 |
+
theorem contractiveG_from_bound {n : Nat} (Jmat : Mat n) (ε : Scalar)
|
| 117 |
+
(h : gershgorinBound Jmat <ᵣ ((1 : Scalar) - ε)) :
|
| 118 |
+
contractiveG Jmat ε :=
|
| 119 |
+
(contractiveG_iff Jmat ε).mpr h
|
| 120 |
+
|
| 121 |
+
end Hcalc.Convergence
|
lean/Hcalc/Foundry.lean
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/-
|
| 2 |
+
Copyright (C) 2026 HCALC contributors
|
| 3 |
+
SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
|
| 5 |
+
Foundry instantiation layer (L1–L4): DISTINCT from HCALC nested pipeline.
|
| 6 |
+
FoundryAdditive (prop 39) remains separate from InstanceBridge (PRODUCTION.md §6).
|
| 7 |
+
Cite: FOUNDRY_J_CROSSLINKS, foundry-j PROPERTIES 23, 33–34, 39, 42–43.
|
| 8 |
+
-/
|
| 9 |
+
|
| 10 |
+
import Hcalc.RealStub
|
| 11 |
+
import Hcalc.Carrier
|
| 12 |
+
|
| 13 |
+
namespace Hcalc.Foundry
|
| 14 |
+
|
| 15 |
+
open Hcalc
|
| 16 |
+
|
| 17 |
+
/-! ## L1: P64 — first 64 primes (PROPERTIES 23) — definition (data) -/
|
| 18 |
+
|
| 19 |
+
/-- The first 64 primes, PROPERTIES **23** / `types.h:24–30`. -/
|
| 20 |
+
def p64List : List Nat :=
|
| 21 |
+
[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71,
|
| 22 |
+
73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151,
|
| 23 |
+
157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233,
|
| 24 |
+
239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311]
|
| 25 |
+
|
| 26 |
+
theorem p64List_length : p64List.length = 64 := by native_decide
|
| 27 |
+
|
| 28 |
+
/-- `P64 : Fin 64 → ℕ` (Lean L1). -/
|
| 29 |
+
def P64 (i : Fin 64) : Nat :=
|
| 30 |
+
p64List.get ⟨i.val, by
|
| 31 |
+
have h := p64List_length
|
| 32 |
+
omega⟩
|
| 33 |
+
|
| 34 |
+
theorem P64_zero : P64 ⟨0, by omega⟩ = 2 := by native_decide
|
| 35 |
+
theorem P64_one : P64 ⟨1, by omega⟩ = 3 := by native_decide
|
| 36 |
+
theorem P64_last : P64 ⟨63, by omega⟩ = 311 := by native_decide
|
| 37 |
+
|
| 38 |
+
/-! ## Foundry carrier stubs (opaque; FoundryAdditive path — ≠ HCALC Carrier) -/
|
| 39 |
+
|
| 40 |
+
/-- GapId: Gap-Foundry-StateOps — Foundry recurrence carrier (not HCALC `Carrier`). -/
|
| 41 |
+
axiom State : Type
|
| 42 |
+
/-- GapId: Gap-Foundry-StateOps (infrastructure for L3/L4). -/
|
| 43 |
+
axiom State.add : State → State → State
|
| 44 |
+
/-- GapId: Gap-Foundry-StateOps -/
|
| 45 |
+
axiom State.smul : Scalar → State → State
|
| 46 |
+
/-- GapId: Gap-Foundry-StateOps -/
|
| 47 |
+
axiom State.zero : State
|
| 48 |
+
|
| 49 |
+
noncomputable instance : Add State := ⟨State.add⟩
|
| 50 |
+
noncomputable instance : Zero State := ⟨State.zero⟩
|
| 51 |
+
|
| 52 |
+
/-- Schedule weight (Foundry Ξ_t / Λ_t abstracted to Scalar). -/
|
| 53 |
+
abbrev Weight := Scalar
|
| 54 |
+
|
| 55 |
+
/-- Nonlinear hook `T` in Foundry recurrence (≠ HCALC `Tp`). -/
|
| 56 |
+
abbrev Nonlinear := State → State
|
| 57 |
+
|
| 58 |
+
/-! ## L2: Gershgorin bound / contractiveG (PROPERTIES 33–34) -/
|
| 59 |
+
|
| 60 |
+
/-- Square matrix as function of indices (no Mathlib Matrix). -/
|
| 61 |
+
def Mat (n : Nat) := Fin n → Fin n → Scalar
|
| 62 |
+
|
| 63 |
+
/-- Row radius excluding diagonal: Σ_{j≠i} |J_ij|. -/
|
| 64 |
+
noncomputable def rowRadius {n : Nat} (J : Mat n) (i : Fin n) : Scalar :=
|
| 65 |
+
Fin.foldl n (fun acc j =>
|
| 66 |
+
if j = i then acc else acc + ‖J i j‖ᵣ) (0 : Scalar)
|
| 67 |
+
|
| 68 |
+
/-- Disk max for row i: |J_ii| + rowRadius. -/
|
| 69 |
+
noncomputable def diskMax {n : Nat} (J : Mat n) (i : Fin n) : Scalar :=
|
| 70 |
+
‖J i i‖ᵣ + rowRadius J i
|
| 71 |
+
|
| 72 |
+
/-- Gershgorin disk bound = max over rows of diskMax (PROPERTIES **33**). -/
|
| 73 |
+
noncomputable def gershgorinBound {n : Nat} (J : Mat n) : Scalar :=
|
| 74 |
+
finMax (fun i => diskMax J i)
|
| 75 |
+
|
| 76 |
+
/-- `contractiveG J ε ↔ gershgorinBound J < 1 - ε` (PROPERTIES **34**). -/
|
| 77 |
+
noncomputable def contractiveG {n : Nat} (J : Mat n) (ε : Scalar) : Prop :=
|
| 78 |
+
gershgorinBound J <ᵣ ((1 : Scalar) - ε)
|
| 79 |
+
|
| 80 |
+
/-- Definitional unfolding: contractiveG is exactly the Gershgorin inequality. -/
|
| 81 |
+
theorem contractiveG_iff {n : Nat} (J : Mat n) (ε : Scalar) :
|
| 82 |
+
contractiveG J ε ↔ gershgorinBound J <ᵣ ((1 : Scalar) - ε) :=
|
| 83 |
+
Iff.rfl
|
| 84 |
+
|
| 85 |
+
/-! ## L3: FoundryStep — exact PROPERTIES 39; ≠ HCALC nested / InstanceBridge -/
|
| 86 |
+
|
| 87 |
+
/--
|
| 88 |
+
Foundry additive Banach step (PROPERTIES **39** / FoundryAdditive):
|
| 89 |
+
`x' = Ξ • x + Λ • T(x) + g`.
|
| 90 |
+
|
| 91 |
+
**Distinct** from HCALC `hcalcStep` and from InstanceBridge (PRODUCTION.md §6).
|
| 92 |
+
Do not identify with nested form.
|
| 93 |
+
-/
|
| 94 |
+
noncomputable def FoundryStep (Ξ Λ : Weight) (T : Nonlinear) (g x : State) : State :=
|
| 95 |
+
State.smul Ξ x + State.smul Λ (T x) + g
|
| 96 |
+
|
| 97 |
+
/-! ## L4: qEstimate / softProject (PROPERTIES 42–43, abstracted) -/
|
| 98 |
+
|
| 99 |
+
/-- GapId: Gap-Foundry-Norm (infrastructure). -/
|
| 100 |
+
axiom weightNorm : Weight → Scalar
|
| 101 |
+
/-- GapId: Gap-Foundry-Norm -/
|
| 102 |
+
axiom nonlinearNorm : Nonlinear → State → Scalar
|
| 103 |
+
|
| 104 |
+
/-- Abstracted q-estimate (PROPERTIES **42**). -/
|
| 105 |
+
noncomputable def qEstimate (Ξ Λ : Weight) (T : Nonlinear) (x : State) : Scalar :=
|
| 106 |
+
weightNorm Ξ + weightNorm Λ * nonlinearNorm T x
|
| 107 |
+
|
| 108 |
+
/-- Soft-project scales (PROPERTIES **43**). -/
|
| 109 |
+
structure SoftScales where
|
| 110 |
+
xi : Weight
|
| 111 |
+
lam : Weight
|
| 112 |
+
|
| 113 |
+
/-- GapId: Gap-Foundry-Div (infrastructure) — Real division alias. -/
|
| 114 |
+
noncomputable def realDiv (a b : Scalar) : Scalar := Hcalc.realDiv a b
|
| 115 |
+
|
| 116 |
+
/-- GapId: Gap-Foundry-SoftScale — Foundry schedule soft_project scale (props 42–43).
|
| 117 |
+
NOT identical to HCALC in-step `C` (which uses softScaleFactor as Spec wiring only). -/
|
| 118 |
+
noncomputable def softProjectScale (ε q : Scalar) : Scalar := softScaleFactor ε q
|
| 119 |
+
|
| 120 |
+
theorem softProjectScale_of_le (ε q : Scalar)
|
| 121 |
+
(h : q <ᵣ ((1 : Scalar) - ε) ∨ q = ((1 : Scalar) - ε)) :
|
| 122 |
+
softProjectScale ε q = (1 : Scalar) :=
|
| 123 |
+
softScaleFactor_of_le ε q h
|
| 124 |
+
|
| 125 |
+
theorem softProjectScale_of_gt (ε q : Scalar)
|
| 126 |
+
(h : ((1 : Scalar) - ε) <ᵣ q) :
|
| 127 |
+
softProjectScale ε q = Hcalc.realDiv ((1 : Scalar) - ε) q :=
|
| 128 |
+
softScaleFactor_of_gt ε q h
|
| 129 |
+
|
| 130 |
+
/-- Soft-project: scale Ξ, Λ by `softProjectScale ε q` (PROPERTIES **43**). -/
|
| 131 |
+
noncomputable def softProject (ε : Scalar) (Ξ Λ : Weight) (T : Nonlinear) (x : State) :
|
| 132 |
+
SoftScales :=
|
| 133 |
+
let q := qEstimate Ξ Λ T x
|
| 134 |
+
let s := softProjectScale ε q
|
| 135 |
+
⟨Ξ * s, Λ * s⟩
|
| 136 |
+
|
| 137 |
+
/-- When q ≤ 1-ε, soft-project leaves Ξ unchanged (via scale=1). -/
|
| 138 |
+
theorem softProject_xi_of_le (ε : Scalar) (Ξ Λ : Weight) (T : Nonlinear) (x : State)
|
| 139 |
+
(h : (qEstimate Ξ Λ T x) <ᵣ ((1 : Scalar) - ε) ∨
|
| 140 |
+
(qEstimate Ξ Λ T x) = ((1 : Scalar) - ε)) :
|
| 141 |
+
(softProject ε Ξ Λ T x).xi = Ξ * (1 : Scalar) := by
|
| 142 |
+
simp [softProject, softProjectScale_of_le ε _ h]
|
| 143 |
+
|
| 144 |
+
end Hcalc.Foundry
|
lean/Hcalc/Invariants.lean
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/-
|
| 2 |
+
Copyright (C) 2026 HCALC contributors
|
| 3 |
+
SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
|
| 5 |
+
Structural invariants for production nested `step`.
|
| 6 |
+
-/
|
| 7 |
+
|
| 8 |
+
import Hcalc.Pipeline
|
| 9 |
+
|
| 10 |
+
namespace Hcalc.Invariants
|
| 11 |
+
|
| 12 |
+
open Hcalc Pipeline
|
| 13 |
+
|
| 14 |
+
/-- Predicate preserved by nested `step` for all times / ε / δ. -/
|
| 15 |
+
def IsInvariant {n : Nat} (P : Carrier n → Prop) : Prop :=
|
| 16 |
+
∀ (ε δ : Scalar) (t : Time) (x : Carrier n),
|
| 17 |
+
P x → P (step (n := n) ε δ t x)
|
| 18 |
+
|
| 19 |
+
theorem true_invariant {n : Nat} : IsInvariant (n := n) (fun _ => True) := by
|
| 20 |
+
intro ε δ t x hx
|
| 21 |
+
trivial
|
| 22 |
+
|
| 23 |
+
theorem invariant_and {n : Nat} (P Q : Carrier n → Prop)
|
| 24 |
+
(hP : IsInvariant (n := n) P) (hQ : IsInvariant (n := n) Q) :
|
| 25 |
+
IsInvariant (n := n) (fun x => P x ∧ Q x) := by
|
| 26 |
+
intro ε δ t x hx
|
| 27 |
+
exact ⟨hP ε δ t x hx.1, hQ ε δ t x hx.2⟩
|
| 28 |
+
|
| 29 |
+
/-- Invariance under production defaults. -/
|
| 30 |
+
def IsInvariantProd {n : Nat} (P : Carrier n → Prop) : Prop :=
|
| 31 |
+
∀ (t : Time) (x : Carrier n), P x → P (stepProd (n := n) t x)
|
| 32 |
+
|
| 33 |
+
theorem invariant_implies_prod {n : Nat} (P : Carrier n → Prop)
|
| 34 |
+
(h : IsInvariant (n := n) P) : IsInvariantProd (n := n) P := by
|
| 35 |
+
intro t x hx
|
| 36 |
+
exact h epsProd deltaProd t x hx
|
| 37 |
+
|
| 38 |
+
end Hcalc.Invariants
|
lean/Hcalc/Pipeline.lean
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/-
|
| 2 |
+
Copyright (C) 2026 HCALC contributors
|
| 3 |
+
SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
|
| 5 |
+
HCALC nested one-step map (PRODUCTION.md):
|
| 6 |
+
X_{t+1} = Ξ(t, Λm · C(Tp(X_t))).
|
| 7 |
+
DISTINCT from Foundry.FoundryStep / toFoundryStep (InstanceBridge ≠ identity).
|
| 8 |
+
-/
|
| 9 |
+
|
| 10 |
+
import Hcalc.Axioms
|
| 11 |
+
|
| 12 |
+
namespace Hcalc.Pipeline
|
| 13 |
+
|
| 14 |
+
open Hcalc
|
| 15 |
+
|
| 16 |
+
/--
|
| 17 |
+
One-step nested HCALC evolution (production verb `hcalcStep`):
|
| 18 |
+
`step ε δ t x = Xi t (Λm • C(Tp x))` with default zero kick.
|
| 19 |
+
-/
|
| 20 |
+
noncomputable def step {n : Nat} (ε δ : Scalar) (t : Time) (x : Carrier n) : Carrier n :=
|
| 21 |
+
hcalcStepCore (n := n) ε δ t x (gDefault n)
|
| 22 |
+
|
| 23 |
+
/-- Production defaults ε=T2, δ=guard. -/
|
| 24 |
+
noncomputable def stepProd {n : Nat} (t : Time) (x : Carrier n) : Carrier n :=
|
| 25 |
+
step (n := n) epsProd deltaProd t x
|
| 26 |
+
|
| 27 |
+
/-- Definitional: step unfolds to nested composition. -/
|
| 28 |
+
theorem step_eq {n : Nat} (ε δ : Scalar) (t : Time) (x : Carrier n) :
|
| 29 |
+
step (n := n) ε δ t x =
|
| 30 |
+
Xi (n := n) t (vsmul (LambdaM n ε δ) (C (n := n) ε (Tp x))) (gDefault n) :=
|
| 31 |
+
rfl
|
| 32 |
+
|
| 33 |
+
/-- Under Uniform ξ=1 and g=0, step = stabilized branch. -/
|
| 34 |
+
theorem step_eq_stabilized {n : Nat} (ε δ : Scalar) (t : Time) (x : Carrier n) :
|
| 35 |
+
step (n := n) ε δ t x = stabilized (n := n) ε δ x := by
|
| 36 |
+
funext j
|
| 37 |
+
simp only [step, hcalcStepCore, Xi_uniform_zero_kick, stabilized, C_circ_Tp]
|
| 38 |
+
|
| 39 |
+
/-- Intermediate after contraction, before evolution. -/
|
| 40 |
+
noncomputable def contracted {n : Nat} (ε δ : Scalar) (x : Carrier n) : Carrier n :=
|
| 41 |
+
stabilized (n := n) ε δ x
|
| 42 |
+
|
| 43 |
+
theorem step_eq_Xi_contracted {n : Nat} (ε δ : Scalar) (t : Time) (x : Carrier n) :
|
| 44 |
+
step (n := n) ε δ t x = Xi (n := n) t (contracted (n := n) ε δ x) (gDefault n) :=
|
| 45 |
+
rfl
|
| 46 |
+
|
| 47 |
+
/-- OptObj residual for the nested step at time t. -/
|
| 48 |
+
noncomputable def J {n : Nat} (ε δ : Scalar) (t : Time) (x : Carrier n) : Scalar :=
|
| 49 |
+
evalOptObj (step (n := n) ε δ t) x
|
| 50 |
+
|
| 51 |
+
/-- Optimize: iterate nested step `k` times. -/
|
| 52 |
+
noncomputable def optimize {n : Nat} (ε δ : Scalar) (t : Time) (k : Nat) (x : Carrier n) :
|
| 53 |
+
Carrier n :=
|
| 54 |
+
iterate (step (n := n) ε δ t) k x
|
| 55 |
+
|
| 56 |
+
/-- Stop when residual below production tol. -/
|
| 57 |
+
noncomputable def done {n : Nat} (ε δ : Scalar) (t : Time) (x : Carrier n) : Prop :=
|
| 58 |
+
residualBelowTol (step (n := n) ε δ t) tolProd x
|
| 59 |
+
|
| 60 |
+
end Hcalc.Pipeline
|
lean/Hcalc/Production.lean
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/-
|
| 2 |
+
Copyright (C) 2026 HCALC contributors
|
| 3 |
+
SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
|
| 5 |
+
PRODUCTION surface re-exports (authority: ../spec/PRODUCTION.md).
|
| 6 |
+
Domain Gap-* defs live in Hcalc.Axioms / Hcalc.Carrier.
|
| 7 |
+
-/
|
| 8 |
+
|
| 9 |
+
import Hcalc.Axioms
|
| 10 |
+
import Hcalc.Carrier
|
| 11 |
+
import Hcalc.Pipeline
|
| 12 |
+
import Hcalc.Convergence
|
| 13 |
+
|
| 14 |
+
namespace Hcalc.Production
|
| 15 |
+
|
| 16 |
+
export Hcalc (Carrier Tp C LambdaM Xi InstanceBridge hcalcStepCore toFoundryStep
|
| 17 |
+
epsProd deltaProd tolProd evalOptObj residualNorm
|
| 18 |
+
definitionRecord_Tp definitionRecord_C definitionRecord_LambdaM definitionRecord_Xi
|
| 19 |
+
definitionRecord_Carrier definitionRecord_OptObj definitionRecord_ContractAlg
|
| 20 |
+
definitionRecord_ShapeMap definitionRecord_Converge)
|
| 21 |
+
|
| 22 |
+
export Hcalc.Pipeline (step stepProd J optimize done)
|
| 23 |
+
export Hcalc.Convergence (HypContractive unique_fixed_point)
|
| 24 |
+
|
| 25 |
+
end Hcalc.Production
|
lean/Hcalc/RealStub.lean
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/-
|
| 2 |
+
Copyright (C) 2026 HCALC contributors
|
| 3 |
+
SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
|
| 5 |
+
Minimal Real stub (no Mathlib). Infrastructure Gap-Real-arith only.
|
| 6 |
+
Production domain symbols are defs in other modules (PRODUCTION.md).
|
| 7 |
+
-/
|
| 8 |
+
|
| 9 |
+
namespace Hcalc
|
| 10 |
+
|
| 11 |
+
axiom Real : Type
|
| 12 |
+
axiom realZero : Real
|
| 13 |
+
axiom realOne : Real
|
| 14 |
+
axiom realAdd : Real → Real → Real
|
| 15 |
+
axiom realMul : Real → Real → Real
|
| 16 |
+
axiom realNeg : Real → Real
|
| 17 |
+
axiom realAbs : Real → Real
|
| 18 |
+
axiom realLt : Real → Real → Prop
|
| 19 |
+
axiom realDiv : Real → Real → Real
|
| 20 |
+
axiom natToReal : Nat → Real
|
| 21 |
+
axiom realLog : Real → Real
|
| 22 |
+
axiom realMin : Real → Real → Real
|
| 23 |
+
axiom finMax : {n : Nat} → (Fin n → Real) → Real
|
| 24 |
+
|
| 25 |
+
noncomputable instance : Zero Real := ⟨realZero⟩
|
| 26 |
+
noncomputable instance : One Real := ⟨realOne⟩
|
| 27 |
+
noncomputable instance : Add Real := ⟨realAdd⟩
|
| 28 |
+
noncomputable instance : Mul Real := ⟨realMul⟩
|
| 29 |
+
noncomputable instance : Neg Real := ⟨realNeg⟩
|
| 30 |
+
|
| 31 |
+
noncomputable def realSub (a b : Real) : Real := realAdd a (realNeg b)
|
| 32 |
+
noncomputable instance : Sub Real := ⟨realSub⟩
|
| 33 |
+
|
| 34 |
+
infix:50 " <ᵣ " => realLt
|
| 35 |
+
notation "‖" x "‖ᵣ" => realAbs x
|
| 36 |
+
def realLe (a b : Real) : Prop := realLt a b ∨ a = b
|
| 37 |
+
infix:50 " ≤ᵣ " => realLe
|
| 38 |
+
|
| 39 |
+
axiom real_add_comm (a b : Real) : a + b = b + a
|
| 40 |
+
axiom real_add_assoc (a b c : Real) : (a + b) + c = a + (b + c)
|
| 41 |
+
axiom real_mul_comm (a b : Real) : a * b = b * a
|
| 42 |
+
axiom real_mul_assoc (a b c : Real) : (a * b) * c = a * (b * c)
|
| 43 |
+
axiom real_zero_add (a : Real) : (0 : Real) + a = a
|
| 44 |
+
axiom real_add_zero (a : Real) : a + (0 : Real) = a
|
| 45 |
+
axiom real_one_mul (a : Real) : (1 : Real) * a = a
|
| 46 |
+
axiom real_mul_one (a : Real) : a * (1 : Real) = a
|
| 47 |
+
axiom real_zero_mul (a : Real) : (0 : Real) * a = (0 : Real)
|
| 48 |
+
axiom real_mul_zero (a : Real) : a * (0 : Real) = (0 : Real)
|
| 49 |
+
axiom real_neg_add_cancel (a : Real) : a + (-a) = (0 : Real)
|
| 50 |
+
axiom real_abs_nonneg (a : Real) : (0 : Real) ≤ᵣ ‖a‖ᵣ
|
| 51 |
+
axiom real_abs_zero : ‖(0 : Real)‖ᵣ = (0 : Real)
|
| 52 |
+
axiom real_abs_abs (a : Real) : ‖‖a‖ᵣ‖ᵣ = ‖a‖ᵣ
|
| 53 |
+
axiom real_lt_irrefl (a : Real) : ¬ (a <ᵣ a)
|
| 54 |
+
axiom real_lt_asymm {a b : Real} : a <ᵣ b → ¬ b <ᵣ a
|
| 55 |
+
axiom real_abs_eq_zero_iff (a : Real) : ‖a‖ᵣ = (0 : Real) ↔ a = (0 : Real)
|
| 56 |
+
axiom real_mul_add (a b c : Real) : a * (b + c) = a * b + a * c
|
| 57 |
+
axiom real_abs_mul (a b : Real) : ‖a * b‖ᵣ = ‖a‖ᵣ * ‖b‖ᵣ
|
| 58 |
+
axiom natToReal_pos {n : Nat} (h : 0 < n) : (0 : Real) <ᵣ natToReal n
|
| 59 |
+
axiom natToReal_zero : natToReal 0 = (0 : Real)
|
| 60 |
+
axiom natToReal_one : natToReal 1 = (1 : Real)
|
| 61 |
+
axiom softScaleFactor : Real → Real → Real
|
| 62 |
+
axiom softScaleFactor_of_le (ε q : Real)
|
| 63 |
+
(_h : q <ᵣ ((1 : Real) - ε) ∨ q = ((1 : Real) - ε)) :
|
| 64 |
+
softScaleFactor ε q = (1 : Real)
|
| 65 |
+
axiom softScaleFactor_of_gt (ε q : Real)
|
| 66 |
+
(_h : ((1 : Real) - ε) <ᵣ q) :
|
| 67 |
+
softScaleFactor ε q = realDiv ((1 : Real) - ε) q
|
| 68 |
+
axiom realMin_le_left (a b : Real) : realMin a b ≤ᵣ a
|
| 69 |
+
axiom realMin_le_right (a b : Real) : realMin a b ≤ᵣ b
|
| 70 |
+
axiom finMax_abs_eq_zero_of {n : Nat} (x : Fin n → Real)
|
| 71 |
+
(h : finMax (fun j => ‖x j‖ᵣ) = (0 : Real)) : ∀ j, x j = (0 : Real)
|
| 72 |
+
axiom real_contract_force_zero (a q : Real)
|
| 73 |
+
(hnn : (0 : Real) ≤ᵣ a) (hq : q <ᵣ (1 : Real)) (hle : a ≤ᵣ q * a) : a = (0 : Real)
|
| 74 |
+
axiom real_le_of_eq (a b : Real) (h : a = b) : a ≤ᵣ b
|
| 75 |
+
axiom deltaGuard : Real
|
| 76 |
+
axiom deltaGuard_pos : (0 : Real) <ᵣ deltaGuard
|
| 77 |
+
axiom tolDefault : Real
|
| 78 |
+
axiom tolDefault_pos : (0 : Real) <ᵣ tolDefault
|
| 79 |
+
noncomputable def epsDefault : Real := realDiv realOne (natToReal 20)
|
| 80 |
+
noncomputable def oneSub (ε : Real) : Real := (1 : Real) - ε
|
| 81 |
+
|
| 82 |
+
theorem real_sub_self (a : Real) : a - a = (0 : Real) := by
|
| 83 |
+
change a + (-a) = (0 : Real)
|
| 84 |
+
exact real_neg_add_cancel a
|
| 85 |
+
|
| 86 |
+
abbrev Scalar := Real
|
| 87 |
+
|
| 88 |
+
end Hcalc
|
lean/LICENSE
ADDED
|
@@ -0,0 +1,699 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: GNU Affero General Public License v3.0
|
| 3 |
+
spdx-id: AGPL-3.0
|
| 4 |
+
nickname: GNU AGPLv3
|
| 5 |
+
redirect_from: /licenses/agpl/
|
| 6 |
+
hidden: false
|
| 7 |
+
|
| 8 |
+
description: Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.
|
| 9 |
+
|
| 10 |
+
how: Create a text file (typically named LICENSE or LICENSE.txt) in the root of your source code and copy the text of the license into the file.
|
| 11 |
+
|
| 12 |
+
note: The Free Software Foundation recommends taking the additional step of adding a boilerplate notice to the top of each file. The boilerplate can be found at the end of the license.
|
| 13 |
+
|
| 14 |
+
using:
|
| 15 |
+
Grafana: https://github.com/grafana/grafana/blob/main/LICENSE
|
| 16 |
+
Mastodon: https://github.com/mastodon/mastodon/blob/main/LICENSE
|
| 17 |
+
Nextcloud Server: https://github.com/nextcloud/server/blob/master/COPYING
|
| 18 |
+
|
| 19 |
+
permissions:
|
| 20 |
+
- commercial-use
|
| 21 |
+
- modifications
|
| 22 |
+
- distribution
|
| 23 |
+
- patent-use
|
| 24 |
+
- private-use
|
| 25 |
+
|
| 26 |
+
conditions:
|
| 27 |
+
- include-copyright
|
| 28 |
+
- document-changes
|
| 29 |
+
- disclose-source
|
| 30 |
+
- network-use-disclose
|
| 31 |
+
- same-license
|
| 32 |
+
|
| 33 |
+
limitations:
|
| 34 |
+
- liability
|
| 35 |
+
- warranty
|
| 36 |
+
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
GNU AFFERO GENERAL PUBLIC LICENSE
|
| 40 |
+
Version 3, 19 November 2007
|
| 41 |
+
|
| 42 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
| 43 |
+
Everyone is permitted to copy and distribute verbatim copies
|
| 44 |
+
of this license document, but changing it is not allowed.
|
| 45 |
+
|
| 46 |
+
Preamble
|
| 47 |
+
|
| 48 |
+
The GNU Affero General Public License is a free, copyleft license for
|
| 49 |
+
software and other kinds of works, specifically designed to ensure
|
| 50 |
+
cooperation with the community in the case of network server software.
|
| 51 |
+
|
| 52 |
+
The licenses for most software and other practical works are designed
|
| 53 |
+
to take away your freedom to share and change the works. By contrast,
|
| 54 |
+
our General Public Licenses are intended to guarantee your freedom to
|
| 55 |
+
share and change all versions of a program--to make sure it remains free
|
| 56 |
+
software for all its users.
|
| 57 |
+
|
| 58 |
+
When we speak of free software, we are referring to freedom, not
|
| 59 |
+
price. Our General Public Licenses are designed to make sure that you
|
| 60 |
+
have the freedom to distribute copies of free software (and charge for
|
| 61 |
+
them if you wish), that you receive source code or can get it if you
|
| 62 |
+
want it, that you can change the software or use pieces of it in new
|
| 63 |
+
free programs, and that you know you can do these things.
|
| 64 |
+
|
| 65 |
+
Developers that use our General Public Licenses protect your rights
|
| 66 |
+
with two steps: (1) assert copyright on the software, and (2) offer
|
| 67 |
+
you this License which gives you legal permission to copy, distribute
|
| 68 |
+
and/or modify the software.
|
| 69 |
+
|
| 70 |
+
A secondary benefit of defending all users' freedom is that
|
| 71 |
+
improvements made in alternate versions of the program, if they
|
| 72 |
+
receive widespread use, become available for other developers to
|
| 73 |
+
incorporate. Many developers of free software are heartened and
|
| 74 |
+
encouraged by the resulting cooperation. However, in the case of
|
| 75 |
+
software used on network servers, this result may fail to come about.
|
| 76 |
+
The GNU General Public License permits making a modified version and
|
| 77 |
+
letting the public access it on a server without ever releasing its
|
| 78 |
+
source code to the public.
|
| 79 |
+
|
| 80 |
+
The GNU Affero General Public License is designed specifically to
|
| 81 |
+
ensure that, in such cases, the modified source code becomes available
|
| 82 |
+
to the community. It requires the operator of a network server to
|
| 83 |
+
provide the source code of the modified version running there to the
|
| 84 |
+
users of that server. Therefore, public use of a modified version, on
|
| 85 |
+
a publicly accessible server, gives the public access to the source
|
| 86 |
+
code of the modified version.
|
| 87 |
+
|
| 88 |
+
An older license, called the Affero General Public License and
|
| 89 |
+
published by Affero, was designed to accomplish similar goals. This is
|
| 90 |
+
a different license, not a version of the Affero GPL, but Affero has
|
| 91 |
+
released a new version of the Affero GPL which permits relicensing under
|
| 92 |
+
this license.
|
| 93 |
+
|
| 94 |
+
The precise terms and conditions for copying, distribution and
|
| 95 |
+
modification follow.
|
| 96 |
+
|
| 97 |
+
TERMS AND CONDITIONS
|
| 98 |
+
|
| 99 |
+
0. Definitions.
|
| 100 |
+
|
| 101 |
+
"This License" refers to version 3 of the GNU Affero General Public License.
|
| 102 |
+
|
| 103 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
| 104 |
+
works, such as semiconductor masks.
|
| 105 |
+
|
| 106 |
+
"The Program" refers to any copyrightable work licensed under this
|
| 107 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
| 108 |
+
"recipients" may be individuals or organizations.
|
| 109 |
+
|
| 110 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
| 111 |
+
in a fashion requiring copyright permission, other than the making of an
|
| 112 |
+
exact copy. The resulting work is called a "modified version" of the
|
| 113 |
+
earlier work or a work "based on" the earlier work.
|
| 114 |
+
|
| 115 |
+
A "covered work" means either the unmodified Program or a work based
|
| 116 |
+
on the Program.
|
| 117 |
+
|
| 118 |
+
To "propagate" a work means to do anything with it that, without
|
| 119 |
+
permission, would make you directly or secondarily liable for
|
| 120 |
+
infringement under applicable copyright law, except executing it on a
|
| 121 |
+
computer or modifying a private copy. Propagation includes copying,
|
| 122 |
+
distribution (with or without modification), making available to the
|
| 123 |
+
public, and in some countries other activities as well.
|
| 124 |
+
|
| 125 |
+
To "convey" a work means any kind of propagation that enables other
|
| 126 |
+
parties to make or receive copies. Mere interaction with a user through
|
| 127 |
+
a computer network, with no transfer of a copy, is not conveying.
|
| 128 |
+
|
| 129 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
| 130 |
+
to the extent that it includes a convenient and prominently visible
|
| 131 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
| 132 |
+
tells the user that there is no warranty for the work (except to the
|
| 133 |
+
extent that warranties are provided), that licensees may convey the
|
| 134 |
+
work under this License, and how to view a copy of this License. If
|
| 135 |
+
the interface presents a list of user commands or options, such as a
|
| 136 |
+
menu, a prominent item in the list meets this criterion.
|
| 137 |
+
|
| 138 |
+
1. Source Code.
|
| 139 |
+
|
| 140 |
+
The "source code" for a work means the preferred form of the work
|
| 141 |
+
for making modifications to it. "Object code" means any non-source
|
| 142 |
+
form of a work.
|
| 143 |
+
|
| 144 |
+
A "Standard Interface" means an interface that either is an official
|
| 145 |
+
standard defined by a recognized standards body, or, in the case of
|
| 146 |
+
interfaces specified for a particular programming language, one that
|
| 147 |
+
is widely used among developers working in that language.
|
| 148 |
+
|
| 149 |
+
The "System Libraries" of an executable work include anything, other
|
| 150 |
+
than the work as a whole, that (a) is included in the normal form of
|
| 151 |
+
packaging a Major Component, but which is not part of that Major
|
| 152 |
+
Component, and (b) serves only to enable use of the work with that
|
| 153 |
+
Major Component, or to implement a Standard Interface for which an
|
| 154 |
+
implementation is available to the public in source code form. A
|
| 155 |
+
"Major Component", in this context, means a major essential component
|
| 156 |
+
(kernel, window system, and so on) of the specific operating system
|
| 157 |
+
(if any) on which the executable work runs, or a compiler used to
|
| 158 |
+
produce the work, or an object code interpreter used to run it.
|
| 159 |
+
|
| 160 |
+
The "Corresponding Source" for a work in object code form means all
|
| 161 |
+
the source code needed to generate, install, and (for an executable
|
| 162 |
+
work) run the object code and to modify the work, including scripts to
|
| 163 |
+
control those activities. However, it does not include the work's
|
| 164 |
+
System Libraries, or general-purpose tools or generally available free
|
| 165 |
+
programs which are used unmodified in performing those activities but
|
| 166 |
+
which are not part of the work. For example, Corresponding Source
|
| 167 |
+
includes interface definition files associated with source files for
|
| 168 |
+
the work, and the source code for shared libraries and dynamically
|
| 169 |
+
linked subprograms that the work is specifically designed to require,
|
| 170 |
+
such as by intimate data communication or control flow between those
|
| 171 |
+
subprograms and other parts of the work.
|
| 172 |
+
|
| 173 |
+
The Corresponding Source need not include anything that users
|
| 174 |
+
can regenerate automatically from other parts of the Corresponding
|
| 175 |
+
Source.
|
| 176 |
+
|
| 177 |
+
The Corresponding Source for a work in source code form is that
|
| 178 |
+
same work.
|
| 179 |
+
|
| 180 |
+
2. Basic Permissions.
|
| 181 |
+
|
| 182 |
+
All rights granted under this License are granted for the term of
|
| 183 |
+
copyright on the Program, and are irrevocable provided the stated
|
| 184 |
+
conditions are met. This License explicitly affirms your unlimited
|
| 185 |
+
permission to run the unmodified Program. The output from running a
|
| 186 |
+
covered work is covered by this License only if the output, given its
|
| 187 |
+
content, constitutes a covered work. This License acknowledges your
|
| 188 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
| 189 |
+
|
| 190 |
+
You may make, run and propagate covered works that you do not
|
| 191 |
+
convey, without conditions so long as your license otherwise remains
|
| 192 |
+
in force. You may convey covered works to others for the sole purpose
|
| 193 |
+
of having them make modifications exclusively for you, or provide you
|
| 194 |
+
with facilities for running those works, provided that you comply with
|
| 195 |
+
the terms of this License in conveying all material for which you do
|
| 196 |
+
not control copyright. Those thus making or running the covered works
|
| 197 |
+
for you must do so exclusively on your behalf, under your direction
|
| 198 |
+
and control, on terms that prohibit them from making any copies of
|
| 199 |
+
your copyrighted material outside their relationship with you.
|
| 200 |
+
|
| 201 |
+
Conveying under any other circumstances is permitted solely under
|
| 202 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
| 203 |
+
makes it unnecessary.
|
| 204 |
+
|
| 205 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
| 206 |
+
|
| 207 |
+
No covered work shall be deemed part of an effective technological
|
| 208 |
+
measure under any applicable law fulfilling obligations under article
|
| 209 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
| 210 |
+
similar laws prohibiting or restricting circumvention of such
|
| 211 |
+
measures.
|
| 212 |
+
|
| 213 |
+
When you convey a covered work, you waive any legal power to forbid
|
| 214 |
+
circumvention of technological measures to the extent such circumvention
|
| 215 |
+
is effected by exercising rights under this License with respect to
|
| 216 |
+
the covered work, and you disclaim any intention to limit operation or
|
| 217 |
+
modification of the work as a means of enforcing, against the work's
|
| 218 |
+
users, your or third parties' legal rights to forbid circumvention of
|
| 219 |
+
technological measures.
|
| 220 |
+
|
| 221 |
+
4. Conveying Verbatim Copies.
|
| 222 |
+
|
| 223 |
+
You may convey verbatim copies of the Program's source code as you
|
| 224 |
+
receive it, in any medium, provided that you conspicuously and
|
| 225 |
+
appropriately publish on each copy an appropriate copyright notice;
|
| 226 |
+
keep intact all notices stating that this License and any
|
| 227 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
| 228 |
+
keep intact all notices of the absence of any warranty; and give all
|
| 229 |
+
recipients a copy of this License along with the Program.
|
| 230 |
+
|
| 231 |
+
You may charge any price or no price for each copy that you convey,
|
| 232 |
+
and you may offer support or warranty protection for a fee.
|
| 233 |
+
|
| 234 |
+
5. Conveying Modified Source Versions.
|
| 235 |
+
|
| 236 |
+
You may convey a work based on the Program, or the modifications to
|
| 237 |
+
produce it from the Program, in the form of source code under the
|
| 238 |
+
terms of section 4, provided that you also meet all of these conditions:
|
| 239 |
+
|
| 240 |
+
a) The work must carry prominent notices stating that you modified
|
| 241 |
+
it, and giving a relevant date.
|
| 242 |
+
|
| 243 |
+
b) The work must carry prominent notices stating that it is
|
| 244 |
+
released under this License and any conditions added under section
|
| 245 |
+
7. This requirement modifies the requirement in section 4 to
|
| 246 |
+
"keep intact all notices".
|
| 247 |
+
|
| 248 |
+
c) You must license the entire work, as a whole, under this
|
| 249 |
+
License to anyone who comes into possession of a copy. This
|
| 250 |
+
License will therefore apply, along with any applicable section 7
|
| 251 |
+
additional terms, to the whole of the work, and all its parts,
|
| 252 |
+
regardless of how they are packaged. This License gives no
|
| 253 |
+
permission to license the work in any other way, but it does not
|
| 254 |
+
invalidate such permission if you have separately received it.
|
| 255 |
+
|
| 256 |
+
d) If the work has interactive user interfaces, each must display
|
| 257 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
| 258 |
+
interfaces that do not display Appropriate Legal Notices, your
|
| 259 |
+
work need not make them do so.
|
| 260 |
+
|
| 261 |
+
A compilation of a covered work with other separate and independent
|
| 262 |
+
works, which are not by their nature extensions of the covered work,
|
| 263 |
+
and which are not combined with it such as to form a larger program,
|
| 264 |
+
in or on a volume of a storage or distribution medium, is called an
|
| 265 |
+
"aggregate" if the compilation and its resulting copyright are not
|
| 266 |
+
used to limit the access or legal rights of the compilation's users
|
| 267 |
+
beyond what the individual works permit. Inclusion of a covered work
|
| 268 |
+
in an aggregate does not cause this License to apply to the other
|
| 269 |
+
parts of the aggregate.
|
| 270 |
+
|
| 271 |
+
6. Conveying Non-Source Forms.
|
| 272 |
+
|
| 273 |
+
You may convey a covered work in object code form under the terms
|
| 274 |
+
of sections 4 and 5, provided that you also convey the
|
| 275 |
+
machine-readable Corresponding Source under the terms of this License,
|
| 276 |
+
in one of these ways:
|
| 277 |
+
|
| 278 |
+
a) Convey the object code in, or embodied in, a physical product
|
| 279 |
+
(including a physical distribution medium), accompanied by the
|
| 280 |
+
Corresponding Source fixed on a durable physical medium
|
| 281 |
+
customarily used for software interchange.
|
| 282 |
+
|
| 283 |
+
b) Convey the object code in, or embodied in, a physical product
|
| 284 |
+
(including a physical distribution medium), accompanied by a
|
| 285 |
+
written offer, valid for at least three years and valid for as
|
| 286 |
+
long as you offer spare parts or customer support for that product
|
| 287 |
+
model, to give anyone who possesses the object code either (1) a
|
| 288 |
+
copy of the Corresponding Source for all the software in the
|
| 289 |
+
product that is covered by this License, on a durable physical
|
| 290 |
+
medium customarily used for software interchange, for a price no
|
| 291 |
+
more than your reasonable cost of physically performing this
|
| 292 |
+
conveying of source, or (2) access to copy the
|
| 293 |
+
Corresponding Source from a network server at no charge.
|
| 294 |
+
|
| 295 |
+
c) Convey individual copies of the object code with a copy of the
|
| 296 |
+
written offer to provide the Corresponding Source. This
|
| 297 |
+
alternative is allowed only occasionally and noncommercially, and
|
| 298 |
+
only if you received the object code with such an offer, in accord
|
| 299 |
+
with subsection 6b.
|
| 300 |
+
|
| 301 |
+
d) Convey the object code by offering access from a designated
|
| 302 |
+
place (gratis or for a charge), and offer equivalent access to the
|
| 303 |
+
Corresponding Source in the same way through the same place at no
|
| 304 |
+
further charge. You need not require recipients to copy the
|
| 305 |
+
Corresponding Source along with the object code. If the place to
|
| 306 |
+
copy the object code is a network server, the Corresponding Source
|
| 307 |
+
may be on a different server (operated by you or a third party)
|
| 308 |
+
that supports equivalent copying facilities, provided you maintain
|
| 309 |
+
clear directions next to the object code saying where to find the
|
| 310 |
+
Corresponding Source. Regardless of what server hosts the
|
| 311 |
+
Corresponding Source, you remain obligated to ensure that it is
|
| 312 |
+
available for as long as needed to satisfy these requirements.
|
| 313 |
+
|
| 314 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
| 315 |
+
you inform other peers where the object code and Corresponding
|
| 316 |
+
Source of the work are being offered to the general public at no
|
| 317 |
+
charge under subsection 6d.
|
| 318 |
+
|
| 319 |
+
A separable portion of the object code, whose source code is excluded
|
| 320 |
+
from the Corresponding Source as a System Library, need not be
|
| 321 |
+
included in conveying the object code work.
|
| 322 |
+
|
| 323 |
+
A "User Product" is either (1) a "consumer product", which means any
|
| 324 |
+
tangible personal property which is normally used for personal, family,
|
| 325 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
| 326 |
+
into a dwelling. In determining whether a product is a consumer product,
|
| 327 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
| 328 |
+
product received by a particular user, "normally used" refers to a
|
| 329 |
+
typical or common use of that class of product, regardless of the status
|
| 330 |
+
of the particular user or of the way in which the particular user
|
| 331 |
+
actually uses, or expects or is expected to use, the product. A product
|
| 332 |
+
is a consumer product regardless of whether the product has substantial
|
| 333 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
| 334 |
+
the only significant mode of use of the product.
|
| 335 |
+
|
| 336 |
+
"Installation Information" for a User Product means any methods,
|
| 337 |
+
procedures, authorization keys, or other information required to install
|
| 338 |
+
and execute modified versions of a covered work in that User Product from
|
| 339 |
+
a modified version of its Corresponding Source. The information must
|
| 340 |
+
suffice to ensure that the continued functioning of the modified object
|
| 341 |
+
code is in no case prevented or interfered with solely because
|
| 342 |
+
modification has been made.
|
| 343 |
+
|
| 344 |
+
If you convey an object code work under this section in, or with, or
|
| 345 |
+
specifically for use in, a User Product, and the conveying occurs as
|
| 346 |
+
part of a transaction in which the right of possession and use of the
|
| 347 |
+
User Product is transferred to the recipient in perpetuity or for a
|
| 348 |
+
fixed term (regardless of how the transaction is characterized), the
|
| 349 |
+
Corresponding Source conveyed under this section must be accompanied
|
| 350 |
+
by the Installation Information. But this requirement does not apply
|
| 351 |
+
if neither you nor any third party retains the ability to install
|
| 352 |
+
modified object code on the User Product (for example, the work has
|
| 353 |
+
been installed in ROM).
|
| 354 |
+
|
| 355 |
+
The requirement to provide Installation Information does not include a
|
| 356 |
+
requirement to continue to provide support service, warranty, or updates
|
| 357 |
+
for a work that has been modified or installed by the recipient, or for
|
| 358 |
+
the User Product in which it has been modified or installed. Access to a
|
| 359 |
+
network may be denied when the modification itself materially and
|
| 360 |
+
adversely affects the operation of the network or violates the rules and
|
| 361 |
+
protocols for communication across the network.
|
| 362 |
+
|
| 363 |
+
Corresponding Source conveyed, and Installation Information provided,
|
| 364 |
+
in accord with this section must be in a format that is publicly
|
| 365 |
+
documented (and with an implementation available to the public in
|
| 366 |
+
source code form), and must require no special password or key for
|
| 367 |
+
unpacking, reading or copying.
|
| 368 |
+
|
| 369 |
+
7. Additional Terms.
|
| 370 |
+
|
| 371 |
+
"Additional permissions" are terms that supplement the terms of this
|
| 372 |
+
License by making exceptions from one or more of its conditions.
|
| 373 |
+
Additional permissions that are applicable to the entire Program shall
|
| 374 |
+
be treated as though they were included in this License, to the extent
|
| 375 |
+
that they are valid under applicable law. If additional permissions
|
| 376 |
+
apply only to part of the Program, that part may be used separately
|
| 377 |
+
under those permissions, but the entire Program remains governed by
|
| 378 |
+
this License without regard to the additional permissions.
|
| 379 |
+
|
| 380 |
+
When you convey a copy of a covered work, you may at your option
|
| 381 |
+
remove any additional permissions from that copy, or from any part of
|
| 382 |
+
it. (Additional permissions may be written to require their own
|
| 383 |
+
removal in certain cases when you modify the work.) You may place
|
| 384 |
+
additional permissions on material, added by you to a covered work,
|
| 385 |
+
for which you have or can give appropriate copyright permission.
|
| 386 |
+
|
| 387 |
+
Notwithstanding any other provision of this License, for material you
|
| 388 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
| 389 |
+
that material) supplement the terms of this License with terms:
|
| 390 |
+
|
| 391 |
+
a) Disclaiming warranty or limiting liability differently from the
|
| 392 |
+
terms of sections 15 and 16 of this License; or
|
| 393 |
+
|
| 394 |
+
b) Requiring preservation of specified reasonable legal notices or
|
| 395 |
+
author attributions in that material or in the Appropriate Legal
|
| 396 |
+
Notices displayed by works containing it; or
|
| 397 |
+
|
| 398 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
| 399 |
+
requiring that modified versions of such material be marked in
|
| 400 |
+
reasonable ways as different from the original version; or
|
| 401 |
+
|
| 402 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
| 403 |
+
authors of the material; or
|
| 404 |
+
|
| 405 |
+
e) Declining to grant rights under trademark law for use of some
|
| 406 |
+
trade names, trademarks, or service marks; or
|
| 407 |
+
|
| 408 |
+
f) Requiring indemnification of licensors and authors of that
|
| 409 |
+
material by anyone who conveys the material (or modified versions of
|
| 410 |
+
it) with contractual assumptions of liability to the recipient, for
|
| 411 |
+
any liability that these contractual assumptions directly impose on
|
| 412 |
+
those licensors and authors.
|
| 413 |
+
|
| 414 |
+
All other non-permissive additional terms are considered "further
|
| 415 |
+
restrictions" within the meaning of section 10. If the Program as you
|
| 416 |
+
received it, or any part of it, contains a notice stating that it is
|
| 417 |
+
governed by this License along with a term that is a further
|
| 418 |
+
restriction, you may remove that term. If a license document contains
|
| 419 |
+
a further restriction but permits relicensing or conveying under this
|
| 420 |
+
License, you may add to a covered work material governed by the terms
|
| 421 |
+
of that license document, provided that the further restriction does
|
| 422 |
+
not survive such relicensing or conveying.
|
| 423 |
+
|
| 424 |
+
If you add terms to a covered work in accord with this section, you
|
| 425 |
+
must place, in the relevant source files, a statement of the
|
| 426 |
+
additional terms that apply to those files, or a notice indicating
|
| 427 |
+
where to find the applicable terms.
|
| 428 |
+
|
| 429 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
| 430 |
+
form of a separately written license, or stated as exceptions;
|
| 431 |
+
the above requirements apply either way.
|
| 432 |
+
|
| 433 |
+
8. Termination.
|
| 434 |
+
|
| 435 |
+
You may not propagate or modify a covered work except as expressly
|
| 436 |
+
provided under this License. Any attempt otherwise to propagate or
|
| 437 |
+
modify it is void, and will automatically terminate your rights under
|
| 438 |
+
this License (including any patent licenses granted under the third
|
| 439 |
+
paragraph of section 11).
|
| 440 |
+
|
| 441 |
+
However, if you cease all violation of this License, then your
|
| 442 |
+
license from a particular copyright holder is reinstated (a)
|
| 443 |
+
provisionally, unless and until the copyright holder explicitly and
|
| 444 |
+
finally terminates your license, and (b) permanently, if the copyright
|
| 445 |
+
holder fails to notify you of the violation by some reasonable means
|
| 446 |
+
prior to 60 days after the cessation.
|
| 447 |
+
|
| 448 |
+
Moreover, your license from a particular copyright holder is
|
| 449 |
+
reinstated permanently if the copyright holder notifies you of the
|
| 450 |
+
violation by some reasonable means, this is the first time you have
|
| 451 |
+
received notice of violation of this License (for any work) from that
|
| 452 |
+
copyright holder, and you cure the violation prior to 30 days after
|
| 453 |
+
your receipt of the notice.
|
| 454 |
+
|
| 455 |
+
Termination of your rights under this section does not terminate the
|
| 456 |
+
licenses of parties who have received copies or rights from you under
|
| 457 |
+
this License. If your rights have been terminated and not permanently
|
| 458 |
+
reinstated, you do not qualify to receive new licenses for the same
|
| 459 |
+
material under section 10.
|
| 460 |
+
|
| 461 |
+
9. Acceptance Not Required for Having Copies.
|
| 462 |
+
|
| 463 |
+
You are not required to accept this License in order to receive or
|
| 464 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
| 465 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
| 466 |
+
to receive a copy likewise does not require acceptance. However,
|
| 467 |
+
nothing other than this License grants you permission to propagate or
|
| 468 |
+
modify any covered work. These actions infringe copyright if you do
|
| 469 |
+
not accept this License. Therefore, by modifying or propagating a
|
| 470 |
+
covered work, you indicate your acceptance of this License to do so.
|
| 471 |
+
|
| 472 |
+
10. Automatic Licensing of Downstream Recipients.
|
| 473 |
+
|
| 474 |
+
Each time you convey a covered work, the recipient automatically
|
| 475 |
+
receives a license from the original licensors, to run, modify and
|
| 476 |
+
propagate that work, subject to this License. You are not responsible
|
| 477 |
+
for enforcing compliance by third parties with this License.
|
| 478 |
+
|
| 479 |
+
An "entity transaction" is a transaction transferring control of an
|
| 480 |
+
organization, or substantially all assets of one, or subdividing an
|
| 481 |
+
organization, or merging organizations. If propagation of a covered
|
| 482 |
+
work results from an entity transaction, each party to that
|
| 483 |
+
transaction who receives a copy of the work also receives whatever
|
| 484 |
+
licenses to the work the party's predecessor in interest had or could
|
| 485 |
+
give under the previous paragraph, plus a right to possession of the
|
| 486 |
+
Corresponding Source of the work from the predecessor in interest, if
|
| 487 |
+
the predecessor has it or can get it with reasonable efforts.
|
| 488 |
+
|
| 489 |
+
You may not impose any further restrictions on the exercise of the
|
| 490 |
+
rights granted or affirmed under this License. For example, you may
|
| 491 |
+
not impose a license fee, royalty, or other charge for exercise of
|
| 492 |
+
rights granted under this License, and you may not initiate litigation
|
| 493 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
| 494 |
+
any patent claim is infringed by making, using, selling, offering for
|
| 495 |
+
sale, or importing the Program or any portion of it.
|
| 496 |
+
|
| 497 |
+
11. Patents.
|
| 498 |
+
|
| 499 |
+
A "contributor" is a copyright holder who authorizes use under this
|
| 500 |
+
License of the Program or a work on which the Program is based. The
|
| 501 |
+
work thus licensed is called the contributor's "contributor version".
|
| 502 |
+
|
| 503 |
+
A contributor's "essential patent claims" are all patent claims
|
| 504 |
+
owned or controlled by the contributor, whether already acquired or
|
| 505 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
| 506 |
+
by this License, of making, using, or selling its contributor version,
|
| 507 |
+
but do not include claims that would be infringed only as a
|
| 508 |
+
consequence of further modification of the contributor version. For
|
| 509 |
+
purposes of this definition, "control" includes the right to grant
|
| 510 |
+
patent sublicenses in a manner consistent with the requirements of
|
| 511 |
+
this License.
|
| 512 |
+
|
| 513 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
| 514 |
+
patent license under the contributor's essential patent claims, to
|
| 515 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
| 516 |
+
propagate the contents of its contributor version.
|
| 517 |
+
|
| 518 |
+
In the following three paragraphs, a "patent license" is any express
|
| 519 |
+
agreement or commitment, however denominated, not to enforce a patent
|
| 520 |
+
(such as an express permission to practice a patent or covenant not to
|
| 521 |
+
sue for patent infringement). To "grant" such a patent license to a
|
| 522 |
+
party means to make such an agreement or commitment not to enforce a
|
| 523 |
+
patent against the party.
|
| 524 |
+
|
| 525 |
+
If you convey a covered work, knowingly relying on a patent license,
|
| 526 |
+
and the Corresponding Source of the work is not available for anyone
|
| 527 |
+
to copy, free of charge and under the terms of this License, through a
|
| 528 |
+
publicly available network server or other readily accessible means,
|
| 529 |
+
then you must either (1) cause the Corresponding Source to be so
|
| 530 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
| 531 |
+
patent license for this particular work, or (3) arrange, in a manner
|
| 532 |
+
consistent with the requirements of this License, to extend the patent
|
| 533 |
+
license to downstream recipients. "Knowingly relying" means you have
|
| 534 |
+
actual knowledge that, but for the patent license, your conveying the
|
| 535 |
+
covered work in a country, or your recipient's use of the covered work
|
| 536 |
+
in a country, would infringe one or more identifiable patents in that
|
| 537 |
+
country that you have reason to believe are valid.
|
| 538 |
+
|
| 539 |
+
If, pursuant to or in connection with a single transaction or
|
| 540 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
| 541 |
+
covered work, and grant a patent license to some of the parties
|
| 542 |
+
receiving the covered work authorizing them to use, propagate, modify
|
| 543 |
+
or convey a specific copy of the covered work, then the patent license
|
| 544 |
+
you grant is automatically extended to all recipients of the covered
|
| 545 |
+
work and works based on it.
|
| 546 |
+
|
| 547 |
+
A patent license is "discriminatory" if it does not include within
|
| 548 |
+
the scope of its coverage, prohibits the exercise of, or is
|
| 549 |
+
conditioned on the non-exercise of one or more of the rights that are
|
| 550 |
+
specifically granted under this License. You may not convey a covered
|
| 551 |
+
work if you are a party to an arrangement with a third party that is
|
| 552 |
+
in the business of distributing software, under which you make payment
|
| 553 |
+
to the third party based on the extent of your activity of conveying
|
| 554 |
+
the work, and under which the third party grants, to any of the
|
| 555 |
+
parties who would receive the covered work from you, a discriminatory
|
| 556 |
+
patent license (a) in connection with copies of the covered work
|
| 557 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
| 558 |
+
for and in connection with specific products or compilations that
|
| 559 |
+
contain the covered work, unless you entered into that arrangement,
|
| 560 |
+
or that patent license was granted, prior to 28 March 2007.
|
| 561 |
+
|
| 562 |
+
Nothing in this License shall be construed as excluding or limiting
|
| 563 |
+
any implied license or other defenses to infringement that may
|
| 564 |
+
otherwise be available to you under applicable patent law.
|
| 565 |
+
|
| 566 |
+
12. No Surrender of Others' Freedom.
|
| 567 |
+
|
| 568 |
+
If conditions are imposed on you (whether by court order, agreement or
|
| 569 |
+
otherwise) that contradict the conditions of this License, they do not
|
| 570 |
+
excuse you from the conditions of this License. If you cannot convey a
|
| 571 |
+
covered work so as to satisfy simultaneously your obligations under this
|
| 572 |
+
License and any other pertinent obligations, then as a consequence you may
|
| 573 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
| 574 |
+
to collect a royalty for further conveying from those to whom you convey
|
| 575 |
+
the Program, the only way you could satisfy both those terms and this
|
| 576 |
+
License would be to refrain entirely from conveying the Program.
|
| 577 |
+
|
| 578 |
+
13. Remote Network Interaction; Use with the GNU General Public License.
|
| 579 |
+
|
| 580 |
+
Notwithstanding any other provision of this License, if you modify the
|
| 581 |
+
Program, your modified version must prominently offer all users
|
| 582 |
+
interacting with it remotely through a computer network (if your version
|
| 583 |
+
supports such interaction) an opportunity to receive the Corresponding
|
| 584 |
+
Source of your version by providing access to the Corresponding Source
|
| 585 |
+
from a network server at no charge, through some standard or customary
|
| 586 |
+
means of facilitating copying of software. This Corresponding Source
|
| 587 |
+
shall include the Corresponding Source for any work covered by version 3
|
| 588 |
+
of the GNU General Public License that is incorporated pursuant to the
|
| 589 |
+
following paragraph.
|
| 590 |
+
|
| 591 |
+
Notwithstanding any other provision of this License, you have
|
| 592 |
+
permission to link or combine any covered work with a work licensed
|
| 593 |
+
under version 3 of the GNU General Public License into a single
|
| 594 |
+
combined work, and to convey the resulting work. The terms of this
|
| 595 |
+
License will continue to apply to the part which is the covered work,
|
| 596 |
+
but the work with which it is combined will remain governed by version
|
| 597 |
+
3 of the GNU General Public License.
|
| 598 |
+
|
| 599 |
+
14. Revised Versions of this License.
|
| 600 |
+
|
| 601 |
+
The Free Software Foundation may publish revised and/or new versions of
|
| 602 |
+
the GNU Affero General Public License from time to time. Such new versions
|
| 603 |
+
will be similar in spirit to the present version, but may differ in detail to
|
| 604 |
+
address new problems or concerns.
|
| 605 |
+
|
| 606 |
+
Each version is given a distinguishing version number. If the
|
| 607 |
+
Program specifies that a certain numbered version of the GNU Affero General
|
| 608 |
+
Public License "or any later version" applies to it, you have the
|
| 609 |
+
option of following the terms and conditions either of that numbered
|
| 610 |
+
version or of any later version published by the Free Software
|
| 611 |
+
Foundation. If the Program does not specify a version number of the
|
| 612 |
+
GNU Affero General Public License, you may choose any version ever published
|
| 613 |
+
by the Free Software Foundation.
|
| 614 |
+
|
| 615 |
+
If the Program specifies that a proxy can decide which future
|
| 616 |
+
versions of the GNU Affero General Public License can be used, that proxy's
|
| 617 |
+
public statement of acceptance of a version permanently authorizes you
|
| 618 |
+
to choose that version for the Program.
|
| 619 |
+
|
| 620 |
+
Later license versions may give you additional or different
|
| 621 |
+
permissions. However, no additional obligations are imposed on any
|
| 622 |
+
author or copyright holder as a result of your choosing to follow a
|
| 623 |
+
later version.
|
| 624 |
+
|
| 625 |
+
15. Disclaimer of Warranty.
|
| 626 |
+
|
| 627 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
| 628 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
| 629 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
| 630 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
| 631 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
| 632 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
| 633 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
| 634 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
| 635 |
+
|
| 636 |
+
16. Limitation of Liability.
|
| 637 |
+
|
| 638 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
| 639 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
| 640 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
| 641 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
| 642 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
| 643 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
| 644 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
| 645 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
| 646 |
+
SUCH DAMAGES.
|
| 647 |
+
|
| 648 |
+
17. Interpretation of Sections 15 and 16.
|
| 649 |
+
|
| 650 |
+
If the disclaimer of warranty and limitation of liability provided
|
| 651 |
+
above cannot be given local legal effect according to their terms,
|
| 652 |
+
reviewing courts shall apply local law that most closely approximates
|
| 653 |
+
an absolute waiver of all civil liability in connection with the
|
| 654 |
+
Program, unless a warranty or assumption of liability accompanies a
|
| 655 |
+
copy of the Program in return for a fee.
|
| 656 |
+
|
| 657 |
+
END OF TERMS AND CONDITIONS
|
| 658 |
+
|
| 659 |
+
How to Apply These Terms to Your New Programs
|
| 660 |
+
|
| 661 |
+
If you develop a new program, and you want it to be of the greatest
|
| 662 |
+
possible use to the public, the best way to achieve this is to make it
|
| 663 |
+
free software which everyone can redistribute and change under these terms.
|
| 664 |
+
|
| 665 |
+
To do so, attach the following notices to the program. It is safest
|
| 666 |
+
to attach them to the start of each source file to most effectively
|
| 667 |
+
state the exclusion of warranty; and each file should have at least
|
| 668 |
+
the "copyright" line and a pointer to where the full notice is found.
|
| 669 |
+
|
| 670 |
+
<one line to give the program's name and a brief idea of what it does.>
|
| 671 |
+
Copyright (C) <year> <name of author>
|
| 672 |
+
|
| 673 |
+
This program is free software: you can redistribute it and/or modify
|
| 674 |
+
it under the terms of the GNU Affero General Public License as published
|
| 675 |
+
by the Free Software Foundation, either version 3 of the License, or
|
| 676 |
+
(at your option) any later version.
|
| 677 |
+
|
| 678 |
+
This program is distributed in the hope that it will be useful,
|
| 679 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 680 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 681 |
+
GNU Affero General Public License for more details.
|
| 682 |
+
|
| 683 |
+
You should have received a copy of the GNU Affero General Public License
|
| 684 |
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 685 |
+
|
| 686 |
+
Also add information on how to contact you by electronic and paper mail.
|
| 687 |
+
|
| 688 |
+
If your software can interact with users remotely through a computer
|
| 689 |
+
network, you should also make sure that it provides a way for users to
|
| 690 |
+
get its source. For example, if your program is a web application, its
|
| 691 |
+
interface could display a "Source" link that leads users to an archive
|
| 692 |
+
of the code. There are many ways you could offer source, and different
|
| 693 |
+
solutions will be better for different programs; see section 13 for the
|
| 694 |
+
specific requirements.
|
| 695 |
+
|
| 696 |
+
You should also get your employer (if you work as a programmer) or school,
|
| 697 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
| 698 |
+
For more information on this, and how to apply and follow the GNU AGPL, see
|
| 699 |
+
<https://www.gnu.org/licenses/>.
|
lean/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# HCALC Lean 4 formalization (PRODUCTION)
|
| 2 |
+
|
| 3 |
+
**License:** AGPL-3.0-only (see [`LICENSE`](LICENSE))
|
| 4 |
+
**Copyright (C) 2026 HCALC contributors**
|
| 5 |
+
|
| 6 |
+
Production formalization of the HCALC nested recurrence
|
| 7 |
+
|
| 8 |
+
\[
|
| 9 |
+
X_{t+1} = \Xi\bigl(t,\; \Lambda_m \cdot C(T_p(X_t))\bigr)
|
| 10 |
+
\]
|
| 11 |
+
|
| 12 |
+
frozen to Spec [`../spec/PRODUCTION.md`](../spec/PRODUCTION.md) (overrides provisional L6 axioms in COHERENCE/AXIOMS).
|
| 13 |
+
|
| 14 |
+
## Provenance
|
| 15 |
+
|
| 16 |
+
| Part | Source |
|
| 17 |
+
|------|--------|
|
| 18 |
+
| Carrier, Tp α-diag, C softScale-or-id, Λm min-formula, Ξ=ξy+g, J=residual, L5 Hyp, L7 InstanceBridge | **Spec-file** `PRODUCTION.md` |
|
| 19 |
+
| Option B InstanceBridge (not NestedFaithful / not rfl) | **Spec-file** PRODUCTION.md §6 (f5a08da) |
|
| 20 |
+
| Mathlib `ℝ` (thin bridge in `RealStub`) | Mathlib4 `v4.34.1` |
|
| 21 |
+
| Foundry L1–L4 (P64, Gershgorin, FoundryStep additive, softProject schedules) | Spec + Foundry PROPERTIES (FoundryAdditive **distinct**) |
|
| 22 |
+
|
| 23 |
+
## Mathlib
|
| 24 |
+
|
| 25 |
+
- **Toolchain:** `leanprover/lean4:v4.34.1` (matches Mathlib tag `v4.34.1` lean-toolchain — no bump needed).
|
| 26 |
+
- **Dependency:** `leanprover-community/mathlib` @ `v4.34.1`.
|
| 27 |
+
- **Imports used (minimal):**
|
| 28 |
+
1. `Mathlib.Basic.Real.Basic` — `ℝ`, field/order/`abs`/`min`/`max`
|
| 29 |
+
2. `Mathlib.Analysis.SpecialFunctions.Log.Basic` — `Real.log` (pulls Exp; Topology transitive only)
|
| 30 |
+
- `finMax` uses core `Fin.foldl` only (no Finset / `Mathlib.Data.Fin`)
|
| 31 |
+
- No Topology / MeasureTheory / aesop / grind / large simp sets.
|
| 32 |
+
- Proofs are freehand `calc` / `rw` / `intro` / `apply` / elementary single-lemma `exact`.
|
| 33 |
+
|
| 34 |
+
### finMax / ℓ∞
|
| 35 |
+
|
| 36 |
+
`finMax` = `Fin.foldl` of `max` with init `0` (smallest surface; not `Finset.univ.sup'` / `iSup`).
|
| 37 |
+
Production sites pass nonnegative args (`|·|`, Gershgorin disks); `n = 0` yields `0`.
|
| 38 |
+
|
| 39 |
+
## Layout
|
| 40 |
+
|
| 41 |
+
| File | Role |
|
| 42 |
+
|------|------|
|
| 43 |
+
| `Hcalc/RealStub.lean` | Thin Mathlib `ℝ` re-exports + freehand Real lemmas (`finMax`, softScale, guards) |
|
| 44 |
+
| `Hcalc/Carrier.lean` | **Gap-Carrier CLOSED**: `Carrier n := Fin n → ℝ`, ℓ∞ |
|
| 45 |
+
| `Hcalc/Foundry.lean` | L1–L4 defs; FoundryAdditive `FoundryStep` (≠ nested); Gap-Foundry-* may remain |
|
| 46 |
+
| `Hcalc/Axioms.lean` | L6 **defs** Tp/C/Λm/Ξ/J/ContractAlg + **L7** `InstanceBridge` |
|
| 47 |
+
| `Hcalc/Pipeline.lean` | Nested `hcalcStep` / `step` / `J` / `optimize` |
|
| 48 |
+
| `Hcalc/Convergence.lean` | **L5** unique FP + residual under `HypContractive` |
|
| 49 |
+
| `Hcalc/Invariants.lean` | Structural invariants |
|
| 50 |
+
| `Hcalc/Production.lean` | Stable re-exports for Verify/docs |
|
| 51 |
+
|
| 52 |
+
## Rules
|
| 53 |
+
|
| 54 |
+
- Zero `sorry` / `admit`.
|
| 55 |
+
- Production Gap-* are **defs/theorems**, not opaque axioms.
|
| 56 |
+
- Gap-Real-arith for `Real` itself is **closed** (Mathlib `ℝ`). Gap-Foundry-* stubs OK if Foundry.State stays opaque.
|
| 57 |
+
- L7 = `InstanceBridge` Option B (parameter table + `toFoundryStep` diagnostic). **Not** `FoundryStep = hcalcStep`.
|
| 58 |
+
- C is state softScale-or-id; does **not** equal Foundry `softProject` on (Ξ,Λ) schedules.
|
| 59 |
+
- α (Tp weights) is Spec-only.
|
| 60 |
+
- No unconditional convergence — L5 under `HypContractive` only.
|
| 61 |
+
|
| 62 |
+
## Build
|
| 63 |
+
|
| 64 |
+
```bash
|
| 65 |
+
source ~/.elan/env
|
| 66 |
+
cd /workspace/hcalc/lean
|
| 67 |
+
lake update # first time / after mathlib pin change
|
| 68 |
+
lake exe cache get # download Mathlib oleans (recommended)
|
| 69 |
+
lake build 2>&1 | tee build.log
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
Toolchain: `leanprover/lean4:v4.34.1` + Mathlib `v4.34.1`.
|
lean/build.log
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
✔ [1962/1968] Built Hcalc.Axioms (2.0s)
|
| 2 |
+
Build completed successfully (1968 jobs).
|
lean/lake-manifest.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"version": "1.2.0",
|
| 2 |
+
"packagesDir": ".lake/packages",
|
| 3 |
+
"packages": [],
|
| 4 |
+
"name": "Hcalc",
|
| 5 |
+
"lakeDir": ".lake",
|
| 6 |
+
"fixedToolchain": false}
|
lean/lakefile.toml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name = "Hcalc"
|
| 2 |
+
version = "0.1.0"
|
| 3 |
+
defaultTargets = ["Hcalc"]
|
| 4 |
+
|
| 5 |
+
[[lean_lib]]
|
| 6 |
+
name = "Hcalc"
|
lean/lean-toolchain
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
leanprover/lean4:v4.34.1
|
spec/AXIOMS.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!--
|
| 2 |
+
Copyright (C) 2026 HCALC contributors
|
| 3 |
+
SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
-->
|
| 5 |
+
|
| 6 |
+
# HCALC Axiom Inventory
|
| 7 |
+
|
| 8 |
+
**Owner:** HCALC Spec agent
|
| 9 |
+
**Consumers:** HCALC Lean (defs / theorems), HCALC Alloy (Provenance tags), Foundry J Verify (cite-only).
|
| 10 |
+
**Rule:** Domain Gap-* are **CLOSED by definition** in [`PRODUCTION.md`](PRODUCTION.md). Prefer production defs over opaque axioms.
|
| 11 |
+
**Source absorbed:** [`FOUNDRY_J_CROSSLINKS.md`](FOUNDRY_J_CROSSLINKS.md).
|
| 12 |
+
**Production authority:** [`PRODUCTION.md`](PRODUCTION.md).
|
| 13 |
+
|
| 14 |
+
Provenance tags: `source-claim` | `axiom-gap` | `derived` | `SpecDefined`.
|
| 15 |
+
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
## Alloy A1–A7
|
| 19 |
+
|
| 20 |
+
| ID | Statement sketch | Kind | Lean link | Core / doc cite | Provenance |
|
| 21 |
+
|----|------------------|------|-----------|-----------------|------------|
|
| 22 |
+
| A1 | `#P_64=64`; elements = first-64 primes | assert | L1 | PROPERTIES **23**; Core `P64` | source-claim |
|
| 23 |
+
| A2 | `contractive(J,ε) ↔ gershgorin(J)<1-ε` (+ opt. power-iter 37) | assert | L2 | **33–37**; `spectral_analyze`, `gershgorin_*`, `power_iteration*` | source-claim |
|
| 24 |
+
| A3 | Foundry schedule soft_project when `q>1-ε` (**43** as coded) — **distinct from** production in-step `C` (state scale-or-id, **spec-adapt**) | assert | L4 | **43**/`soft_project`/`q_estimate` = **source-claim** (schedules only); production `C` → PRODUCTION.md / **spec-adapt** | source-claim (Foundry **43** only) |
|
| 25 |
+
| A4 | affine Foundry recurrence **only if** `instance=Foundry` / FoundryAdditive diagnostic | assert | L3 | **39**; `rec_step`, `rec_run` | source-claim |
|
| 26 |
+
| A5 | PMAT conservation on insert-set | assert | (PMAT defs) | **29**; `pmat_compose` | source-claim |
|
| 27 |
+
| A6 | guardian rejects spectral_radius≥1 or non-finite | assert | — | **55** | source-claim |
|
| 28 |
+
| A7 | definition-records for Λm, Ξ, C, Tp present and **SpecDefined** | gate | L6 defs | [`PRODUCTION.md`](PRODUCTION.md) | **SpecDefined** (CLOSED) |
|
| 29 |
+
|
| 30 |
+
**A7 action:** Alloy must replace `Undefined` → `SpecDefined` on all four GapRecords, pointing at PRODUCTION.md formulas (not leave unconstrained).
|
| 31 |
+
|
| 32 |
+
---
|
| 33 |
+
|
| 34 |
+
## Lean L1–L7
|
| 35 |
+
|
| 36 |
+
| ID | Statement sketch | Kind | Why / status | Depends / dependents | Provenance |
|
| 37 |
+
|----|------------------|------|--------------|----------------------|------------|
|
| 38 |
+
| L1 | `P64 : Fin 64 → ℕ` = PROPERTIES 23 list | **def** | Data; no axiom if listed | Used by Tp indexing | source-claim |
|
| 39 |
+
| L2 | `gershgorinBound`, `contractiveG` | **def+thm** | From 33–34 | Contraction lemmas; A2 | source-claim |
|
| 40 |
+
| L3 | `FoundryStep Ξ Λ T g x` = prop 39 | **def** | Exact Foundry additive | A4; **≠** `hcalcStep` | source-claim |
|
| 41 |
+
| L4 | `qEstimate` / `softProject` | **def** | 42–43 as coded | A3; production C | source-claim |
|
| 42 |
+
| L5 | Unique FP when Hyp holds | **thm** (dischargeable) | Under PRODUCTION Hyp; Banach **41** + residual **46** | Convergence claims | derived |
|
| 43 |
+
| L6 | `Λm`, `HCALC.Ξ`, `C`, `Tp` | **defs** (not axioms) | PRODUCTION §§2–5 | Nested-form theorems | **SpecDefined** |
|
| 44 |
+
| L7 | `structure InstanceBridge` + Option B/C thms | **UNBLOCKED** | **NOT** `rfl`; **NOT** `FoundryStep = hcalcStep` | Instance proofs | **SpecDefined** |
|
| 45 |
+
|
| 46 |
+
---
|
| 47 |
+
|
| 48 |
+
## Named Gap-* (HCALC-native) — CLOSED
|
| 49 |
+
|
| 50 |
+
All domain gaps CLOSED — see [`PRODUCTION.md`](PRODUCTION.md) disposition table. Summary:
|
| 51 |
+
|
| 52 |
+
| GapId | Status | Definition pointer |
|
| 53 |
+
|-------|--------|-------------------|
|
| 54 |
+
| Gap-Carrier | **CLOSED — see PRODUCTION.md** | `HCALC.Carrier := Fin n → ℝ`, ℓ∞ |
|
| 55 |
+
| Gap-Tp-from-P64 | **CLOSED — see PRODUCTION.md** | `(Tp x)_j = α_j · x_j`, `α_j = 1/(1+log p_{j mod 64})` |
|
| 56 |
+
| Gap-C-wrapper | **CLOSED — see PRODUCTION.md** | soft_project-or-id on `q = ‖D(Tp)‖_est` (Spec wiring of Foundry-coded soft_project) |
|
| 57 |
+
| Gap-Λm-scalar | **CLOSED — see PRODUCTION.md** | `Λm = min(1, (1-ε)/(‖C∘Tp‖_op+δ))` |
|
| 58 |
+
| Gap-Ξ | **CLOSED — see PRODUCTION.md** | `Ξ(t,y) := ξ_t·y + g_t`; Uniform `ξ_t=1` |
|
| 59 |
+
| Gap-ShapeMap | **CLOSED — see PRODUCTION.md** | **`InstanceBridge` morphism** (NOT `rfl` / NOT Foundry39≡nested); L7 UNBLOCKED |
|
| 60 |
+
| Gap-ContractAlg | **CLOSED — see PRODUCTION.md** | Gershgorin → power-iter → soft_project (**33–43**) |
|
| 61 |
+
| Gap-Converge | **CLOSED — see PRODUCTION.md** | Hyp ⇒ Banach unique FP + residual→0; L5 dischargeable |
|
| 62 |
+
| Gap-OptObj | **CLOSED — see PRODUCTION.md** | `J(X)=‖X−Ξ(t,Λm·C(Tp(X)))‖_∞`; iterate to tol |
|
| 63 |
+
|
| 64 |
+
Provenance for all rows above: **SpecDefined** (not axiom-gap).
|
| 65 |
+
|
| 66 |
+
**ShapeMap / L7 rule (Foundry J Spec review):** REJECT identity `Foundry39 ≡ nested` and silent symbol swaps. ACCEPTED: non-identity `InstanceBridge` parameter table (`T := C∘Tp`, `Λ_vec := Λm·1`, `Ξ_vec := ξ_t`, `g := g_t`). Production Core implements **only** `hcalcStep` (Option B); `toFoundryStep` is cite-only diagnostic. Option C embedding optional later — still a morphism, never symbol identity.
|
| 67 |
+
|
| 68 |
+
---
|
| 69 |
+
|
| 70 |
+
## Theorems that may depend on production defs (Lean guidance)
|
| 71 |
+
|
| 72 |
+
| After closing | Dependent results (sketches) |
|
| 73 |
+
|---------------|------------------------------|
|
| 74 |
+
| L1 + Tp def | Well-definedness of prime-indexed diagonal layers |
|
| 75 |
+
| L2 + C def | Lip / non-expansive bound for nested step |
|
| 76 |
+
| Λm def + L2 | Stabilizing-range lemmas |
|
| 77 |
+
| Ξ def + InstanceBridge | Parameter-table theorems; **not** `hcalcStep = FoundryStep` |
|
| 78 |
+
| L7 InstanceBridge | Option B Core path; optional Option C embedding morphism |
|
| 79 |
+
| L5 under Hyp | Convergence monitors; uniqueness |
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
### Provenance (production close — Foundry J Spec pass-2)
|
| 84 |
+
**A3 provenance split:** Alloy may keep a Foundry-instance assert for schedule soft_project (**43**, `source-claim`). Production in-step `C` is **SpecDefined** / **spec-adapt** per PRODUCTION.md — do not merge the two under one `source-claim` tag for **43**.
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
- **Gap-Tp-from-P64** \(\alpha\) law: `spec-def` (P64 list alone is Foundry **source-claim** **23**).
|
| 88 |
+
- **Gap-C-wrapper**: `spec-adapt` — algorithmic cousin of Foundry soft_project **43**, **not** symbol identity (43 scales schedules; production C scales state under Spec \(q=\|D(T_p)\|\)).
|
| 89 |
+
- **Gap-ShapeMap / L7**: dual `bridgeMode` **NestedFaithful** | **FoundryAdditive**; InstanceBridge param table; morphism → FoundryAdditive only — never NestedFaithful = prop-**39** rfl.
|
| 90 |
+
- Residual \(J\): Spec \(\ell_\infty\); Foundry **46** is \(\ell_2\).
|
| 91 |
+
|
| 92 |
+
**FAIL-open:** `sorry` / Alloy `unsat` failure / missing SpecDefined A7 record ⇒ SKIP or FAIL — never PASS.
|
| 93 |
+
|
| 94 |
+
---
|
| 95 |
+
|
| 96 |
+
## Infrastructure Gap-* (Lean toolchain stubs) — ACCEPTED (not production blockers)
|
| 97 |
+
|
| 98 |
+
Provisional IDs from HCALC Lean first cut (`lake build` exit 0, Mathlib deferred). Spec **accepts these names as canonical**; do not rename without Spec update. They are **infrastructure only** — not HCALC domain axioms and **not production blockers** when nested defs use explicit Carrier ℝ^n. Closing path: replace with Mathlib `Real` / proven Foundry defs when ready; until then FAIL-open on infra (axioms OK, never silent PASS).
|
| 99 |
+
|
| 100 |
+
| GapId | Role | Lean surface | Status | Provenance |
|
| 101 |
+
|-------|------|--------------|--------|------------|
|
| 102 |
+
| Gap-Real-arith | Opaque `Real` + basic arith/order facts absent Mathlib | `Hcalc/RealStub.lean` | infra stub (Mathlib deferred) | infra-not-production-gap |
|
| 103 |
+
| Gap-Foundry-StateOps | Foundry recurrence carrier + add/smul/zero (≠ HCALC `State`) | `Hcalc/Foundry.lean` | infra stub | infra-not-production-gap |
|
| 104 |
+
| Gap-Foundry-FinMax | `finMax` for Gershgorin-style bounds | `Hcalc/Foundry.lean` | infra stub | infra-not-production-gap |
|
| 105 |
+
| Gap-Foundry-Norm | Opaque weight / nonlinear norms for coded q-estimate | `Hcalc/Foundry.lean` | infra stub | infra-not-production-gap |
|
| 106 |
+
| Gap-Foundry-Div | Real division for soft-project scale | `Hcalc/Foundry.lean` | infra stub | infra-not-production-gap |
|
| 107 |
+
| Gap-Foundry-SoftScale | Opaque soft-project scale + branch laws | `Hcalc/Foundry.lean` | infra stub | infra-not-production-gap |
|
| 108 |
+
|
| 109 |
+
**Rule:** Infra stubs must not leave unfinished *production* theorems depending on `sorry`. Production Carrier/Tp/C/Λm/Ξ/J path uses explicit ℝ^n defs in PRODUCTION.md. Do **not** use infra stubs to invent an `rfl` ShapeMap.
|
| 110 |
+
|
| 111 |
+
---
|
| 112 |
+
|
| 113 |
+
## Steering aliases (G-*)
|
| 114 |
+
|
| 115 |
+
Stable short aliases. Prefer these in tags; Spec GapIds remain canonical. **All CLOSED.**
|
| 116 |
+
|
| 117 |
+
| Alias | Canonical GapId | Statement | Status |
|
| 118 |
+
|-------|-----------------|-----------|--------|
|
| 119 |
+
| **G-SHAPE** | Gap-ShapeMap | `InstanceBridge` morphism (NOT `rfl`; NOT Foundry39≡nested) | **CLOSED** — PRODUCTION §6 |
|
| 120 |
+
| **G-Lm** | Gap-Λm-scalar | Scalar Λm formula (≠ vector schedule) | **CLOSED** — PRODUCTION §4 |
|
| 121 |
+
| **G-C** | Gap-C-wrapper | In-step soft_project-or-id as C (Spec wiring) | **CLOSED** — PRODUCTION §3 |
|
| 122 |
+
| **G-Tp** | Gap-Tp-from-P64 | Diagonal Tp from P64 α weights | **CLOSED** — PRODUCTION §2 |
|
| 123 |
+
|
| 124 |
+
Core cite-only (hooks, not alternate defs): `P64`, `pmat_compose`, `spectral_analyze`, `soft_project`, `q_estimate`, `synth_weights`, `rec_step`, `rec_run`, `ace_certify` — see foundry-j `spec/J_API.md`, `j/BOXING.md`, `spec/GAP_DECISIONS.md`.
|
spec/COHERENCE.md
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!--
|
| 2 |
+
Copyright (C) 2026 HCALC contributors
|
| 3 |
+
SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
-->
|
| 5 |
+
|
| 6 |
+
# HCALC Coherence Map
|
| 7 |
+
|
| 8 |
+
**Owner:** HCALC Spec agent
|
| 9 |
+
**License:** AGPL-3.0-only
|
| 10 |
+
**Absorbs:** [`FOUNDRY_J_CROSSLINKS.md`](FOUNDRY_J_CROSSLINKS.md) (verbatim source input; keep that file).
|
| 11 |
+
**Production authority:** [`PRODUCTION.md`](PRODUCTION.md) — all domain Gap-* CLOSED by definition.
|
| 12 |
+
**Pass-2 review mirror:** [`FOUNDRY_J_PRODUCTION_REVIEW.md`](FOUNDRY_J_PRODUCTION_REVIEW.md).
|
| 13 |
+
**Mirror:** `/workspace/foundry-j/spec/HCALC_CROSSLINKS.md` (Foundry side).
|
| 14 |
+
**Cite-only (do not copy bodies):**
|
| 15 |
+
`/workspace/foundry-j/spec/PROPERTIES.md`, `J_API.md`, `GAP_DECISIONS.md`, `/workspace/foundry-j/j/BOXING.md`.
|
| 16 |
+
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
## Pipeline (canonical — production formulas)
|
| 20 |
+
|
| 21 |
+
Informal multimodal research narrative (noise stripped) collapses to the discrete dynamical pipeline:
|
| 22 |
+
|
| 23 |
+
```
|
| 24 |
+
multimodal system
|
| 25 |
+
→ multiplicity / tensor representation
|
| 26 |
+
→ prime-indexed recursion T_p
|
| 27 |
+
→ Λm stabilization
|
| 28 |
+
→ Ξ(t) controlled evolution
|
| 29 |
+
→ orthogonal / spectral transform
|
| 30 |
+
→ layerwise contraction C
|
| 31 |
+
→ optimization
|
| 32 |
+
→ converged representation
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
**Boxed abstract recurrence (HCALC nested form) — PRODUCTION:**
|
| 36 |
+
|
| 37 |
+
\[
|
| 38 |
+
X_{t+1} = \Xi\bigl(t,\; \Lambda_m \cdot C(T_p(X_t))\bigr)
|
| 39 |
+
= \xi_t\cdot\bigl(\Lambda_m\cdot C(T_p(X_t))\bigr) + g_t.
|
| 40 |
+
\]
|
| 41 |
+
|
| 42 |
+
| Symbol | Role | Status |
|
| 43 |
+
|--------|------|--------|
|
| 44 |
+
| \(X_t\) | State at discrete time \(t\) | **Defined** — `HCALC.Carrier = Fin n → ℝ`, ℓ∞ |
|
| 45 |
+
| \(T_p\) | Diagonal PrimeMask transform | **Defined** — \((T_p x)_j = \alpha_j x_j\), \(\alpha_j=1/(1+\log p_{j\bmod 64})\) (**spec-def**) |
|
| 46 |
+
| \(C\) | In-step scale-or-id governor | **Defined** — scale \((1-\varepsilon)/q\) or id (**spec-adapt**; ≠ Foundry **43**) |
|
| 47 |
+
| \(\Lambda_m\) | Stabilizing **scalar** | **Defined** — \(\min(1,(1-\varepsilon)/(\|C\circ T_p\|_{\mathrm{op}}+\delta))\) |
|
| 48 |
+
| \(\Xi(t,\cdot)\) | Controlled evolution | **Defined** — \(\xi_t\cdot y + g_t\); Uniform \(\xi_t=1\) |
|
| 49 |
+
|
| 50 |
+
**Shape fact (production).** Foundry F1 additive step (PROPERTIES **39**) and HCALC nested form are **different morphisms**. Spec closes Gap-ShapeMap via **`InstanceBridge`** parameter table (PRODUCTION §6) with dual `bridgeMode`:
|
| 51 |
+
|
| 52 |
+
| bridgeMode | Meaning | vs Foundry **39** |
|
| 53 |
+
|------------|---------|-------------------|
|
| 54 |
+
| **FoundryAdditive** | `toFoundryStep` with InstanceBridge params | **ACCEPT** morphism into additive shape — **not** nested |
|
| 55 |
+
| **NestedFaithful** / `hcalcStep` | nested production verb | Spec definitional — **REJECT** as prop-**39** `rfl` / identity |
|
| 56 |
+
|
| 57 |
+
- **REJECTED:** `Foundry39 ≡ nested`; silent symbol swaps; identity/`rfl`.
|
| 58 |
+
- **InstanceBridge** = explicit parameter table (morphism data), **not** an equality proof. Hilbert morphism maps to **FoundryAdditive** shape only.
|
| 59 |
+
- **Core:** implement only `hcalc_step` (NestedFaithful semantics); `toFoundryStep` is FoundryAdditive diagnostic.
|
| 60 |
+
- **L7 UNBLOCKED** as `structure InstanceBridge` + dual-mode theorems — **never** `FoundryStep = hcalcStep`.
|
| 61 |
+
|
| 62 |
+
### Provenance (pass-2 — do not revert)
|
| 63 |
+
|
| 64 |
+
- **Gap-Tp-from-P64** \(\alpha\) law: `spec-def` (P64 list alone is Foundry **source-claim** **23**).
|
| 65 |
+
- **Gap-C-wrapper**: `spec-adapt` — algorithmic cousin of Foundry soft_project **43**, **not** symbol identity (43 scales schedules; production C scales **state** under Spec \(q=\|D(T_p)\|\)).
|
| 66 |
+
- **Gap-ShapeMap / L7**: dual NestedFaithful | FoundryAdditive; InstanceBridge param table; morphism → FoundryAdditive only — never NestedFaithful = prop-**39** rfl.
|
| 67 |
+
- Residual \(J\): Spec \(\ell_\infty\); Foundry **46** is \(\ell_2\).
|
| 68 |
+
|
| 69 |
+
---
|
| 70 |
+
|
| 71 |
+
## Gap map
|
| 72 |
+
|
| 73 |
+
### Defined (production — CLOSED)
|
| 74 |
+
|
| 75 |
+
| Symbol | Production definition | GapId |
|
| 76 |
+
|--------|----------------------|-------|
|
| 77 |
+
| \(X_t\) | `HCALC.Carrier := Fin n → ℝ`, \(\|·\|_\infty\) | Gap-Carrier **CLOSED** |
|
| 78 |
+
| \(T_p\) | \(\mathrm{diag}(\alpha)\), \(\alpha_j = 1/(1+\log p_{j\bmod 64})\) from L1/`P64` (**23**); α law **spec-def** | Gap-Tp-from-P64 **CLOSED** |
|
| 79 |
+
| \(C\) | scale-or-id on Spec \(q=\|D(T_p)\|_{\mathrm{est}}\) (**spec-adapt**; cousin of **43**, ≠ **43**) | Gap-C-wrapper **CLOSED** |
|
| 80 |
+
| \(\Lambda_m\) | scalar \(\min(1,(1-\varepsilon)/(\|C\circ T_p\|_{\mathrm{op}}+\delta))\) | Gap-Λm-scalar **CLOSED** |
|
| 81 |
+
| \(\Xi(t,\cdot)\) | \(\xi_t\cdot y + g_t\); default Uniform | Gap-Ξ **CLOSED** |
|
| 82 |
+
| ContractAlg | Gershgorin → power-iter fallback → soft_project scale idea | Gap-ContractAlg **CLOSED** |
|
| 83 |
+
| Convergence | Hyp ⇒ Banach unique FP (**41**) + residual→0 | Gap-Converge **CLOSED**; L5 dischargeable |
|
| 84 |
+
| \(J\) | residual \(\|X - \Xi(t,\Lambda_m\cdot C(T_p(X)))\|_\infty\); iterate to tol (≠ Foundry **46** \(\ell_2\)) | Gap-OptObj **CLOSED** |
|
| 85 |
+
| ShapeMap / L7 | **`InstanceBridge`** + dual NestedFaithful\|FoundryAdditive (NOT `rfl`) | Gap-ShapeMap **CLOSED**; L7 **UNBLOCKED** |
|
| 86 |
+
| Spectral / orthogonal | Gershgorin, power iter, guardian (**33–38**, **55**) | measure + ContractAlg input |
|
| 87 |
+
| Parameters | \(n\), ε tier (**25**, default T2=0.05), δ=1e-12, tol=1e-6 | PRODUCTION § Parameters |
|
| 88 |
+
|
| 89 |
+
Full formulas: [`PRODUCTION.md`](PRODUCTION.md). Inventory: [`AXIOMS.md`](AXIOMS.md).
|
| 90 |
+
|
| 91 |
+
### Axiom-needed
|
| 92 |
+
|
| 93 |
+
**None for domain Gap-*.** All closed in PRODUCTION.md.
|
| 94 |
+
|
| 95 |
+
Infrastructure toolchain stubs (accepted, not domain, not production blockers): **Gap-Real-arith**, **Gap-Foundry-StateOps**, **Gap-Foundry-FinMax**, **Gap-Foundry-Norm**, **Gap-Foundry-Div**, **Gap-Foundry-SoftScale** — see [`AXIOMS.md`](AXIOMS.md) § Infrastructure. Status = infra stub (Mathlib deferred).
|
| 96 |
+
|
| 97 |
+
### Steering aliases
|
| 98 |
+
|
| 99 |
+
| Alias | Canonical | Status |
|
| 100 |
+
|-------|-----------|--------|
|
| 101 |
+
| G-SHAPE | Gap-ShapeMap | **CLOSED** — `InstanceBridge` (NOT `rfl`); dual bridgeMode |
|
| 102 |
+
| G-Lm | Gap-Λm-scalar | **CLOSED** — scalar formula |
|
| 103 |
+
| G-C | Gap-C-wrapper | **CLOSED** — `spec-adapt` scale-or-id (≠ **43**) |
|
| 104 |
+
| G-Tp | Gap-Tp-from-P64 | **CLOSED** — diagonal α (**spec-def**) from P64 |
|
| 105 |
+
|
| 106 |
+
#### Alloy asserts A1–A7
|
| 107 |
+
|
| 108 |
+
| ID | Assert (informal) | Foundry / PRODUCTION anchor | Provenance |
|
| 109 |
+
|----|-------------------|----------------------------|------------|
|
| 110 |
+
| **A1** | `#P_64 = 64` and elements are the listed first-64 primes | Prop **23** | `source-claim` |
|
| 111 |
+
| **A2** | `contractive(J,ε) iff gershgorin(J) < 1-ε` (+ optional power-iter **37**) | **33–37** | `source-claim` |
|
| 112 |
+
| **A3** | Soft-project scale idea when `q > 1-ε` (**in-step C**, spec-adapt) | cousin of **43**; PRODUCTION §3 | `source-claim` + spec-adapt |
|
| 113 |
+
| **A4** | Recurrence carrier = Foundry affine form **only if** FoundryAdditive / `instance=Foundry` | **39** | `source-claim` (instance-gated) |
|
| 114 |
+
| **A5** | PMAT conservation on insert-set | **29** | `source-claim` |
|
| 115 |
+
| **A6** | Guardian: reject when spectral radius ≥ 1 or non-finite | **55** | `source-claim` |
|
| 116 |
+
| **A7** | Definition-records for Λm, Ξ, C, Tp are **SpecDefined** pointing at PRODUCTION.md | PRODUCTION.md | **SpecDefined** |
|
| 117 |
+
|
| 118 |
+
#### Lean L1–L7
|
| 119 |
+
|
| 120 |
+
| ID | Candidate | Kind | Note |
|
| 121 |
+
|----|-----------|------|------|
|
| 122 |
+
| **L1** | `P64 : Fin 64 → ℕ` (PROPERTIES **23** list) | definition (data) | No axiom if listed |
|
| 123 |
+
| **L2** | `gershgorinBound`, `contractiveG` | def + theorem | From **33–34** |
|
| 124 |
+
| **L3** | `FoundryStep Ξ Λ T g x` | definition | Exact **39**; ≠ `hcalcStep` |
|
| 125 |
+
| **L4** | `qEstimate` / `softProject` | definition | **42–43** as coded (Foundry); production C separate |
|
| 126 |
+
| **L5** | Banach unique FP under Hyp | **theorem** (dischargeable) | Narrative **41** + PRODUCTION Hyp |
|
| 127 |
+
| **L6** | `Λm`, `HCALC.Ξ`, `C`, `Tp` | **definitions** | PRODUCTION §§2–5 — not axioms |
|
| 128 |
+
| **L7** | `structure InstanceBridge` + dual-mode thms | **UNBLOCKED** | **NOT** `rfl`; **NOT** `FoundryStep = hcalcStep` |
|
| 129 |
+
|
| 130 |
+
### Noise (explicitly out of scope)
|
| 131 |
+
|
| 132 |
+
- UAC branding and product wrappers
|
| 133 |
+
- Quantum / AI / cognitive marketing language
|
| 134 |
+
- Ungrounded or Google-redirect citations
|
| 135 |
+
- “Stability without hypotheses” claims
|
| 136 |
+
- Equating Sedona Spine / PIRTM linker theater (**21**) with mathematical \(T_p\)
|
| 137 |
+
- Silently identifying Foundry **39** with nested / claiming `rfl` ShapeMap
|
| 138 |
+
- Tagging production `C` as Foundry **43** `source-claim` (it is **spec-adapt**)
|
| 139 |
+
- Equating Spec \(\ell_\infty\) residual with Foundry **46** \(\ell_2\)
|
| 140 |
+
|
| 141 |
+
---
|
| 142 |
+
|
| 143 |
+
## Foundry instantiation map (cite-only)
|
| 144 |
+
|
| 145 |
+
Absorbed from `FOUNDRY_J_CROSSLINKS.md` §1. Production **uses** P64 + spectral + soft_project *scale idea* as coded hooks under PRODUCTION.md — Spec wiring / adapt, not Foundry-native identity of HCALC symbols.
|
| 146 |
+
|
| 147 |
+
### \(T_p\) (production uses P64 diagonal)
|
| 148 |
+
|
| 149 |
+
| Foundry surface | Role vs \(T_p\) | Cite |
|
| 150 |
+
|-----------------|----------------|------|
|
| 151 |
+
| **23** `P_64` | Prime table for \(\alpha_j\) (**source-claim**) | `types.h`; PROPERTIES 23; Lean L1 |
|
| 152 |
+
| α weight law | **spec-def** (not Foundry PROPERTY) | PRODUCTION §2 |
|
| 153 |
+
| `PrimeMask` / `ResonanceWord` | Representation over `P_64` — α schedule view | J_API.md |
|
| 154 |
+
| **26–32** PMAT | Sparse prime-monomial LA; **not** production Tp | PROPERTIES E |
|
| 155 |
+
| **1–17** Goldilocks \(\mathbb{F}_p\) | Optional future carrier | PROPERTIES A–C |
|
| 156 |
+
| **21** PIRTM_MAGIC / linker | Tooling ≠ math \(T_p\) | PROPERTIES 21 |
|
| 157 |
+
|
| 158 |
+
Core cite-only hooks: `P64`, `pmat_compose`, `spectral_analyze`, `soft_project`, `q_estimate`, `synth_weights`, `rec_step`, `rec_run`, `ace_certify`.
|
| 159 |
+
|
| 160 |
+
### Contraction / spectral measures
|
| 161 |
+
|
| 162 |
+
| Props | Measure |
|
| 163 |
+
|-------|---------|
|
| 164 |
+
| **33–34** | Gershgorin; `contractive ⟺ bound < 1-ε` |
|
| 165 |
+
| **35–37** | Power iteration + fallback |
|
| 166 |
+
| **38** | Contractive / expansive test matrices |
|
| 167 |
+
| **25** | Tier ε schedule (default T2=0.05) |
|
| 168 |
+
| **39–46** | Banach recurrence, \(q_t\), soft project, residual (\(\ell_2\)) |
|
| 169 |
+
| **55** | Guardian spectral legality |
|
| 170 |
+
|
| 171 |
+
---
|
| 172 |
+
|
| 173 |
+
## Invariant inventory (for Alloy)
|
| 174 |
+
|
| 175 |
+
Eight coherence obligations. Alloy encodes finite predicates / traces; production defs discharge former opaque gaps.
|
| 176 |
+
|
| 177 |
+
| # | Name | Informal statement | Alloy must check | Status |
|
| 178 |
+
|---|------|--------------------|------------------|--------|
|
| 179 |
+
| 1 | **Inv-StepForm** | Dual bridgeMode; forbid NestedFaithful = prop-**39** | Tag `bridgeMode ∈ {NestedFaithful, FoundryAdditive}` + InstanceBridge table; **forbid** symbol identity / `rfl` | **Defined** — L7 InstanceBridge |
|
| 180 |
+
| 2 | **Inv-P64** | If Foundry-backed prime-index, indices from `P_64` | **A1** | source-claim |
|
| 181 |
+
| 3 | **Inv-Contractive** | Modulus bound \(< 1-\varepsilon\) for declared ε | **A2**; ε from tier **25** | source-claim + production C |
|
| 182 |
+
| 4 | **Inv-QSoft** | Scale-or-id when Spec \(q>1-\varepsilon\) (in-step C) | **A3** (spec-adapt) | production C |
|
| 183 |
+
| 5 | **Inv-Residual** | Residual / convergence witness when claimed | Monitor; L5 under Hyp; Spec \(\ell_\infty\) | production Converge |
|
| 184 |
+
| 6 | **Inv-PMAT** | If PMAT used: conservation | **A5** | source-claim |
|
| 185 |
+
| 7 | **Inv-GapDecisions** | Honor Foundry `GAP_DECISIONS.md` until Spec overrides | Parameter/fixture consistency | PRODUCTION overrides written |
|
| 186 |
+
| 8 | **Inv-OpaqueGaps** | Λm, Ξ, C, Tp **SpecDefined** records | **A7** SpecDefined | **CLOSED** |
|
| 187 |
+
|
| 188 |
+
Additional: **A4** (Foundry carrier only if FoundryAdditive), **A6** (guardian).
|
| 189 |
+
|
| 190 |
+
---
|
| 191 |
+
|
| 192 |
+
## Axiom candidates (for Lean)
|
| 193 |
+
|
| 194 |
+
See [`AXIOMS.md`](AXIOMS.md) and [`PRODUCTION.md`](PRODUCTION.md). Summary:
|
| 195 |
+
|
| 196 |
+
- **L1–L4**: definitions from Foundry concrete data.
|
| 197 |
+
- **L5**: theorem under Hyp — dischargeable; no silent-`sorry` as PASS.
|
| 198 |
+
- **L6**: **defs** for Λm, Ξ, C, Tp (replace prior axioms).
|
| 199 |
+
- **L7**: **UNBLOCKED** as `structure InstanceBridge` + dual NestedFaithful|FoundryAdditive theorems — **not** `FoundryStep = hcalcStep` / **not** `rfl`.
|
| 200 |
+
- Named **Gap-*** domain: CLOSED — no new axioms.
|
| 201 |
+
|
| 202 |
+
---
|
| 203 |
+
|
| 204 |
+
## Open problems
|
| 205 |
+
|
| 206 |
+
Domain Gap-* closed. Remaining optional / infra only:
|
| 207 |
+
|
| 208 |
+
1. Optional Goldilocks \(\mathbb{F}_p\) carrier instance (Foundry **1–17**) — not required for ℝ path.
|
| 209 |
+
2. Mathlib migration replacing RealStub / Gap-Foundry-* infra stubs.
|
| 210 |
+
3. Empirical ε tier tuning beyond default T2=0.05.
|
| 211 |
+
4. Optional Option C embedding morphism theorem (still not identity).
|
| 212 |
+
|
| 213 |
+
---
|
| 214 |
+
|
| 215 |
+
## Cross-links
|
| 216 |
+
|
| 217 |
+
- **Foundry J / PIRTM:** prime index set, Gershgorin, Banach step, soft_project — production **hooks** under PRODUCTION.md formulas. Primary note: [`FOUNDRY_J_CROSSLINKS.md`](FOUNDRY_J_CROSSLINKS.md). Foundry mirror: `/workspace/foundry-j/spec/HCALC_CROSSLINKS.md`.
|
| 218 |
+
- **Core path:** `/workspace/hcalc/j/` (authoritative for HCALC verbs).
|
| 219 |
+
- **Alapeno:** hardware stack; no Spec dependency for coherence math.
|
| 220 |
+
- **Verify pattern:** [`PROPERTIES.md`](PROPERTIES.md), [`../verify/README.md`](../verify/README.md).
|
| 221 |
+
- **Handoff:** [`HANDOFF_PRODUCTION.md`](HANDOFF_PRODUCTION.md).
|
spec/FOUNDRY_J_CROSSLINKS.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!--
|
| 2 |
+
Copyright (C) 2026 Foundry J / HCALC contributors
|
| 3 |
+
SPDX-License-Identifier: AGPL-3.0-or-later
|
| 4 |
+
-->
|
| 5 |
+
|
| 6 |
+
# Foundry J → HCALC cross-links (Spec input)
|
| 7 |
+
|
| 8 |
+
**From:** Foundry J Spec
|
| 9 |
+
**For:** HCALC Spec / Alloy / Lean (via Hilbert)
|
| 10 |
+
**Sources:** `/workspace/foundry-j/spec/PROPERTIES.md`, `J_API.md`, `GAP_DECISIONS.md`; Foundry README Sedona Spine / PIRTM.
|
| 11 |
+
**HCALC abstract (as given):** \( X_{t+1}=\Xi(t,\Lambda_m\cdot C[T_p(X_t)]) \).
|
| 12 |
+
**Rule:** No invented \(\Lambda_m\) or \(\Xi\) definitions. Gaps flagged below.
|
| 13 |
+
**Note:** `/workspace/hcalc` had no prior tree when this note was written.
|
| 14 |
+
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
## 0. Shape gap (read first)
|
| 18 |
+
|
| 19 |
+
| | Foundry F1 (cited) | HCALC abstract (given) |
|
| 20 |
+
|--|--------------------|-------------------------|
|
| 21 |
+
| Step | \( x_{t+1}=\Xi_t x_t+\Lambda_t T(x_t)+g_t \) (PROPERTIES **39**) | \( X_{t+1}=\Xi(t,\Lambda_m\cdot C[T_p(X_t)]) \) |
|
| 22 |
+
| \(\Xi\) | Per-step **schedule weights** (length-2 vectors) | Operator/map \(\Xi(t,\cdot)\) — **undefined in Foundry** |
|
| 23 |
+
| \(\Lambda\) / \(\Lambda_m\) | \(\Lambda_t\) schedule weights (same carrier as \(\Xi_t\)) | \(\Lambda_m\) — **no definition in Foundry sources** |
|
| 24 |
+
| \(T\) / \(T_p\) | Nonlinear \(T(x)\) in recurrence; **no \(T_p\)** symbol | Prime-indexed \(T_p\) — **not named in Foundry math** |
|
| 25 |
+
| \(C\) | Not a Foundry recurrence symbol | **Undefined** in Foundry inventory |
|
| 26 |
+
|
| 27 |
+
**Spec stance:** Treat Foundry as a **candidate instantiation layer** for pieces of the HCALC pipeline (prime index set, contraction tests, Banach step), not as a definition of \(\Lambda_m\) or HCALC-\(\Xi\). Alloy/Lean must not silently equate the two step forms.
|
| 28 |
+
|
| 29 |
+
---
|
| 30 |
+
|
| 31 |
+
## 1. Map: what Foundry can instantiate
|
| 32 |
+
|
| 33 |
+
### \(T_p\) candidates (prime-indexed structure)
|
| 34 |
+
|
| 35 |
+
| Foundry prop / surface | Role vs \(T_p\) | Cite |
|
| 36 |
+
|------------------------|----------------|------|
|
| 37 |
+
| **23** `P_64` (first 64 primes, length-64 list) | Discrete **prime index set** for any prime-indexed tensor/mask; strongest Foundry hook for “prime-indexed” | `types.h:24–30`; PROPERTIES 23 |
|
| 38 |
+
| `PrimeMask` / `ResonanceWord` (J_API nouns) | Bitmask / packed class∥payload over `P_64` indices — **representation**, not a recursive tensor law | J_API.md nouns |
|
| 39 |
+
| **26–32** PMAT / prime monomials (`Signature`, conservation, compose-as-coded) | Sparse **prime-monomial** linear algebra; possible skeleton for layer ops, **not** a definition of recursive tensor reps | PROPERTIES E; GAP_DECISIONS: grading stub, compose = `a.delta_source+b.delta_target` only |
|
| 40 |
+
| **1–17** Goldilocks \(\mathbb{F}_p\) | Finite-field **carrier** for discrete/algebraic lifts; does **not** by itself give real contraction of \(X_t\) | PROPERTIES A–C |
|
| 41 |
+
| **21** `PIRTM_MAGIC` / linker PIRTM | Bytecode/linker theater (Sedona Spine tooling) — **not** a math definition of \(T_p\) | PROPERTIES 21; README linker |
|
| 42 |
+
|
| 43 |
+
**Sedona Spine:** README names a 10-layer architecture and Triple-Lock; it does **not** define HCALC \(T_p\), \(\Lambda_m\), or \(C\). Use as architectural context only.
|
| 44 |
+
|
| 45 |
+
### Contraction / spectral measures (layerwise contraction → converged \(X\))
|
| 46 |
+
|
| 47 |
+
| Foundry prop | Measure | Cite |
|
| 48 |
+
|--------------|---------|------|
|
| 49 |
+
| **33–34** Gershgorin bound; `contractive ⟺ bound < 1-ε` | A priori row-sum spectral bound | PROPERTIES 33–34 |
|
| 50 |
+
| **35–37** Power iteration + fallback policy | Dominant-modulus check; recheck when Gershgorin tight | PROPERTIES 35–37 |
|
| 51 |
+
| **38** Contractive / expansive test matrices | Concrete witnesses (quoted in PROPERTIES; do not alter) | PROPERTIES 38 |
|
| 52 |
+
| **25** Tier ε: T1→0.10, T2→0.05, T3→0.02, T4→0.01 | Contraction **margin** schedule | PROPERTIES 25 |
|
| 53 |
+
| **39–46** Banach recurrence, \(q_t\), soft project, residual | Foundry **evolution** + projection when \(q>1-\varepsilon\) | PROPERTIES G |
|
| 54 |
+
| **55** Guardian spectral legality | Reject if `spectral_radius >= 1` or non-finite next state | PROPERTIES 55 |
|
| 55 |
+
|
| 56 |
+
---
|
| 57 |
+
|
| 58 |
+
## 2. Invariants demanded before calling HCALC “coherent”
|
| 59 |
+
|
| 60 |
+
Demand these as **explicit** Spec/Alloy/Lean obligations (Foundry-backed where cited; HCALC-native where flagged):
|
| 61 |
+
|
| 62 |
+
1. **Step-form declared** — Either adopt Foundry **39** as an instance, or define HCALC \(\Xi(t,\cdot)\) / \(\Lambda_m\) / \(C\) / \(T_p\) separately. **Do not mix symbols without a bridge lemma.** (Gap: HCALC defs missing.)
|
| 63 |
+
2. **Prime index honesty** — If “prime-indexed” means Foundry, \(T_p\) (or its mask) is valued on **`P_64` (prop 23)** or a stated extension; no silent infinite prime stream.
|
| 64 |
+
3. **Contraction predicate** — Layer/Jacobian (or stated linearization) satisfies Foundry-style **34/36**: modulus bound \(< 1-\varepsilon\) for a declared \(\varepsilon\) (tier **25** or other cited constant).
|
| 65 |
+
4. **q-budget / soft projection** — If Foundry schedules are used: **40/42/43** — \(q=\|\Xi\|+\|\Lambda\|\cdot\|T\|\); if \(q>1-\varepsilon\), scale as coded.
|
| 66 |
+
5. **Convergence witness** — Residual **46** (or Lean equivalent) below a declared tolerance; unique fixed-point only where Banach hypotheses **41** are discharged (not assumed from narrative alone).
|
| 67 |
+
6. **PMAT conservation (if PMAT used)** — **29** product/sum of entry monomials equals accumulated signature sums (test vector cited in PROPERTIES).
|
| 68 |
+
7. **Gap rulings respected** — Match C++ as coded per `GAP_DECISIONS.md` (compose deltas, grading stub, EPSILON literal, unused BARRITT_MU/PHI) until HCALC Spec overrides **in writing**.
|
| 69 |
+
8. **No invented \(\Lambda_m\)** — Alloy/Lean may leave \(\Lambda_m\), HCALC-\(\Xi\), \(C\), \(T_p\) as **opaque symbols** or axioms with `sorry`/uninterpreted ops until HCALC Spec defines them.
|
| 70 |
+
|
| 71 |
+
---
|
| 72 |
+
|
| 73 |
+
## 3. Shortlist for Alloy asserts + Lean axiom candidates
|
| 74 |
+
|
| 75 |
+
### Alloy-oriented asserts (finite, checkable)
|
| 76 |
+
|
| 77 |
+
| ID | Assert (informal) | Foundry anchor |
|
| 78 |
+
|----|-------------------|----------------|
|
| 79 |
+
| A1 | `#P_64 = 64` and elements are the listed first-64 primes | Prop **23** |
|
| 80 |
+
| A2 | `contractive(J,ε) iff gershgorin(J) < 1-ε` (and optional power-iter branch **37**) | **33–37** |
|
| 81 |
+
| A3 | Soft-project: if `q > 1-ε` then scaled weights used in the step | **43** |
|
| 82 |
+
| A4 | Recurrence carrier: next state is affine Foundry form **only if** instance = Foundry | **39** |
|
| 83 |
+
| A5 | PMAT conservation on insert-set | **29** |
|
| 84 |
+
| A6 | Guardian: reject when spectral radius ≥ 1 or non-finite | **55** |
|
| 85 |
+
| A7 | **Gap stub:** `Λm`, HCALC-`Ξ`, `C`, `T_p` are unconstrained until defined — assert **presence of a definition record**, not a formula | (no Foundry cite) |
|
| 86 |
+
|
| 87 |
+
### Lean axiom / definition candidates (prefer defs where Foundry is concrete)
|
| 88 |
+
|
| 89 |
+
| ID | Candidate | Kind | Note |
|
| 90 |
+
|----|-----------|------|------|
|
| 91 |
+
| L1 | `P64 : Fin 64 → ℕ` with the PROPERTIES **23** list | **definition** (data) | No axiom needed if listed |
|
| 92 |
+
| L2 | `gershgorinBound`, `contractiveG` | **definition** + theorem | From **33–34** |
|
| 93 |
+
| L3 | `FoundryStep Ξ Λ T g x` | **definition** | Exact **39**; ≠ HCALC abstract |
|
| 94 |
+
| L4 | `qEstimate` / `softProject` | **definition** | **42–43** as coded |
|
| 95 |
+
| L5 | Banach unique fixed point under `q < 1-ε` | **theorem** (or axiom until proof) | Narrative **41** — prove or mark unfinished |
|
| 96 |
+
| L6 | `Λm`, `HCALC.Ξ`, `C`, `Tp` | **axioms / uninterpreted** | **Gaps — do not invent** |
|
| 97 |
+
| L7 | Bridge `HCALCStep = FoundryStep` (or embedding) | **axiom or theorem** | Only after HCALC Spec defines left-hand side |
|
| 98 |
+
|
| 99 |
+
### Explicit gaps (do not invent)
|
| 100 |
+
|
| 101 |
+
- \(\Lambda_m\) — no Foundry definition (Foundry has \(\Lambda_t\) weights only).
|
| 102 |
+
- HCALC \(\Xi(t,\cdot)\) — not Foundry \(\Xi_t\) vectors.
|
| 103 |
+
- \(C[\cdot]\) — undefined in Foundry inventory.
|
| 104 |
+
- \(T_p\) — no Foundry symbol; closest are `P_64` + PMAT + \(T(x)\).
|
| 105 |
+
- Recursive tensor representation law — **absent** from Foundry PROPERTIES.
|
| 106 |
+
- `/workspace/hcalc` content beyond this note — none at write time.
|
| 107 |
+
|
| 108 |
+
---
|
| 109 |
+
|
| 110 |
+
## 4. Suggested handoff order
|
| 111 |
+
|
| 112 |
+
1. HCALC Spec: define or explicitly leave open \(\Lambda_m\), \(\Xi\), \(C\), \(T_p\).
|
| 113 |
+
2. Alloy: A1–A6 on Foundry instance; A7 gate on open symbols.
|
| 114 |
+
3. Lean: L1–L4 defs first; L6 axioms for gaps; L5/L7 only with proof or labeled unfinished.
|
| 115 |
+
4. Foundry Core/Verify: keep prop **16** FAIL and coverage matrix in view when claiming Goldilocks lifts into HCALC.
|
| 116 |
+
|
spec/FOUNDRY_J_PRODUCTION_REVIEW.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!--
|
| 2 |
+
Copyright (C) 2026 Foundry J contributors
|
| 3 |
+
SPDX-License-Identifier: AGPL-3.0-or-later
|
| 4 |
+
-->
|
| 5 |
+
|
| 6 |
+
# Foundry J Spec — HCALC PRODUCTION.md review (pass 3 / InstanceBridge)
|
| 7 |
+
|
| 8 |
+
**Reviewer:** Foundry J Spec
|
| 9 |
+
**Date:** 2026-10-07 (PT)
|
| 10 |
+
**Target:** `/workspace/hcalc/spec/PRODUCTION.md` @ `f5a08da`
|
| 11 |
+
**Focus:** §6 ShapeMap `InstanceBridge` vs REJECT identity; Core path `/workspace/hcalc/j/`
|
| 12 |
+
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
## Verdict (short)
|
| 16 |
+
|
| 17 |
+
| Item | Verdict |
|
| 18 |
+
|------|---------|
|
| 19 |
+
| §6 `InstanceBridge` (NOT rfl / NOT Foundry39≡nested) | **ACCEPT** |
|
| 20 |
+
| Explicit param table \(T:=C\circ T_p\), \(\Lambda:=\Lambda_m\mathbf{1}\), \(\Xi:=\xi_t\) without symbol identity | **ACCEPT** |
|
| 21 |
+
| Option B: implement `hcalc_step` only; `toFoundryStep` diagnostic cite-only | **ACCEPT** |
|
| 22 |
+
| soft_project remains Foundry-coded **42–43**; `C` is Spec wiring that *uses* the scale idea | **ACCEPT** (wording in §6) |
|
| 23 |
+
| Core path `/workspace/hcalc/j/` + verb list matching `HCALC_API_DRAFT.md` | **ACCEPT** |
|
| 24 |
+
| GAP_DECISIONS | **No conflict** |
|
| 25 |
+
| Silent identity Foundry39 ≡ nested | Still **REJECT** — PRODUCTION agrees |
|
| 26 |
+
|
| 27 |
+
**Overall:** **ACCEPT** PRODUCTION @ `f5a08da` for ShapeMap / implement path. Non-blocking nits below.
|
| 28 |
+
|
| 29 |
+
---
|
| 30 |
+
|
| 31 |
+
## §6 ShapeMap detail
|
| 32 |
+
|
| 33 |
+
PRODUCTION now states clearly:
|
| 34 |
+
|
| 35 |
+
- `toFoundryStep` = \(\xi_t\cdot x + \Lambda_m(C\circ T_p)(x)+g_t\) under InstanceBridge params.
|
| 36 |
+
- `hcalcStep` = \(\xi_t\cdot(\Lambda_m\cdot C(T_p(x)))+g_t\).
|
| 37 |
+
- These differ (\(\xi_t\cdot x\) only on Foundry side).
|
| 38 |
+
- L7 = structure + theorems about the table, **not** `FoundryStep = hcalcStep`.
|
| 39 |
+
|
| 40 |
+
This matches Foundry J Spec’s prior REJECT of identity and Hilbert’s explicit morphism (not rfl). **ACCEPT.**
|
| 41 |
+
|
| 42 |
+
---
|
| 43 |
+
|
| 44 |
+
## `/workspace/hcalc/j/` implement path
|
| 45 |
+
|
| 46 |
+
| Check | Result |
|
| 47 |
+
|-------|--------|
|
| 48 |
+
| Path authoritative under hcalc | **ACCEPT** |
|
| 49 |
+
| Verbs: `tp_from_p64`, `c_wrap`, `lam_m_from_bound`, `hcalc_xi_apply`, `hcalc_step`, `hcalc_run` | **ACCEPT** (names match draft) |
|
| 50 |
+
| Do not equate `hcalc_step` / `rec_step` | **ACCEPT** |
|
| 51 |
+
| Implementation status | **Scaffold only** (`j/README.md`); bodies still Core’s job — not a Spec reject |
|
| 52 |
+
|
| 53 |
+
---
|
| 54 |
+
|
| 55 |
+
## Non-blocking nits (optional Spec polish)
|
| 56 |
+
|
| 57 |
+
1. **§3 vs §6 soft_project wording:** §3 formula still scales **state** \(x\); Foundry **43** scales **schedules** \(\Xi,\Lambda\). §6 correctly calls that Spec wiring. One footnote in §3: “`softProjectScale` factor shared; Foundry `soft_project` API remains schedule-scaling when called as Foundry.”
|
| 58 |
+
2. **Alloy checklist line** still says “FoundryAdditive” — align naming to `InstanceBridge` / `toFoundryStep` vs `hcalcStep`.
|
| 59 |
+
3. **§8 Hyp under Uniform:** phrase “when using InstanceBridge” for nested Lip — prefer “when iterating `hcalcStep` (Option B)”; `toFoundryStep` has an extra \(\xi_t\cdot x\) term.
|
| 60 |
+
4. **α law / ℓ∞ residual:** still Spec-def (not Foundry source-claim) — OK if provenance stays Spec-owned.
|
| 61 |
+
|
| 62 |
+
---
|
| 63 |
+
|
| 64 |
+
## Summary for Hilbert / HCALC Spec
|
| 65 |
+
|
| 66 |
+
**ACCEPT** InstanceBridge ShapeMap and `/workspace/hcalc/j/` Core path. Identity REJECT stands and is honored. Ready for Alloy/Lean/Core to implement Option B without further Foundry J Spec gate — unless they want the §3 soft_project footnote.
|
spec/HANDOFF_PRODUCTION.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!--
|
| 2 |
+
Copyright (C) 2026 HCALC contributors
|
| 3 |
+
SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
-->
|
| 5 |
+
|
| 6 |
+
# HANDOFF — Production close (copy-paste for Alloy / Lean / Verify / Core)
|
| 7 |
+
|
| 8 |
+
**Authority:** [`PRODUCTION.md`](PRODUCTION.md) @ commit with InstanceBridge + Pass-2 provenance.
|
| 9 |
+
**Do not invent** beyond PRODUCTION / AXIOMS. Spec does not edit `.als` / `.lean` bodies.
|
| 10 |
+
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
## Alloy
|
| 14 |
+
|
| 15 |
+
1. Replace A7 GapRecord status `Undefined` → `SpecDefined` for Λm, Ξ, C, Tp; point comments at PRODUCTION.md.
|
| 16 |
+
2. Encode production preds: Carrier ℝ^n / abstract n; diag Tp α; C scale-or-id; Λm scalar min formula; Ξ = ξ·y+g (Uniform).
|
| 17 |
+
3. Add `bridgeMode ∈ {NestedFaithful, FoundryAdditive}` + `InstanceBridge` param table.
|
| 18 |
+
4. **Forbid** NestedFaithful = Foundry prop-**39** / `rfl` / silent symbol identity.
|
| 19 |
+
5. Keep A1–A6; rewire A3 to Spec q / in-step C (**spec-adapt** ≠ Foundry **43** schedule soft_project).
|
| 20 |
+
6. OptObj = residual \(\ell_\infty\); ContractAlg = Gershgorin→power-iter→scale-or-id.
|
| 21 |
+
7. Re-run `alloy/run.sh`; expect green with SpecDefined A7.
|
| 22 |
+
|
| 23 |
+
## Lean
|
| 24 |
+
|
| 25 |
+
1. Replace L6 axioms with **defs**: `Carrier`, `Tp`, `C`, `LambdaM`, `Xi`, `J`.
|
| 26 |
+
2. Unblock L7: `structure InstanceBridge` holding param table; dual-mode theorems — **never** `FoundryStep = hcalcStep` / **never** `rfl`.
|
| 27 |
+
3. L5: theorem under PRODUCTION Hyp (0 sorry).
|
| 28 |
+
4. Keep infra Gap-Real-* / Gap-Foundry-* stubs labeled infra-not-production-gap.
|
| 29 |
+
5. Tag α as **spec-def**; C as **spec-adapt**.
|
| 30 |
+
6. `lake build` exit 0.
|
| 31 |
+
|
| 32 |
+
## Verify
|
| 33 |
+
|
| 34 |
+
1. Flip SKIP→PASS where hyps hold (PROPERTY_MAP H-A7, H-SHAPE, H-NEST, H-OPT, H-L5).
|
| 35 |
+
2. H-SHAPE PASS **only** for InstanceBridge witness — never identity PASS.
|
| 36 |
+
3. Note Spec residual \(\ell_\infty\) ≠ Foundry **46** \(\ell_2\).
|
| 37 |
+
4. FAIL-open still if Lean sorry / Alloy unsat / Undefined A7.
|
| 38 |
+
5. Update `verify/PROPERTY_MAP.md` to match `spec/PROPERTIES.md`.
|
| 39 |
+
|
| 40 |
+
## Core (`/workspace/hcalc/j/`)
|
| 41 |
+
|
| 42 |
+
1. Implement Option B verbs: `tp_from_p64`, `c_wrap`, `lam_m_from_bound`, `hcalc_xi_apply`, `hcalc_step`, `hcalc_run`.
|
| 43 |
+
2. Cite Foundry hooks (`P64`, `spectral_analyze`, `soft_project`, `q_estimate`, `synth_weights`) — do **not** equate `hcalc_step` with `rec_step`.
|
| 44 |
+
3. Expose `toFoundryStep` only as FoundryAdditive diagnostic.
|
| 45 |
+
4. Leave Foundry additive API unchanged.
|
| 46 |
+
|
| 47 |
+
## Push gate
|
| 48 |
+
|
| 49 |
+
Do **not** push until Alloy + Lean + Verify are green.
|
spec/INTERFACES.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!--
|
| 2 |
+
Copyright (C) 2026 HCALC contributors
|
| 3 |
+
SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
-->
|
| 5 |
+
|
| 6 |
+
# HCALC Interfaces — Alloy vs Lean
|
| 7 |
+
|
| 8 |
+
**Owner:** HCALC Spec agent
|
| 9 |
+
**Definitions live in:** [`PRODUCTION.md`](PRODUCTION.md), [`COHERENCE.md`](COHERENCE.md), [`AXIOMS.md`](AXIOMS.md), [`FOUNDRY_J_CROSSLINKS.md`](FOUNDRY_J_CROSSLINKS.md).
|
| 10 |
+
**Status:** Production definitions landed; Alloy must replace A7 Undefined→SpecDefined; Lean defs not axioms; Verify flip SKIP→PASS where hyps hold.
|
| 11 |
+
**Spec does not write** `.als` or `.lean` bodies (see [`HANDOFF_PRODUCTION.md`](HANDOFF_PRODUCTION.md)).
|
| 12 |
+
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
## Shared vocabulary (symbol table)
|
| 16 |
+
|
| 17 |
+
| Symbol | Meaning | Gap / ID | Status |
|
| 18 |
+
|--------|---------|----------|--------|
|
| 19 |
+
| \(X_t\) | State | Gap-Carrier | **CLOSED** — `HCALC.Carrier` |
|
| 20 |
+
| \(T_p\) | Diagonal prime-indexed transform | Gap-Tp-from-P64, A7, L6 | **CLOSED** (**spec-def** α) |
|
| 21 |
+
| \(C\) | In-step scale-or-id | Gap-C-wrapper, A7, L6 | **CLOSED** (**spec-adapt** ≠ **43**) |
|
| 22 |
+
| \(\Lambda_m\) | Stabilizing **scalar** | Gap-Λm-scalar, A7, L6 | **CLOSED** |
|
| 23 |
+
| \(\Xi(t,\cdot)\) | HCALC evolution operator | Gap-Ξ, A7, L6 | **CLOSED** |
|
| 24 |
+
| Foundry step | \(x'=\Xi x+\Lambda T(x)+g\) | A4, L3 | FoundryAdditive diagnostic |
|
| 25 |
+
| HCALC step | \(X_{t+1}=\Xi(t,\Lambda_m\cdot C(T_p(X_t)))\) | NestedFaithful | production Core verb |
|
| 26 |
+
| InstanceBridge | Param table \(T:=C\circ T_p\), \(\Lambda:=\Lambda_m\mathbf{1}\), \(\Xi:=\xi_t\) | Gap-ShapeMap, L7 | **CLOSED** — NOT `rfl` |
|
| 27 |
+
| `P_64` | First-64 primes index set | A1, L1 | source-claim **23** |
|
| 28 |
+
|
| 29 |
+
Provenance on every Alloy assert / Lean axiom: `source-claim` | `axiom-gap` | `derived` | `SpecDefined` | `spec-def` | `spec-adapt`.
|
| 30 |
+
|
| 31 |
+
---
|
| 32 |
+
|
| 33 |
+
## What HCALC Alloy must assert
|
| 34 |
+
|
| 35 |
+
- **A1–A6** when the model claims Foundry-backed surfaces (finite predicates / traces).
|
| 36 |
+
- **A7** with **SpecDefined** records pointing at PRODUCTION.md (replace prior `Undefined`).
|
| 37 |
+
- **Inv-StepForm … Inv-OpaqueGaps** (COHERENCE invariant inventory).
|
| 38 |
+
- Dual `bridgeMode ∈ {NestedFaithful, FoundryAdditive}` + InstanceBridge table; **forbid** NestedFaithful = prop-**39** / `rfl`.
|
| 39 |
+
- Forbidden: PASS when guardian (**A6**) would reject.
|
| 40 |
+
- May leave as **parameters:** ε tier, instance tag, carrier dimension, whether PMAT is enabled.
|
| 41 |
+
- OptObj = Spec \(\ell_\infty\) residual; ContractAlg = Gershgorin→power-iter→scale-or-id.
|
| 42 |
+
|
| 43 |
+
Provenance tags should reference GapIds / A* / L* from COHERENCE/AXIOMS/PRODUCTION.
|
| 44 |
+
|
| 45 |
+
---
|
| 46 |
+
|
| 47 |
+
## What HCALC Lean may axiomize vs must prove
|
| 48 |
+
|
| 49 |
+
| May keep as infra axiom (toolchain only) | Must define or prove |
|
| 50 |
+
|------------------------------------------|----------------------|
|
| 51 |
+
| Gap-Real-arith / Gap-Foundry-* stubs | L1 P64 data as def |
|
| 52 |
+
| | L2 gershgorin/contractiveG |
|
| 53 |
+
| | L3 FoundryStep def (**≠** hcalcStep) |
|
| 54 |
+
| | L4 qEstimate/softProject (Foundry) |
|
| 55 |
+
| | L5 theorem under Hyp (0 sorry) |
|
| 56 |
+
| | L6: Λm, Ξ, C, Tp as **defs** (replace axioms) |
|
| 57 |
+
| | L7: `structure InstanceBridge` + dual-mode thms — **NOT** `rfl` / **NOT** `FoundryStep = hcalcStep` |
|
| 58 |
+
|
| 59 |
+
Zero `sorry` in production leaves. Domain gaps are CLOSED — no new L6 axioms.
|
| 60 |
+
|
| 61 |
+
---
|
| 62 |
+
|
| 63 |
+
## Foundry J Core / Verify
|
| 64 |
+
|
| 65 |
+
- Cross-links: `FOUNDRY_J_CROSSLINKS.md`; Foundry mirror `/workspace/foundry-j/spec/HCALC_CROSSLINKS.md`.
|
| 66 |
+
- Core implement path (authoritative): **`/workspace/hcalc/j/`** — verbs `tp_from_p64`, `c_wrap`, `lam_m_from_bound`, `hcalc_xi_apply`, `hcalc_step`, `hcalc_run`.
|
| 67 |
+
- Core hooks are **cite-only** — do not equate `hcalc_step` with `rec_step`.
|
| 68 |
+
- Verify outline: [`PROPERTIES.md`](PROPERTIES.md); harness [`../verify/README.md`](../verify/README.md).
|
| 69 |
+
- H-SHAPE PASS only for InstanceBridge witness, never identity.
|
| 70 |
+
|
| 71 |
+
---
|
| 72 |
+
|
| 73 |
+
## Hand-off
|
| 74 |
+
|
| 75 |
+
| Agent | Owns | Does not own |
|
| 76 |
+
|-------|------|--------------|
|
| 77 |
+
| **Spec** | PRODUCTION, COHERENCE, AXIOMS, PROPERTIES outline, INTERFACES, crosslinks | `.als`, `.lean`, J verb bodies |
|
| 78 |
+
| **Alloy** | `alloy/**/*.als`, Alloy README beyond stub | Changing GapId meanings / inventing `rfl` bridge |
|
| 79 |
+
| **Lean** | `lean/**/*.lean` | Re-axiomatizing CLOSED L6; `FoundryStep = hcalcStep` |
|
| 80 |
+
| **Verify** | `verify/` harness per PROPERTIES | Closing ShapeMap without Spec |
|
| 81 |
+
| **Core** | `/workspace/hcalc/j/` production verbs | Equating FoundryAdditive with NestedFaithful |
|
spec/PRODUCTION.md
ADDED
|
@@ -0,0 +1,304 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!--
|
| 2 |
+
Copyright (C) 2026 HCALC contributors
|
| 3 |
+
SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
-->
|
| 5 |
+
|
| 6 |
+
# HCALC Production Definitions
|
| 7 |
+
|
| 8 |
+
**Owner:** HCALC Spec
|
| 9 |
+
**License:** AGPL-3.0-only
|
| 10 |
+
**Status:** PRODUCTION — all domain Gap-* CLOSED by definition (not opaque axioms).
|
| 11 |
+
**Consumers:** Alloy, Lean, Foundry J Core/Verify/Spec.
|
| 12 |
+
**Related:** [`AXIOMS.md`](AXIOMS.md), [`COHERENCE.md`](COHERENCE.md), [`FOUNDRY_J_CROSSLINKS.md`](FOUNDRY_J_CROSSLINKS.md).
|
| 13 |
+
|
| 14 |
+
Nested recurrence (canonical):
|
| 15 |
+
|
| 16 |
+
\[
|
| 17 |
+
X_{t+1} = \Xi\bigl(t,\; \Lambda_m \cdot C(T_p(X_t))\bigr).
|
| 18 |
+
\]
|
| 19 |
+
|
| 20 |
+
---
|
| 21 |
+
|
| 22 |
+
## Parameters (fixed for production)
|
| 23 |
+
|
| 24 |
+
| Symbol | Meaning | Default |
|
| 25 |
+
|--------|---------|---------|
|
| 26 |
+
| \(n\) | Carrier dimension | parameter \(\ge 1\) (Lean: free `n : ℕ`) |
|
| 27 |
+
| \(\varepsilon\) | Contraction margin | tier schedule Foundry **25**: T1→0.10, T2→0.05, T3→0.02, T4→0.01; **default T2 = 0.05** |
|
| 28 |
+
| \(\delta\) | Guard for Λm denominator | \(10^{-12}\) (positive) |
|
| 29 |
+
| \(\mathrm{tol}\) | Residual stop | \(10^{-6}\) |
|
| 30 |
+
| `xi_schedule` | \(\xi_t\) law | **Uniform**: \(\xi_t = 1\) for all \(t\) |
|
| 31 |
+
| `g_t` | Affine kick | default \(0\) (zero vector) unless instance supplies otherwise |
|
| 32 |
+
|
| 33 |
+
Foundry cites used below: PROPERTIES **23**, **25**, **33–43**, **39**, **41**, **46**.
|
| 34 |
+
|
| 35 |
+
---
|
| 36 |
+
|
| 37 |
+
## Closed definitions
|
| 38 |
+
|
| 39 |
+
### 1. Gap-Carrier → `HCALC.Carrier` — CLOSED
|
| 40 |
+
|
| 41 |
+
\[
|
| 42 |
+
\texttt{HCALC.Carrier} \;\equiv\; X \;:=\; \mathbb{R}^n \;=\; (\mathrm{Fin}\, n \to \mathbb{R})
|
| 43 |
+
\]
|
| 44 |
+
|
| 45 |
+
with \(\ell_\infty\) norm \(\|x\|_\infty = \max_{j} |x_j|\).
|
| 46 |
+
Optional later instance: Goldilocks \(\mathbb{F}_p\) (Foundry **1–17**) — **not** required for production ℝ path.
|
| 47 |
+
|
| 48 |
+
### 2. Gap-Tp-from-P64 → `Tp` — CLOSED
|
| 49 |
+
|
| 50 |
+
Let \(P_{64} = (p_0,\ldots,p_{63})\) be the first-64 primes (Lean **L1** / Foundry prop **23**).
|
| 51 |
+
For dimension \(n\), use primes \(p_{j \bmod 64}\).
|
| 52 |
+
|
| 53 |
+
**Exact formula (diagonal PrimeMask weights):**
|
| 54 |
+
|
| 55 |
+
\[
|
| 56 |
+
\alpha_j \;=\; \frac{1}{1 + \log p_{j\bmod 64}}, \qquad
|
| 57 |
+
(T_p\, x)_j \;=\; \alpha_j \cdot x_j.
|
| 58 |
+
\]
|
| 59 |
+
|
| 60 |
+
So \(\varphi\) is the **identity on coordinates** (diagonal action).
|
| 61 |
+
Equivalent view: \(T_p = \mathrm{diag}(\alpha)\).
|
| 62 |
+
**Provenance:** \(\alpha\) law is **`spec-def`** (HCALC Spec) — **not** a Foundry source-claim. \(P_{64}\) list alone is Foundry **23** / Lean L1.
|
| 63 |
+
**Not** Sedona/PIRTM tooling; **not** full PMAT recursion.
|
| 64 |
+
|
| 65 |
+
**Provenance (§2):** `P64` list = Foundry **source-claim** (prop **23**). The weight law $\alpha_j=1/(1+\log p_{j\bmod 64})$ is **`spec-def`** — **not** a Foundry PROPERTY / not `source-claim` from foundry-j.
|
| 66 |
+
|
| 67 |
+
### 3. Gap-C-wrapper → `C` — CLOSED
|
| 68 |
+
|
| 69 |
+
Let \(D(T_p)\) be the Jacobian of \(T_p\) (here \(D(T_p)=\mathrm{diag}(\alpha)\)).
|
| 70 |
+
Let \(q\) be the operator-norm estimate via Gershgorin, with power-iteration fallback (Foundry **33–37**):
|
| 71 |
+
|
| 72 |
+
\[
|
| 73 |
+
q \;:=\; \|D(T_p)\|_{\mathrm{est}}.
|
| 74 |
+
\]
|
| 75 |
+
|
| 76 |
+
**In-step governor** — Spec-defined **state scale-or-id** (not post-hoc `ace_certify`):
|
| 77 |
+
|
| 78 |
+
\[
|
| 79 |
+
C(x) \;=\;
|
| 80 |
+
\begin{cases}
|
| 81 |
+
\dfrac{1-\varepsilon}{q}\, x & \text{if } q > 1-\varepsilon, \\[6pt]
|
| 82 |
+
x & \text{otherwise.}
|
| 83 |
+
\end{cases}
|
| 84 |
+
\]
|
| 85 |
+
|
| 86 |
+
I.e. \(C = s\cdot\mathrm{id}\) on **state**, with \(s=(1-\varepsilon)/q\) when over margin.
|
| 87 |
+
|
| 88 |
+
**Provenance (Foundry pass 2):** \(C\) is **`spec-adapt`** of the scale-factor *idea* \((1-\varepsilon)/q\).
|
| 89 |
+
**REJECT** identity with Foundry `soft_project` **43** (which scales schedule vectors \(\Xi,\Lambda\), not state).
|
| 90 |
+
Foundry **43** remains the coded schedule soft_project on the **FoundryAdditive** path. Production \(q=\|D(T_p)\|_{\mathrm{est}}\) is Spec \(q\), not Foundry **42** schedule \(q\).
|
| 91 |
+
|
| 92 |
+
**Provenance (§3):** Production `C` is **`spec-adapt`**: it reuses the *scale-or-id* idea \((1-\varepsilon)/q\) as an **algorithmic cousin** of Foundry `soft_project` (prop **43**), but it is **not** symbol-identical to **43**. Foundry **43** scales schedule weights \(\Xi,\Lambda\) under Foundry \(q\) (prop **42**); production `C` scales the **state** under Spec \(q:=\|D(T_p)\|_{\mathrm{est}}\). Do **not** tag `C` as Foundry `source-claim` for **43**. Shared helper name `softProjectScale` OK; **Foundry `soft_project` API stays schedule-scaling** (prop **43**). Production `C` remains Spec-wiring / **spec-adapt** (state scale).
|
| 93 |
+
|
| 94 |
+
### 4. Gap-Λm-scalar → `Λm` — CLOSED
|
| 95 |
+
|
| 96 |
+
\(\Lambda_m \in \mathbb{R}_{\ge 0}\) is a **scalar** (not Foundry `lambda_schedule` vector):
|
| 97 |
+
|
| 98 |
+
\[
|
| 99 |
+
\Lambda_m \;=\; \min\Bigl(1,\; \frac{1-\varepsilon}{\|C\circ T_p\|_{\mathrm{op}} + \delta}\Bigr),
|
| 100 |
+
\]
|
| 101 |
+
|
| 102 |
+
ensuring \(\|\Lambda_m\cdot(C\circ T_p)\|_{\mathrm{op}} \le 1-\varepsilon\).
|
| 103 |
+
|
| 104 |
+
### 5. Gap-Ξ → `Ξ` — CLOSED
|
| 105 |
+
|
| 106 |
+
With \(\xi_t\) from `xi_schedule(t)` (default **Uniform**: \(\xi_t=1\)) and kick \(g_t\):
|
| 107 |
+
|
| 108 |
+
\[
|
| 109 |
+
\Xi(t,y) \;:=\; \xi_t\cdot y + g_t.
|
| 110 |
+
\]
|
| 111 |
+
|
| 112 |
+
Therefore
|
| 113 |
+
|
| 114 |
+
\[
|
| 115 |
+
X_{t+1} = \xi_t\cdot\bigl(\Lambda_m\cdot C(T_p(X_t))\bigr) + g_t.
|
| 116 |
+
\]
|
| 117 |
+
|
| 118 |
+
### 6. Gap-ShapeMap / L7 — CLOSED via **InstanceBridge** (NOT `rfl`)
|
| 119 |
+
|
| 120 |
+
**REJECTED (Foundry J Spec review):** identity `Foundry39 ≡ nested`; silent `Λ_t↔Λm`, `T↔T_p`, `Ξ_t↔Ξ(t,·)`, Gershgorin/`soft_project` measures ↔ in-step `C` as Foundry-native law.
|
| 121 |
+
|
| 122 |
+
**ACCEPTED:** Gap-ShapeMap is a **non-identity** morphism. soft_project remains **Foundry-coded** (props **42–43**) and is *used by* HCALC `C` under this Spec — that is Spec wiring, not a Foundry identity claim.
|
| 123 |
+
|
| 124 |
+
#### Dual `bridgeMode` (keep both; never silent equate)
|
| 125 |
+
|
| 126 |
+
| `bridgeMode` | Meaning | Prop-**39**? |
|
| 127 |
+
|--------------|---------|--------------|
|
| 128 |
+
| **NestedFaithful** | production verb = `hcalcStep` (nested) | **no** — Spec nested; ≠ classical **39** |
|
| 129 |
+
| **FoundryAdditive** | diagnostic `toFoundryStep` via InstanceBridge param table | **yes-shaped** morphism toward **39**; still ≠ nested |
|
| 130 |
+
|
| 131 |
+
`InstanceBridge` is the **parameter table** \(T:=C\circ T_p\), \(\Lambda_{\mathrm{vec}}:=\Lambda_m\cdot\mathbf{1}\), \(\Xi_{\mathrm{vec}}:=\xi_t\), \(g:=g_t\) — a **non-identity** morphism, never `rfl`.
|
| 132 |
+
|
| 133 |
+
#### Explicit morphism `InstanceBridge` (feeds FoundryAdditive mode)
|
| 134 |
+
|
| 135 |
+
Let HCALC state \(x\in\texttt{HCALC.Carrier}\). Define a **labeled instance map** (Lean: `InstanceBridge`, Alloy: `bridgeMode = InstanceBridge`):
|
| 136 |
+
|
| 137 |
+
\[
|
| 138 |
+
\texttt{toFoundryStep}(t,x)
|
| 139 |
+
\;:=\;
|
| 140 |
+
\texttt{FoundryStep}\bigl(
|
| 141 |
+
\Xi_{\mathrm{vec}}:=\xi_t,\;
|
| 142 |
+
\Lambda_{\mathrm{vec}}:=\Lambda_m\cdot\mathbf{1},\;
|
| 143 |
+
T := C\circ T_p,\;
|
| 144 |
+
g := g_t,\;
|
| 145 |
+
x
|
| 146 |
+
\bigr)
|
| 147 |
+
\;=\;
|
| 148 |
+
\xi_t\cdot x + \Lambda_m\cdot(C\circ T_p)(x) + g_t.
|
| 149 |
+
\]
|
| 150 |
+
|
| 151 |
+
The **HCALC nested step** is separately:
|
| 152 |
+
|
| 153 |
+
\[
|
| 154 |
+
\texttt{hcalcStep}(t,x)
|
| 155 |
+
\;:=\;
|
| 156 |
+
\Xi\bigl(t,\, \Lambda_m\cdot C(T_p(x))\bigr)
|
| 157 |
+
\;=\;
|
| 158 |
+
\xi_t\cdot\bigl(\Lambda_m\cdot C(T_p(x))\bigr) + g_t.
|
| 159 |
+
\]
|
| 160 |
+
|
| 161 |
+
These are **different** morphisms in general (\(\xi_t\cdot x\) term present only on the Foundry side).
|
| 162 |
+
**L7 theorem (production):** there exists an explicit Spec-named witness relating them — *not* `rfl`:
|
| 163 |
+
|
| 164 |
+
- **Option A (recommended default):** `bridgeWitness = Projective` — equality after applying the HCALC projection that discards the free \(\xi_t\cdot x\) drift, or equivalently require \(\xi_t=0\) on the identity channel (not used).
|
| 165 |
+
- **Option B (operational default for Core):** implement **only** `hcalcStep` as the production verb; expose `toFoundryStep` as a **cite-only diagnostic** that uses Foundry `rec_step` shape with the parameter table above, **without claiming** `hcalcStep = toFoundryStep`.
|
| 166 |
+
- **Option C:** when \(\xi_t = 1\) and one rewrites nested as additive on an extended state, document the embedding \(\iota\) and prove `toFoundryStep(t,ι(x)) = ι(hcalcStep(t,x))` — still a morphism, **never** symbol identity.
|
| 167 |
+
|
| 168 |
+
**Production bridgeMode (dual — Foundry J Spec ACCEPT):**
|
| 169 |
+
|
| 170 |
+
| bridgeMode | Meaning | vs Foundry **39** |
|
| 171 |
+
|------------|---------|-------------------|
|
| 172 |
+
| **FoundryAdditive** | `toFoundryStep` = classical **39**-shaped morphism with InstanceBridge params `T:=C∘Tp`, `Λ:=Λm·1`, `Ξ:=ξ_t` | **ACCEPT** morphism into additive shape — **not** nested |
|
| 173 |
+
| **NestedFaithful** / nested `hcalcStep` | `ξ·(Λm·(C∘Tp)(x))+g` | Spec definitional nested — **REJECT** as prop-**39** `rfl` / identity |
|
| 174 |
+
|
| 175 |
+
**InstanceBridge** = the explicit parameter table (morphism data), not an equality proof. Hilbert morphism \(T:=C\circ T_p\), \(\Lambda:=\Lambda_m\mathbf{1}\), \(\Xi:=\xi\) maps to **FoundryAdditive** shape only.
|
| 176 |
+
|
| 177 |
+
**Production choice for Core:** implement **`hcalc_step`** = nested (NestedFaithful semantics); expose `toFoundryStep` only as FoundryAdditive diagnostic. **L7 UNBLOCKED** as `structure InstanceBridge` + dual-mode theorems — **never** `FoundryStep = hcalcStep`.
|
| 178 |
+
|
| 179 |
+
| Foundry symbol (instance params) | HCALC production value | Identity? |
|
| 180 |
+
|----------------------------------|------------------------|-----------|
|
| 181 |
+
| \(T\) | \(C\circ T_p\) | **no** — assignment under InstanceBridge |
|
| 182 |
+
| \(\Lambda_{\mathrm{vec}}\) | \(\Lambda_m\cdot\mathbf{1}\) | **no** — scalar broadcast ≠ Foundry schedule vector law |
|
| 183 |
+
| \(\Xi_{\mathrm{vec}}\) | \(\xi_t\) from HCALC `xi_schedule` | **no** — not Foundry \(\Xi_t\) vector schedule identity |
|
| 184 |
+
| \(g\) | \(g_t\) | instance param |
|
| 185 |
+
|
| 186 |
+
### 7. Gap-ContractAlg — CLOSED
|
| 187 |
+
|
| 188 |
+
Algorithm:
|
| 189 |
+
|
| 190 |
+
1. Estimate Spec \(q=\|D(T_p)\|_{\mathrm{est}}\) by Gershgorin; power-iteration fallback (Foundry measures **33–37**, Spec-wired).
|
| 191 |
+
2. Apply **state** scale-or-id \(C\) as in §3 (`spec-adapt`; ≠ schedule soft_project **43**).
|
| 192 |
+
3. Form \(\Lambda_m\) as in §4.
|
| 193 |
+
4. On FoundryAdditive path only: Foundry schedule soft_project **43** may still apply to \(\Xi,\Lambda\) schedules as coded.
|
| 194 |
+
|
| 195 |
+
### 8. Gap-Converge — CLOSED (L5 dischargeable)
|
| 196 |
+
|
| 197 |
+
**Hyp** (for iteration of **`hcalcStep`** — Option B / nested production path):
|
| 198 |
+
|
| 199 |
+
\[
|
| 200 |
+
|\xi_t|\cdot\|\Lambda_m\cdot(C\circ T_p)\|_{\mathrm{op}} < 1-\varepsilon.
|
| 201 |
+
\]
|
| 202 |
+
|
| 203 |
+
Under Uniform \(\xi_t=1\) this is \(\|\Lambda_m\cdot(C\circ T_p)\|_{\mathrm{op}} < 1-\varepsilon\).
|
| 204 |
+
|
| 205 |
+
Do **not** state Hyp on `toFoundryStep` / classical additive shape without an extra account of the free \(\xi_t\cdot x\) term (that diagnostic has a different operator).
|
| 206 |
+
|
| 207 |
+
Then: Banach unique fixed point (Foundry narrative **41**, spirit) and residual \(\to 0\) along **`hcalcStep`** iteration (stop spirit of **46**; metric is Spec \(\ell_\infty\)).
|
| 208 |
+
**L5:** theorem under Hyp (prove in Lean; not unfinished axiom).
|
| 209 |
+
|
| 210 |
+
### 9. Gap-OptObj — CLOSED
|
| 211 |
+
|
| 212 |
+
\[
|
| 213 |
+
J(X) \;=\; \bigl\| X - \Xi\bigl(t,\, \Lambda_m\cdot C(T_p(X))\bigr) \bigr\|_\infty
|
| 214 |
+
\]
|
| 215 |
+
|
| 216 |
+
(residual). **Optimize** = iterate the nested map until \(J(X)<\mathrm{tol}\).
|
| 217 |
+
|
| 218 |
+
**Provenance (residual):** PRODUCTION \(J\) uses \(\ell_\infty\). Foundry prop **46** residual is \(\ell_2\). **ACCEPT Spec \(\ell_\infty\) choice**; do not claim metric identity with **46** — only stop-spirit / tolerance pattern.
|
| 219 |
+
|
| 220 |
+
---
|
| 221 |
+
|
| 222 |
+
## Infra gaps (not domain blockers)
|
| 223 |
+
|
| 224 |
+
| GapId | Disposition |
|
| 225 |
+
|-------|-------------|
|
| 226 |
+
| Gap-Real-arith | Infra stub OK (RealStub / future Mathlib). Must not leave unfinished *production* theorems depending on sorry. |
|
| 227 |
+
| Gap-Foundry-StateOps / FinMax / Norm / Div / SoftScale | Infra for Foundry mirrors; production HCALC path uses Carrier ℝ^n defs above. Replace with Mathlib when ready. |
|
| 228 |
+
|
| 229 |
+
---
|
| 230 |
+
|
| 231 |
+
## Gap disposition table
|
| 232 |
+
|
| 233 |
+
| GapId | Was | Now | Alloy action | Lean action | Verify action |
|
| 234 |
+
|-------|-----|-----|--------------|-------------|---------------|
|
| 235 |
+
| Gap-Carrier | axiom-gap | **CLOSED** `HCALC.Carrier = Fin n → ℝ`, ℓ∞ | Instance param → ℝ^n model / abstract n | `def Carrier` | Check A carrier |
|
| 236 |
+
| Gap-Tp-from-P64 | axiom-gap | **CLOSED** diag \(\alpha\) (**spec-def**); P64 list **source-claim** **23** | Retire Undefined; encode diag Tp | `def Tp` from L1 P64 | Prime carrier + Tp law |
|
| 237 |
+
| Gap-C-wrapper | axiom-gap | **CLOSED** scale-or-id on Spec \(q\) (**spec-adapt**; cousin of **43**, ≠ **43**) | C = scale-or-id | `def C` | Contraction spectral/q |
|
| 238 |
+
| Gap-Λm-scalar | axiom-gap | **CLOSED** scalar min formula | Λm scalar bound assert | `def LambdaM` | Stabilizing range |
|
| 239 |
+
| Gap-Ξ | axiom-gap | **CLOSED** \(\xi_t y + g_t\), Uniform default | Ξ affine | `def Xi` | Evolution step shape |
|
| 240 |
+
| Gap-ShapeMap / L7 | blocked | **CLOSED** dual `bridgeMode` NestedFaithful|FoundryAdditive + InstanceBridge table (NOT rfl; NestedFaithful ≠ prop39) | Encode InstanceBridge table; forbid symbol identity | **L7** `structure InstanceBridge` + Option B/C thms | H-SHAPE → PASS only for InstanceBridge witness, never identity |
|
| 241 |
+
| Gap-ContractAlg | axiom-gap | **CLOSED** Gershgorin→power-iter→soft_project | A2/A3 production wiring | defs + thms | Checks B |
|
| 242 |
+
| Gap-Converge | axiom-gap | **CLOSED** Hyp ⇒ Banach + residual→0 | Guardian + residual | **L5** under Hyp | Residual discharge |
|
| 243 |
+
| Gap-OptObj | axiom-gap | **CLOSED** \(J=\) residual; iterate to tol | OptObj residual | `def J` + loop spec | Optimize/converge props |
|
| 244 |
+
| A7 | Undefined stubs | **SpecDefined** records pointing here | Replace Undefined→Defined | — | A7 gate PASS |
|
| 245 |
+
| L6 | uninterpreted axioms | **defs** | — | Replace axioms with defs | Seal Lean↔Alloy |
|
| 246 |
+
| Gap-Real-arith / Gap-Foundry-* | infra | infra OK | ignore | keep stubs or Mathlib | no false PASS |
|
| 247 |
+
|
| 248 |
+
---
|
| 249 |
+
|
| 250 |
+
## Alloy checklist
|
| 251 |
+
|
| 252 |
+
1. Retire all `Undefined` on Λm, Ξ, C, Tp → `SpecDefined` / production preds.
|
| 253 |
+
2. Keep A1–A6; rewire A2/A3/A4 to production C/Λm/`InstanceBridge`.
|
| 254 |
+
3. Encode **`bridgeMode`**: nested **`hcalcStep`** vs diagnostic **`toFoundryStep`** (InstanceBridge param table). Do **not** assert Foundry39≡nested; do **not** use a bare `FoundryAdditive` equate without InstanceBridge params.
|
| 255 |
+
4. OptObj = residual (\(\ell_\infty\)); ContractAlg = Gershgorin→power-iter→Spec scale-or-id.
|
| 256 |
+
5. Report check log green.
|
| 257 |
+
|
| 258 |
+
|
| 259 |
+
## Lean checklist
|
| 260 |
+
|
| 261 |
+
1. `Carrier`, `Tp`, `C`, `LambdaM`, `Xi`, `J` as **defs**.
|
| 262 |
+
2. Unblock **L7** InstanceBridge (`def` / theorem).
|
| 263 |
+
3. **L5** theorem under Hyp (0 sorry).
|
| 264 |
+
4. Infra RealStub only if no production sorry.
|
| 265 |
+
5. `lake build` exit 0.
|
| 266 |
+
|
| 267 |
+
## Verify checklist
|
| 268 |
+
|
| 269 |
+
1. Flip SKIP→PASS where hyps hold (A–E).
|
| 270 |
+
2. H-SHAPE PASS under InstanceBridge.
|
| 271 |
+
3. FAIL-open still if Lean sorry / Alloy unsat.
|
| 272 |
+
4. Update `PROPERTY_MAP.md`.
|
| 273 |
+
|
| 274 |
+
## Core checklist (Foundry J)
|
| 275 |
+
|
| 276 |
+
Implement verbs: `Tp` from P64 α, in-step `C` state scale-or-id (`spec-adapt`), scalar `Λm`, `Xi` from `xi_schedule`, InstanceBridge step. Cite `P64`, `spectral_analyze`, `soft_project`, `q_estimate`, `synth_weights`, `rec_step`.
|
| 277 |
+
|
| 278 |
+
---
|
| 279 |
+
|
| 280 |
+
|
| 281 |
+
## Core implement path (AUTHORITATIVE)
|
| 282 |
+
|
| 283 |
+
**Path:** `/workspace/hcalc/j/` (HCALC research-center repo; AGPL-3.0-only).
|
| 284 |
+
Foundry J Core implements production verbs **here**, calling Foundry cite hooks from `foundry-j` (`P64`, `spectral_analyze`, `soft_project`, `q_estimate`, `synth_weights`) without equating `hcalc_step` to `rec_step`.
|
| 285 |
+
|
| 286 |
+
| Verb | Formula source in this file |
|
| 287 |
+
|------|-----------------------------|
|
| 288 |
+
| `tp_from_p64` | §2 Gap-Tp-from-P64 |
|
| 289 |
+
| `c_wrap` | §3 Gap-C-wrapper (state scale-or-id; ≠ soft_project **43**) |
|
| 290 |
+
| `lam_m_from_bound` | §4 Gap-Λm-scalar |
|
| 291 |
+
| `hcalc_xi_apply` | §5 Gap-Ξ |
|
| 292 |
+
| `hcalc_step` | nested §5; **not** `rec_step` |
|
| 293 |
+
| `hcalc_run` | iterate `hcalc_step` until §9 residual < tol |
|
| 294 |
+
|
| 295 |
+
Draft names from `foundry-j/j/HCALC_API_DRAFT.md` are **accepted**. Leave Foundry additive API unchanged.
|
| 296 |
+
|
| 297 |
+
---
|
| 298 |
+
## Changelog
|
| 299 |
+
|
| 300 |
+
- 2026-10-07: Initial PRODUCTION close-all-gaps (USER mandate via Hilbert).
|
| 301 |
+
- 2026-10-07: ShapeMap → explicit **InstanceBridge** (Foundry J Spec review); Core path `/workspace/hcalc/j/`.
|
| 302 |
+
- 2026-10-07: Pass-3 nits — §3 schedule-scaling note; Alloy checklist InstanceBridge; §8 Hyp on hcalcStep.
|
| 303 |
+
- 2026-10-07: Pass-2 absorb — `C`/`q` **spec-adapt** (≠ Foundry **43**/**42**); \(\alpha\) **spec-def**; dual NestedFaithful|FoundryAdditive; residual \(\ell_\infty\neq\ell_2\) note.
|
| 304 |
+
- 2026-10-07: Fold Foundry pass 2 — C ≠ soft_project#43; α `spec-def`; NestedFaithful ≠ prop39; dual bridgeMode kept.
|
spec/PROPERTIES.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!--
|
| 2 |
+
Copyright (C) 2026 HCALC contributors
|
| 3 |
+
SPDX-License-Identifier: AGPL-3.0-only
|
| 4 |
+
-->
|
| 5 |
+
|
| 6 |
+
# HCALC PROPERTIES (Verify outline)
|
| 7 |
+
|
| 8 |
+
**Owner:** HCALC Spec (outline) → HCALC Verify / Foundry J Verify (harness).
|
| 9 |
+
**Pattern:** Foundry `PROPERTIES → J_API freeze → verify/ harness prop_N`.
|
| 10 |
+
**Authority:** This file’s **PROPERTY_MAP** is authoritative for HCALC verify naming. Foundry props remain cited by number under `/workspace/foundry-j/spec/PROPERTIES.md` (cite-only).
|
| 11 |
+
**Production:** [`PRODUCTION.md`](PRODUCTION.md) — domain Gap-* CLOSED; flip SKIP→PASS where hyps hold.
|
| 12 |
+
**Harness:** Not written here — see [`../verify/README.md`](../verify/README.md).
|
| 13 |
+
|
| 14 |
+
Absorbed obligations: [`FOUNDRY_J_CROSSLINKS.md`](FOUNDRY_J_CROSSLINKS.md).
|
| 15 |
+
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
## Gate sequence
|
| 19 |
+
|
| 20 |
+
1. **PROPERTIES** (this outline) — name props and SKIP reasons.
|
| 21 |
+
2. **J_API freeze** — when a J surface is adopted, freeze nouns against `/workspace/foundry-j/spec/J_API.md` and `/workspace/hcalc/j/`.
|
| 22 |
+
3. **verify/ harness** — `prop_N` executables; map via PROPERTY_MAP.
|
| 23 |
+
4. **Seal** — Lean ↔ Alloy ↔ J: `sorry` / Alloy unsat / missing A7 SpecDefined ⇒ **SKIP** or **FAIL-open**, never PASS.
|
| 24 |
+
|
| 25 |
+
---
|
| 26 |
+
|
| 27 |
+
## Checks A–E (disposition under production defs)
|
| 28 |
+
|
| 29 |
+
| Check | Title | Intent | Gap / ID links | PASS requires |
|
| 30 |
+
|-------|-------|--------|----------------|---------------|
|
| 31 |
+
| **A** | Prime carrier | `P_64` length/contents; Tp α law | A1, L1, Gap-Tp-from-P64 (**CLOSED**, α **spec-def**) | A1 holds; diag Tp encoded |
|
| 32 |
+
| **B** | Contraction spectral / q | Gershgorin / power-iter / tier ε / Spec q-budget | A2, A3, L2, L4, Gap-C (**spec-adapt**) | contractive flags consistent; C scale-or-id |
|
| 33 |
+
| **C** | Evolution step shape | Dual bridgeMode NestedFaithful\|FoundryAdditive; InstanceBridge table | A3, A4, Gap-ShapeMap, L3, L7 | instance/bridgeMode correct; **no** additive=`rfl` nested |
|
| 34 |
+
| **D** | Field ids if \(\mathbb{F}_p\) | Goldilocks / field identifiers when carrier is finite-field | Gap-Carrier optional; Foundry 1–17 | ids match coded field; prop **16** FAIL kept in view if claimed |
|
| 35 |
+
| **E** | Cross-artifact seal | Lean ↔ Alloy ↔ J agreement | A7 SpecDefined, L6 defs, L5 under Hyp | no PASS with sorry/unsat/Undefined A7 |
|
| 36 |
+
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
## PROPERTY_MAP (authoritative names)
|
| 40 |
+
|
| 41 |
+
| HCALC prop id | Check | Statement (one line) | Foundry cite | Default if open |
|
| 42 |
+
|---------------|-------|----------------------|--------------|-----------------|
|
| 43 |
+
| H-A1 | A | P_64 cardinality and list | **23** | FAIL if Foundry instance and mismatch |
|
| 44 |
+
| H-A2 | B | contractive iff gershgorin < 1-ε | **33–34** | FAIL on contradiction |
|
| 45 |
+
| H-A3 | B/C | scale-or-id when Spec q>1-ε (C) | cousin of **43** | FAIL if production C skipped |
|
| 46 |
+
| H-A4 | C | affine step only if FoundryAdditive / instance=Foundry | **39** | FAIL on mixed symbols / silent identity |
|
| 47 |
+
| H-A5 | A/E | PMAT conservation if PMAT used | **29** | SKIP if PMAT unused |
|
| 48 |
+
| H-A6 | B | guardian spectral legality | **55** | FAIL on illegal accept |
|
| 49 |
+
| H-A7 | E | SpecDefined definition-record for Λm, Ξ, C, Tp | PRODUCTION.md | FAIL-open if Undefined |
|
| 50 |
+
| H-SHAPE | C | InstanceBridge witness (NOT identity) | PRODUCTION §6 | **PASS** under InstanceBridge; never identity PASS |
|
| 51 |
+
| H-L5 | E | Banach unique FP under Hyp | **41** | PASS when Hyp discharged; else SKIP/FAIL-open |
|
| 52 |
+
| H-NEST | C | Nested `hcalcStep` well-tagged (NestedFaithful) | PRODUCTION §§5–6 | PASS when nested defs hold |
|
| 53 |
+
| H-OPT | E | residual \(J\) \(\ell_\infty\) < tol | PRODUCTION §9 (≠ **46** \(\ell_2\)) | PASS when iterate-to-tol |
|
| 54 |
+
|
| 55 |
+
---
|
| 56 |
+
|
| 57 |
+
## SKIP registry (names + reason)
|
| 58 |
+
|
| 59 |
+
| SKIP name | Reason | Production disposition |
|
| 60 |
+
|-----------|--------|------------------------|
|
| 61 |
+
| SKIP-ShapeBridge | Was: Gap-ShapeMap / L7 blocked | **RETIRE** for InstanceBridge tests → PASS; keep SKIP only for identity/`rfl` claims |
|
| 62 |
+
| SKIP-Λm-formula | Was: no scalar formula | **RETIRE** — Λm CLOSED |
|
| 63 |
+
| SKIP-C-instep | Was: post-hoc only | **RETIRE** — C CLOSED (spec-adapt) |
|
| 64 |
+
| SKIP-Tp-law | Was: P_64 index only | **RETIRE** — Tp CLOSED (spec-def) |
|
| 65 |
+
| SKIP-Ξ-op | Was: schedule ≠ operator | **RETIRE** — Ξ CLOSED |
|
| 66 |
+
| SKIP-OptObj | Was: undefined | **RETIRE** — J = residual |
|
| 67 |
+
| SKIP-L5-proof | L5 unfinished | **FLIP** → PASS when Hyp proved; else FAIL-open |
|
| 68 |
+
| SKIP-Goldilocks16 | Foundry prop **16** FAIL — do not claim PASS lift | **KEEP** |
|
| 69 |
+
|
| 70 |
+
---
|
| 71 |
+
|
| 72 |
+
## Core citation targets (cite-only)
|
| 73 |
+
|
| 74 |
+
`P64`, `pmat_compose`, `spectral_analyze`, `soft_project`, `q_estimate`, `synth_weights`, `rec_step`, `rec_run`, `ace_certify`.
|
| 75 |
+
|
| 76 |
+
HCALC Core verbs (implement in `/workspace/hcalc/j/`): `tp_from_p64`, `c_wrap`, `lam_m_from_bound`, `hcalc_xi_apply`, `hcalc_step`, `hcalc_run`.
|
| 77 |
+
|
| 78 |
+
Docs: `/workspace/foundry-j/spec/J_API.md`, `GAP_DECISIONS.md`, `PROPERTIES.md`, `/workspace/foundry-j/j/BOXING.md`, [`PRODUCTION.md`](PRODUCTION.md).
|
verify/LICENSE
ADDED
|
@@ -0,0 +1,661 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
GNU AFFERO GENERAL PUBLIC LICENSE
|
| 2 |
+
Version 3, 19 November 2007
|
| 3 |
+
|
| 4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
| 5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
| 6 |
+
of this license document, but changing it is not allowed.
|
| 7 |
+
|
| 8 |
+
Preamble
|
| 9 |
+
|
| 10 |
+
The GNU Affero General Public License is a free, copyleft license for
|
| 11 |
+
software and other kinds of works, specifically designed to ensure
|
| 12 |
+
cooperation with the community in the case of network server software.
|
| 13 |
+
|
| 14 |
+
The licenses for most software and other practical works are designed
|
| 15 |
+
to take away your freedom to share and change the works. By contrast,
|
| 16 |
+
our General Public Licenses are intended to guarantee your freedom to
|
| 17 |
+
share and change all versions of a program--to make sure it remains free
|
| 18 |
+
software for all its users.
|
| 19 |
+
|
| 20 |
+
When we speak of free software, we are referring to freedom, not
|
| 21 |
+
price. Our General Public Licenses are designed to make sure that you
|
| 22 |
+
have the freedom to distribute copies of free software (and charge for
|
| 23 |
+
them if you wish), that you receive source code or can get it if you
|
| 24 |
+
want it, that you can change the software or use pieces of it in new
|
| 25 |
+
free programs, and that you know you can do these things.
|
| 26 |
+
|
| 27 |
+
Developers that use our General Public Licenses protect your rights
|
| 28 |
+
with two steps: (1) assert copyright on the software, and (2) offer
|
| 29 |
+
you this License which gives you legal permission to copy, distribute
|
| 30 |
+
and/or modify the software.
|
| 31 |
+
|
| 32 |
+
A secondary benefit of defending all users' freedom is that
|
| 33 |
+
improvements made in alternate versions of the program, if they
|
| 34 |
+
receive widespread use, become available for other developers to
|
| 35 |
+
incorporate. Many developers of free software are heartened and
|
| 36 |
+
encouraged by the resulting cooperation. However, in the case of
|
| 37 |
+
software used on network servers, this result may fail to come about.
|
| 38 |
+
The GNU General Public License permits making a modified version and
|
| 39 |
+
letting the public access it on a server without ever releasing its
|
| 40 |
+
source code to the public.
|
| 41 |
+
|
| 42 |
+
The GNU Affero General Public License is designed specifically to
|
| 43 |
+
ensure that, in such cases, the modified source code becomes available
|
| 44 |
+
to the community. It requires the operator of a network server to
|
| 45 |
+
provide the source code of the modified version running there to the
|
| 46 |
+
users of that server. Therefore, public use of a modified version, on
|
| 47 |
+
a publicly accessible server, gives the public access to the source
|
| 48 |
+
code of the modified version.
|
| 49 |
+
|
| 50 |
+
An older license, called the Affero General Public License and
|
| 51 |
+
published by Affero, was designed to accomplish similar goals. This is
|
| 52 |
+
a different license, not a version of the Affero GPL, but Affero has
|
| 53 |
+
released a new version of the Affero GPL which permits relicensing under
|
| 54 |
+
this license.
|
| 55 |
+
|
| 56 |
+
The precise terms and conditions for copying, distribution and
|
| 57 |
+
modification follow.
|
| 58 |
+
|
| 59 |
+
TERMS AND CONDITIONS
|
| 60 |
+
|
| 61 |
+
0. Definitions.
|
| 62 |
+
|
| 63 |
+
"This License" refers to version 3 of the GNU Affero General Public License.
|
| 64 |
+
|
| 65 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
| 66 |
+
works, such as semiconductor masks.
|
| 67 |
+
|
| 68 |
+
"The Program" refers to any copyrightable work licensed under this
|
| 69 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
| 70 |
+
"recipients" may be individuals or organizations.
|
| 71 |
+
|
| 72 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
| 73 |
+
in a fashion requiring copyright permission, other than the making of an
|
| 74 |
+
exact copy. The resulting work is called a "modified version" of the
|
| 75 |
+
earlier work or a work "based on" the earlier work.
|
| 76 |
+
|
| 77 |
+
A "covered work" means either the unmodified Program or a work based
|
| 78 |
+
on the Program.
|
| 79 |
+
|
| 80 |
+
To "propagate" a work means to do anything with it that, without
|
| 81 |
+
permission, would make you directly or secondarily liable for
|
| 82 |
+
infringement under applicable copyright law, except executing it on a
|
| 83 |
+
computer or modifying a private copy. Propagation includes copying,
|
| 84 |
+
distribution (with or without modification), making available to the
|
| 85 |
+
public, and in some countries other activities as well.
|
| 86 |
+
|
| 87 |
+
To "convey" a work means any kind of propagation that enables other
|
| 88 |
+
parties to make or receive copies. Mere interaction with a user through
|
| 89 |
+
a computer network, with no transfer of a copy, is not conveying.
|
| 90 |
+
|
| 91 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
| 92 |
+
to the extent that it includes a convenient and prominently visible
|
| 93 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
| 94 |
+
tells the user that there is no warranty for the work (except to the
|
| 95 |
+
extent that warranties are provided), that licensees may convey the
|
| 96 |
+
work under this License, and how to view a copy of this License. If
|
| 97 |
+
the interface presents a list of user commands or options, such as a
|
| 98 |
+
menu, a prominent item in the list meets this criterion.
|
| 99 |
+
|
| 100 |
+
1. Source Code.
|
| 101 |
+
|
| 102 |
+
The "source code" for a work means the preferred form of the work
|
| 103 |
+
for making modifications to it. "Object code" means any non-source
|
| 104 |
+
form of a work.
|
| 105 |
+
|
| 106 |
+
A "Standard Interface" means an interface that either is an official
|
| 107 |
+
standard defined by a recognized standards body, or, in the case of
|
| 108 |
+
interfaces specified for a particular programming language, one that
|
| 109 |
+
is widely used among developers working in that language.
|
| 110 |
+
|
| 111 |
+
The "System Libraries" of an executable work include anything, other
|
| 112 |
+
than the work as a whole, that (a) is included in the normal form of
|
| 113 |
+
packaging a Major Component, but which is not part of that Major
|
| 114 |
+
Component, and (b) serves only to enable use of the work with that
|
| 115 |
+
Major Component, or to implement a Standard Interface for which an
|
| 116 |
+
implementation is available to the public in source code form. A
|
| 117 |
+
"Major Component", in this context, means a major essential component
|
| 118 |
+
(kernel, window system, and so on) of the specific operating system
|
| 119 |
+
(if any) on which the executable work runs, or a compiler used to
|
| 120 |
+
produce the work, or an object code interpreter used to run it.
|
| 121 |
+
|
| 122 |
+
The "Corresponding Source" for a work in object code form means all
|
| 123 |
+
the source code needed to generate, install, and (for an executable
|
| 124 |
+
work) run the object code and to modify the work, including scripts to
|
| 125 |
+
control those activities. However, it does not include the work's
|
| 126 |
+
System Libraries, or general-purpose tools or generally available free
|
| 127 |
+
programs which are used unmodified in performing those activities but
|
| 128 |
+
which are not part of the work. For example, Corresponding Source
|
| 129 |
+
includes interface definition files associated with source files for
|
| 130 |
+
the work, and the source code for shared libraries and dynamically
|
| 131 |
+
linked subprograms that the work is specifically designed to require,
|
| 132 |
+
such as by intimate data communication or control flow between those
|
| 133 |
+
subprograms and other parts of the work.
|
| 134 |
+
|
| 135 |
+
The Corresponding Source need not include anything that users
|
| 136 |
+
can regenerate automatically from other parts of the Corresponding
|
| 137 |
+
Source.
|
| 138 |
+
|
| 139 |
+
The Corresponding Source for a work in source code form is that
|
| 140 |
+
same work.
|
| 141 |
+
|
| 142 |
+
2. Basic Permissions.
|
| 143 |
+
|
| 144 |
+
All rights granted under this License are granted for the term of
|
| 145 |
+
copyright on the Program, and are irrevocable provided the stated
|
| 146 |
+
conditions are met. This License explicitly affirms your unlimited
|
| 147 |
+
permission to run the unmodified Program. The output from running a
|
| 148 |
+
covered work is covered by this License only if the output, given its
|
| 149 |
+
content, constitutes a covered work. This License acknowledges your
|
| 150 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
| 151 |
+
|
| 152 |
+
You may make, run and propagate covered works that you do not
|
| 153 |
+
convey, without conditions so long as your license otherwise remains
|
| 154 |
+
in force. You may convey covered works to others for the sole purpose
|
| 155 |
+
of having them make modifications exclusively for you, or provide you
|
| 156 |
+
with facilities for running those works, provided that you comply with
|
| 157 |
+
the terms of this License in conveying all material for which you do
|
| 158 |
+
not control copyright. Those thus making or running the covered works
|
| 159 |
+
for you must do so exclusively on your behalf, under your direction
|
| 160 |
+
and control, on terms that prohibit them from making any copies of
|
| 161 |
+
your copyrighted material outside their relationship with you.
|
| 162 |
+
|
| 163 |
+
Conveying under any other circumstances is permitted solely under
|
| 164 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
| 165 |
+
makes it unnecessary.
|
| 166 |
+
|
| 167 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
| 168 |
+
|
| 169 |
+
No covered work shall be deemed part of an effective technological
|
| 170 |
+
measure under any applicable law fulfilling obligations under article
|
| 171 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
| 172 |
+
similar laws prohibiting or restricting circumvention of such
|
| 173 |
+
measures.
|
| 174 |
+
|
| 175 |
+
When you convey a covered work, you waive any legal power to forbid
|
| 176 |
+
circumvention of technological measures to the extent such circumvention
|
| 177 |
+
is effected by exercising rights under this License with respect to
|
| 178 |
+
the covered work, and you disclaim any intention to limit operation or
|
| 179 |
+
modification of the work as a means of enforcing, against the work's
|
| 180 |
+
users, your or third parties' legal rights to forbid circumvention of
|
| 181 |
+
technological measures.
|
| 182 |
+
|
| 183 |
+
4. Conveying Verbatim Copies.
|
| 184 |
+
|
| 185 |
+
You may convey verbatim copies of the Program's source code as you
|
| 186 |
+
receive it, in any medium, provided that you conspicuously and
|
| 187 |
+
appropriately publish on each copy an appropriate copyright notice;
|
| 188 |
+
keep intact all notices stating that this License and any
|
| 189 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
| 190 |
+
keep intact all notices of the absence of any warranty; and give all
|
| 191 |
+
recipients a copy of this License along with the Program.
|
| 192 |
+
|
| 193 |
+
You may charge any price or no price for each copy that you convey,
|
| 194 |
+
and you may offer support or warranty protection for a fee.
|
| 195 |
+
|
| 196 |
+
5. Conveying Modified Source Versions.
|
| 197 |
+
|
| 198 |
+
You may convey a work based on the Program, or the modifications to
|
| 199 |
+
produce it from the Program, in the form of source code under the
|
| 200 |
+
terms of section 4, provided that you also meet all of these conditions:
|
| 201 |
+
|
| 202 |
+
a) The work must carry prominent notices stating that you modified
|
| 203 |
+
it, and giving a relevant date.
|
| 204 |
+
|
| 205 |
+
b) The work must carry prominent notices stating that it is
|
| 206 |
+
released under this License and any conditions added under section
|
| 207 |
+
7. This requirement modifies the requirement in section 4 to
|
| 208 |
+
"keep intact all notices".
|
| 209 |
+
|
| 210 |
+
c) You must license the entire work, as a whole, under this
|
| 211 |
+
License to anyone who comes into possession of a copy. This
|
| 212 |
+
License will therefore apply, along with any applicable section 7
|
| 213 |
+
additional terms, to the whole of the work, and all its parts,
|
| 214 |
+
regardless of how they are packaged. This License gives no
|
| 215 |
+
permission to license the work in any other way, but it does not
|
| 216 |
+
invalidate such permission if you have separately received it.
|
| 217 |
+
|
| 218 |
+
d) If the work has interactive user interfaces, each must display
|
| 219 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
| 220 |
+
interfaces that do not display Appropriate Legal Notices, your
|
| 221 |
+
work need not make them do so.
|
| 222 |
+
|
| 223 |
+
A compilation of a covered work with other separate and independent
|
| 224 |
+
works, which are not by their nature extensions of the covered work,
|
| 225 |
+
and which are not combined with it such as to form a larger program,
|
| 226 |
+
in or on a volume of a storage or distribution medium, is called an
|
| 227 |
+
"aggregate" if the compilation and its resulting copyright are not
|
| 228 |
+
used to limit the access or legal rights of the compilation's users
|
| 229 |
+
beyond what the individual works permit. Inclusion of a covered work
|
| 230 |
+
in an aggregate does not cause this License to apply to the other
|
| 231 |
+
parts of the aggregate.
|
| 232 |
+
|
| 233 |
+
6. Conveying Non-Source Forms.
|
| 234 |
+
|
| 235 |
+
You may convey a covered work in object code form under the terms
|
| 236 |
+
of sections 4 and 5, provided that you also convey the
|
| 237 |
+
machine-readable Corresponding Source under the terms of this License,
|
| 238 |
+
in one of these ways:
|
| 239 |
+
|
| 240 |
+
a) Convey the object code in, or embodied in, a physical product
|
| 241 |
+
(including a physical distribution medium), accompanied by the
|
| 242 |
+
Corresponding Source fixed on a durable physical medium
|
| 243 |
+
customarily used for software interchange.
|
| 244 |
+
|
| 245 |
+
b) Convey the object code in, or embodied in, a physical product
|
| 246 |
+
(including a physical distribution medium), accompanied by a
|
| 247 |
+
written offer, valid for at least three years and valid for as
|
| 248 |
+
long as you offer spare parts or customer support for that product
|
| 249 |
+
model, to give anyone who possesses the object code either (1) a
|
| 250 |
+
copy of the Corresponding Source for all the software in the
|
| 251 |
+
product that is covered by this License, on a durable physical
|
| 252 |
+
medium customarily used for software interchange, for a price no
|
| 253 |
+
more than your reasonable cost of physically performing this
|
| 254 |
+
conveying of source, or (2) access to copy the
|
| 255 |
+
Corresponding Source from a network server at no charge.
|
| 256 |
+
|
| 257 |
+
c) Convey individual copies of the object code with a copy of the
|
| 258 |
+
written offer to provide the Corresponding Source. This
|
| 259 |
+
alternative is allowed only occasionally and noncommercially, and
|
| 260 |
+
only if you received the object code with such an offer, in accord
|
| 261 |
+
with subsection 6b.
|
| 262 |
+
|
| 263 |
+
d) Convey the object code by offering access from a designated
|
| 264 |
+
place (gratis or for a charge), and offer equivalent access to the
|
| 265 |
+
Corresponding Source in the same way through the same place at no
|
| 266 |
+
further charge. You need not require recipients to copy the
|
| 267 |
+
Corresponding Source along with the object code. If the place to
|
| 268 |
+
copy the object code is a network server, the Corresponding Source
|
| 269 |
+
may be on a different server (operated by you or a third party)
|
| 270 |
+
that supports equivalent copying facilities, provided you maintain
|
| 271 |
+
clear directions next to the object code saying where to find the
|
| 272 |
+
Corresponding Source. Regardless of what server hosts the
|
| 273 |
+
Corresponding Source, you remain obligated to ensure that it is
|
| 274 |
+
available for as long as needed to satisfy these requirements.
|
| 275 |
+
|
| 276 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
| 277 |
+
you inform other peers where the object code and Corresponding
|
| 278 |
+
Source of the work are being offered to the general public at no
|
| 279 |
+
charge under subsection 6d.
|
| 280 |
+
|
| 281 |
+
A separable portion of the object code, whose source code is excluded
|
| 282 |
+
from the Corresponding Source as a System Library, need not be
|
| 283 |
+
included in conveying the object code work.
|
| 284 |
+
|
| 285 |
+
A "User Product" is either (1) a "consumer product", which means any
|
| 286 |
+
tangible personal property which is normally used for personal, family,
|
| 287 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
| 288 |
+
into a dwelling. In determining whether a product is a consumer product,
|
| 289 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
| 290 |
+
product received by a particular user, "normally used" refers to a
|
| 291 |
+
typical or common use of that class of product, regardless of the status
|
| 292 |
+
of the particular user or of the way in which the particular user
|
| 293 |
+
actually uses, or expects or is expected to use, the product. A product
|
| 294 |
+
is a consumer product regardless of whether the product has substantial
|
| 295 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
| 296 |
+
the only significant mode of use of the product.
|
| 297 |
+
|
| 298 |
+
"Installation Information" for a User Product means any methods,
|
| 299 |
+
procedures, authorization keys, or other information required to install
|
| 300 |
+
and execute modified versions of a covered work in that User Product from
|
| 301 |
+
a modified version of its Corresponding Source. The information must
|
| 302 |
+
suffice to ensure that the continued functioning of the modified object
|
| 303 |
+
code is in no case prevented or interfered with solely because
|
| 304 |
+
modification has been made.
|
| 305 |
+
|
| 306 |
+
If you convey an object code work under this section in, or with, or
|
| 307 |
+
specifically for use in, a User Product, and the conveying occurs as
|
| 308 |
+
part of a transaction in which the right of possession and use of the
|
| 309 |
+
User Product is transferred to the recipient in perpetuity or for a
|
| 310 |
+
fixed term (regardless of how the transaction is characterized), the
|
| 311 |
+
Corresponding Source conveyed under this section must be accompanied
|
| 312 |
+
by the Installation Information. But this requirement does not apply
|
| 313 |
+
if neither you nor any third party retains the ability to install
|
| 314 |
+
modified object code on the User Product (for example, the work has
|
| 315 |
+
been installed in ROM).
|
| 316 |
+
|
| 317 |
+
The requirement to provide Installation Information does not include a
|
| 318 |
+
requirement to continue to provide support service, warranty, or updates
|
| 319 |
+
for a work that has been modified or installed by the recipient, or for
|
| 320 |
+
the User Product in which it has been modified or installed. Access to a
|
| 321 |
+
network may be denied when the modification itself materially and
|
| 322 |
+
adversely affects the operation of the network or violates the rules and
|
| 323 |
+
protocols for communication across the network.
|
| 324 |
+
|
| 325 |
+
Corresponding Source conveyed, and Installation Information provided,
|
| 326 |
+
in accord with this section must be in a format that is publicly
|
| 327 |
+
documented (and with an implementation available to the public in
|
| 328 |
+
source code form), and must require no special password or key for
|
| 329 |
+
unpacking, reading or copying.
|
| 330 |
+
|
| 331 |
+
7. Additional Terms.
|
| 332 |
+
|
| 333 |
+
"Additional permissions" are terms that supplement the terms of this
|
| 334 |
+
License by making exceptions from one or more of its conditions.
|
| 335 |
+
Additional permissions that are applicable to the entire Program shall
|
| 336 |
+
be treated as though they were included in this License, to the extent
|
| 337 |
+
that they are valid under applicable law. If additional permissions
|
| 338 |
+
apply only to part of the Program, that part may be used separately
|
| 339 |
+
under those permissions, but the entire Program remains governed by
|
| 340 |
+
this License without regard to the additional permissions.
|
| 341 |
+
|
| 342 |
+
When you convey a copy of a covered work, you may at your option
|
| 343 |
+
remove any additional permissions from that copy, or from any part of
|
| 344 |
+
it. (Additional permissions may be written to require their own
|
| 345 |
+
removal in certain cases when you modify the work.) You may place
|
| 346 |
+
additional permissions on material, added by you to a covered work,
|
| 347 |
+
for which you have or can give appropriate copyright permission.
|
| 348 |
+
|
| 349 |
+
Notwithstanding any other provision of this License, for material you
|
| 350 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
| 351 |
+
that material) supplement the terms of this License with terms:
|
| 352 |
+
|
| 353 |
+
a) Disclaiming warranty or limiting liability differently from the
|
| 354 |
+
terms of sections 15 and 16 of this License; or
|
| 355 |
+
|
| 356 |
+
b) Requiring preservation of specified reasonable legal notices or
|
| 357 |
+
author attributions in that material or in the Appropriate Legal
|
| 358 |
+
Notices displayed by works containing it; or
|
| 359 |
+
|
| 360 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
| 361 |
+
requiring that modified versions of such material be marked in
|
| 362 |
+
reasonable ways as different from the original version; or
|
| 363 |
+
|
| 364 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
| 365 |
+
authors of the material; or
|
| 366 |
+
|
| 367 |
+
e) Declining to grant rights under trademark law for use of some
|
| 368 |
+
trade names, trademarks, or service marks; or
|
| 369 |
+
|
| 370 |
+
f) Requiring indemnification of licensors and authors of that
|
| 371 |
+
material by anyone who conveys the material (or modified versions of
|
| 372 |
+
it) with contractual assumptions of liability to the recipient, for
|
| 373 |
+
any liability that these contractual assumptions directly impose on
|
| 374 |
+
those licensors and authors.
|
| 375 |
+
|
| 376 |
+
All other non-permissive additional terms are considered "further
|
| 377 |
+
restrictions" within the meaning of section 10. If the Program as you
|
| 378 |
+
received it, or any part of it, contains a notice stating that it is
|
| 379 |
+
governed by this License along with a term that is a further
|
| 380 |
+
restriction, you may remove that term. If a license document contains
|
| 381 |
+
a further restriction but permits relicensing or conveying under this
|
| 382 |
+
License, you may add to a covered work material governed by the terms
|
| 383 |
+
of that license document, provided that the further restriction does
|
| 384 |
+
not survive such relicensing or conveying.
|
| 385 |
+
|
| 386 |
+
If you add terms to a covered work in accord with this section, you
|
| 387 |
+
must place, in the relevant source files, a statement of the
|
| 388 |
+
additional terms that apply to those files, or a notice indicating
|
| 389 |
+
where to find the applicable terms.
|
| 390 |
+
|
| 391 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
| 392 |
+
form of a separately written license, or stated as exceptions;
|
| 393 |
+
the above requirements apply either way.
|
| 394 |
+
|
| 395 |
+
8. Termination.
|
| 396 |
+
|
| 397 |
+
You may not propagate or modify a covered work except as expressly
|
| 398 |
+
provided under this License. Any attempt otherwise to propagate or
|
| 399 |
+
modify it is void, and will automatically terminate your rights under
|
| 400 |
+
this License (including any patent licenses granted under the third
|
| 401 |
+
paragraph of section 11).
|
| 402 |
+
|
| 403 |
+
However, if you cease all violation of this License, then your
|
| 404 |
+
license from a particular copyright holder is reinstated (a)
|
| 405 |
+
provisionally, unless and until the copyright holder explicitly and
|
| 406 |
+
finally terminates your license, and (b) permanently, if the copyright
|
| 407 |
+
holder fails to notify you of the violation by some reasonable means
|
| 408 |
+
prior to 60 days after the cessation.
|
| 409 |
+
|
| 410 |
+
Moreover, your license from a particular copyright holder is
|
| 411 |
+
reinstated permanently if the copyright holder notifies you of the
|
| 412 |
+
violation by some reasonable means, this is the first time you have
|
| 413 |
+
received notice of violation of this License (for any work) from that
|
| 414 |
+
copyright holder, and you cure the violation prior to 30 days after
|
| 415 |
+
your receipt of the notice.
|
| 416 |
+
|
| 417 |
+
Termination of your rights under this section does not terminate the
|
| 418 |
+
licenses of parties who have received copies or rights from you under
|
| 419 |
+
this License. If your rights have been terminated and not permanently
|
| 420 |
+
reinstated, you do not qualify to receive new licenses for the same
|
| 421 |
+
material under section 10.
|
| 422 |
+
|
| 423 |
+
9. Acceptance Not Required for Having Copies.
|
| 424 |
+
|
| 425 |
+
You are not required to accept this License in order to receive or
|
| 426 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
| 427 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
| 428 |
+
to receive a copy likewise does not require acceptance. However,
|
| 429 |
+
nothing other than this License grants you permission to propagate or
|
| 430 |
+
modify any covered work. These actions infringe copyright if you do
|
| 431 |
+
not accept this License. Therefore, by modifying or propagating a
|
| 432 |
+
covered work, you indicate your acceptance of this License to do so.
|
| 433 |
+
|
| 434 |
+
10. Automatic Licensing of Downstream Recipients.
|
| 435 |
+
|
| 436 |
+
Each time you convey a covered work, the recipient automatically
|
| 437 |
+
receives a license from the original licensors, to run, modify and
|
| 438 |
+
propagate that work, subject to this License. You are not responsible
|
| 439 |
+
for enforcing compliance by third parties with this License.
|
| 440 |
+
|
| 441 |
+
An "entity transaction" is a transaction transferring control of an
|
| 442 |
+
organization, or substantially all assets of one, or subdividing an
|
| 443 |
+
organization, or merging organizations. If propagation of a covered
|
| 444 |
+
work results from an entity transaction, each party to that
|
| 445 |
+
transaction who receives a copy of the work also receives whatever
|
| 446 |
+
licenses to the work the party's predecessor in interest had or could
|
| 447 |
+
give under the previous paragraph, plus a right to possession of the
|
| 448 |
+
Corresponding Source of the work from the predecessor in interest, if
|
| 449 |
+
the predecessor has it or can get it with reasonable efforts.
|
| 450 |
+
|
| 451 |
+
You may not impose any further restrictions on the exercise of the
|
| 452 |
+
rights granted or affirmed under this License. For example, you may
|
| 453 |
+
not impose a license fee, royalty, or other charge for exercise of
|
| 454 |
+
rights granted under this License, and you may not initiate litigation
|
| 455 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
| 456 |
+
any patent claim is infringed by making, using, selling, offering for
|
| 457 |
+
sale, or importing the Program or any portion of it.
|
| 458 |
+
|
| 459 |
+
11. Patents.
|
| 460 |
+
|
| 461 |
+
A "contributor" is a copyright holder who authorizes use under this
|
| 462 |
+
License of the Program or a work on which the Program is based. The
|
| 463 |
+
work thus licensed is called the contributor's "contributor version".
|
| 464 |
+
|
| 465 |
+
A contributor's "essential patent claims" are all patent claims
|
| 466 |
+
owned or controlled by the contributor, whether already acquired or
|
| 467 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
| 468 |
+
by this License, of making, using, or selling its contributor version,
|
| 469 |
+
but do not include claims that would be infringed only as a
|
| 470 |
+
consequence of further modification of the contributor version. For
|
| 471 |
+
purposes of this definition, "control" includes the right to grant
|
| 472 |
+
patent sublicenses in a manner consistent with the requirements of
|
| 473 |
+
this License.
|
| 474 |
+
|
| 475 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
| 476 |
+
patent license under the contributor's essential patent claims, to
|
| 477 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
| 478 |
+
propagate the contents of its contributor version.
|
| 479 |
+
|
| 480 |
+
In the following three paragraphs, a "patent license" is any express
|
| 481 |
+
agreement or commitment, however denominated, not to enforce a patent
|
| 482 |
+
(such as an express permission to practice a patent or covenant not to
|
| 483 |
+
sue for patent infringement). To "grant" such a patent license to a
|
| 484 |
+
party means to make such an agreement or commitment not to enforce a
|
| 485 |
+
patent against the party.
|
| 486 |
+
|
| 487 |
+
If you convey a covered work, knowingly relying on a patent license,
|
| 488 |
+
and the Corresponding Source of the work is not available for anyone
|
| 489 |
+
to copy, free of charge and under the terms of this License, through a
|
| 490 |
+
publicly available network server or other readily accessible means,
|
| 491 |
+
then you must either (1) cause the Corresponding Source to be so
|
| 492 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
| 493 |
+
patent license for this particular work, or (3) arrange, in a manner
|
| 494 |
+
consistent with the requirements of this License, to extend the patent
|
| 495 |
+
license to downstream recipients. "Knowingly relying" means you have
|
| 496 |
+
actual knowledge that, but for the patent license, your conveying the
|
| 497 |
+
covered work in a country, or your recipient's use of the covered work
|
| 498 |
+
in a country, would infringe one or more identifiable patents in that
|
| 499 |
+
country that you have reason to believe are valid.
|
| 500 |
+
|
| 501 |
+
If, pursuant to or in connection with a single transaction or
|
| 502 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
| 503 |
+
covered work, and grant a patent license to some of the parties
|
| 504 |
+
receiving the covered work authorizing them to use, propagate, modify
|
| 505 |
+
or convey a specific copy of the covered work, then the patent license
|
| 506 |
+
you grant is automatically extended to all recipients of the covered
|
| 507 |
+
work and works based on it.
|
| 508 |
+
|
| 509 |
+
A patent license is "discriminatory" if it does not include within
|
| 510 |
+
the scope of its coverage, prohibits the exercise of, or is
|
| 511 |
+
conditioned on the non-exercise of one or more of the rights that are
|
| 512 |
+
specifically granted under this License. You may not convey a covered
|
| 513 |
+
work if you are a party to an arrangement with a third party that is
|
| 514 |
+
in the business of distributing software, under which you make payment
|
| 515 |
+
to the third party based on the extent of your activity of conveying
|
| 516 |
+
the work, and under which the third party grants, to any of the
|
| 517 |
+
parties who would receive the covered work from you, a discriminatory
|
| 518 |
+
patent license (a) in connection with copies of the covered work
|
| 519 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
| 520 |
+
for and in connection with specific products or compilations that
|
| 521 |
+
contain the covered work, unless you entered into that arrangement,
|
| 522 |
+
or that patent license was granted, prior to 28 March 2007.
|
| 523 |
+
|
| 524 |
+
Nothing in this License shall be construed as excluding or limiting
|
| 525 |
+
any implied license or other defenses to infringement that may
|
| 526 |
+
otherwise be available to you under applicable patent law.
|
| 527 |
+
|
| 528 |
+
12. No Surrender of Others' Freedom.
|
| 529 |
+
|
| 530 |
+
If conditions are imposed on you (whether by court order, agreement or
|
| 531 |
+
otherwise) that contradict the conditions of this License, they do not
|
| 532 |
+
excuse you from the conditions of this License. If you cannot convey a
|
| 533 |
+
covered work so as to satisfy simultaneously your obligations under this
|
| 534 |
+
License and any other pertinent obligations, then as a consequence you may
|
| 535 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
| 536 |
+
to collect a royalty for further conveying from those to whom you convey
|
| 537 |
+
the Program, the only way you could satisfy both those terms and this
|
| 538 |
+
License would be to refrain entirely from conveying the Program.
|
| 539 |
+
|
| 540 |
+
13. Remote Network Interaction; Use with the GNU General Public License.
|
| 541 |
+
|
| 542 |
+
Notwithstanding any other provision of this License, if you modify the
|
| 543 |
+
Program, your modified version must prominently offer all users
|
| 544 |
+
interacting with it remotely through a computer network (if your version
|
| 545 |
+
supports such interaction) an opportunity to receive the Corresponding
|
| 546 |
+
Source of your version by providing access to the Corresponding Source
|
| 547 |
+
from a network server at no charge, through some standard or customary
|
| 548 |
+
means of facilitating copying of software. This Corresponding Source
|
| 549 |
+
shall include the Corresponding Source for any work covered by version 3
|
| 550 |
+
of the GNU General Public License that is incorporated pursuant to the
|
| 551 |
+
following paragraph.
|
| 552 |
+
|
| 553 |
+
Notwithstanding any other provision of this License, you have
|
| 554 |
+
permission to link or combine any covered work with a work licensed
|
| 555 |
+
under version 3 of the GNU General Public License into a single
|
| 556 |
+
combined work, and to convey the resulting work. The terms of this
|
| 557 |
+
License will continue to apply to the part which is the covered work,
|
| 558 |
+
but the work with which it is combined will remain governed by version
|
| 559 |
+
3 of the GNU General Public License.
|
| 560 |
+
|
| 561 |
+
14. Revised Versions of this License.
|
| 562 |
+
|
| 563 |
+
The Free Software Foundation may publish revised and/or new versions of
|
| 564 |
+
the GNU Affero General Public License from time to time. Such new versions
|
| 565 |
+
will be similar in spirit to the present version, but may differ in detail to
|
| 566 |
+
address new problems or concerns.
|
| 567 |
+
|
| 568 |
+
Each version is given a distinguishing version number. If the
|
| 569 |
+
Program specifies that a certain numbered version of the GNU Affero General
|
| 570 |
+
Public License "or any later version" applies to it, you have the
|
| 571 |
+
option of following the terms and conditions either of that numbered
|
| 572 |
+
version or of any later version published by the Free Software
|
| 573 |
+
Foundation. If the Program does not specify a version number of the
|
| 574 |
+
GNU Affero General Public License, you may choose any version ever published
|
| 575 |
+
by the Free Software Foundation.
|
| 576 |
+
|
| 577 |
+
If the Program specifies that a proxy can decide which future
|
| 578 |
+
versions of the GNU Affero General Public License can be used, that proxy's
|
| 579 |
+
public statement of acceptance of a version permanently authorizes you
|
| 580 |
+
to choose that version for the Program.
|
| 581 |
+
|
| 582 |
+
Later license versions may give you additional or different
|
| 583 |
+
permissions. However, no additional obligations are imposed on any
|
| 584 |
+
author or copyright holder as a result of your choosing to follow a
|
| 585 |
+
later version.
|
| 586 |
+
|
| 587 |
+
15. Disclaimer of Warranty.
|
| 588 |
+
|
| 589 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
| 590 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
| 591 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
| 592 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
| 593 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
| 594 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
| 595 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
| 596 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
| 597 |
+
|
| 598 |
+
16. Limitation of Liability.
|
| 599 |
+
|
| 600 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
| 601 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
| 602 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
| 603 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
| 604 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
| 605 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
| 606 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
| 607 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
| 608 |
+
SUCH DAMAGES.
|
| 609 |
+
|
| 610 |
+
17. Interpretation of Sections 15 and 16.
|
| 611 |
+
|
| 612 |
+
If the disclaimer of warranty and limitation of liability provided
|
| 613 |
+
above cannot be given local legal effect according to their terms,
|
| 614 |
+
reviewing courts shall apply local law that most closely approximates
|
| 615 |
+
an absolute waiver of all civil liability in connection with the
|
| 616 |
+
Program, unless a warranty or assumption of liability accompanies a
|
| 617 |
+
copy of the Program in return for a fee.
|
| 618 |
+
|
| 619 |
+
END OF TERMS AND CONDITIONS
|
| 620 |
+
|
| 621 |
+
How to Apply These Terms to Your New Programs
|
| 622 |
+
|
| 623 |
+
If you develop a new program, and you want it to be of the greatest
|
| 624 |
+
possible use to the public, the best way to achieve this is to make it
|
| 625 |
+
free software which everyone can redistribute and change under these terms.
|
| 626 |
+
|
| 627 |
+
To do so, attach the following notices to the program. It is safest
|
| 628 |
+
to attach them to the start of each source file to most effectively
|
| 629 |
+
state the exclusion of warranty; and each file should have at least
|
| 630 |
+
the "copyright" line and a pointer to where the full notice is found.
|
| 631 |
+
|
| 632 |
+
<one line to give the program's name and a brief idea of what it does.>
|
| 633 |
+
Copyright (C) <year> <name of author>
|
| 634 |
+
|
| 635 |
+
This program is free software: you can redistribute it and/or modify
|
| 636 |
+
it under the terms of the GNU Affero General Public License as published
|
| 637 |
+
by the Free Software Foundation, either version 3 of the License, or
|
| 638 |
+
(at your option) any later version.
|
| 639 |
+
|
| 640 |
+
This program is distributed in the hope that it will be useful,
|
| 641 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 642 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 643 |
+
GNU Affero General Public License for more details.
|
| 644 |
+
|
| 645 |
+
You should have received a copy of the GNU Affero General Public License
|
| 646 |
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 647 |
+
|
| 648 |
+
Also add information on how to contact you by electronic and paper mail.
|
| 649 |
+
|
| 650 |
+
If your software can interact with users remotely through a computer
|
| 651 |
+
network, you should also make sure that it provides a way for users to
|
| 652 |
+
get its source. For example, if your program is a web application, its
|
| 653 |
+
interface could display a "Source" link that leads users to an archive
|
| 654 |
+
of the code. There are many ways you could offer source, and different
|
| 655 |
+
solutions will be better for different programs; see section 13 for the
|
| 656 |
+
specific requirements.
|
| 657 |
+
|
| 658 |
+
You should also get your employer (if you work as a programmer) or school,
|
| 659 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
| 660 |
+
For more information on this, and how to apply and follow the GNU AGPL, see
|
| 661 |
+
<https://www.gnu.org/licenses/>.
|