Add Aiur formal verification framework with #aiur_gen command#349
Open
arthurpaulino wants to merge 1 commit intomainfrom
Open
Add Aiur formal verification framework with #aiur_gen command#349arthurpaulino wants to merge 1 commit intomainfrom
arthurpaulino wants to merge 1 commit intomainfrom
Conversation
f87bdb5 to
90db3ff
Compare
| @[default_target] | ||
| lean_lib Ix where | ||
| moreLinkObjs := #[ix_rs] | ||
| precompileModules := true |
Member
There was a problem hiding this comment.
This has the side effect that downstream modules and users can use #eval for @[extern] FFI functions, which is nice for debugging!
Member
Author
There was a problem hiding this comment.
Yeah it was necessary to run G.ofNat at elaboration time (it does FFI).
66e8c1d to
61011b9
Compare
61011b9 to
d8894c9
Compare
d8894c9 to
39ee1b1
Compare
Add G field arithmetic (Add, Sub, Mul, eqZero), u8/u32 semantic
functions with range predicates, and commutativity theorems to
Goldilocks.lean. Enable precompileModules on Ix library for native
evaluation under Lean's `module` system.
Add `#aiur_gen` command that evaluates an Aiur Toplevel at elaboration
time and writes a .lean file with:
- Semantic types: Lean inductives from Aiur enums with pointers erased,
type aliases as abbrevs, topologically sorted by type references
with mutual blocks for cyclic dependencies. Generic type parameters
(`enum Foo‹T›`) become explicit Lean params `(T : Type)`.
- Semantic propositions: one inductive per function, one constructor per
control-flow path, with assertEq as Prop conjuncts, store/load
erased, u8/u32 ops with range constraints, or-patterns expanded,
IO operations as unconstrained fresh variables, data constructors
inlined, nested match patterns resolved transitively. Generic
function parameters become implicit Lean params `{T : Type}`.
Unconstrained calls (`#fn(…)`) produce universally quantified
variables with no premises.
- Topological sorting of both types and functions by dependency graph,
with mutual blocks only for actual cycles. Unconstrained calls are
excluded from the dependency graph.
Add multi-file example:
- ExampleBase.lean: Expr type, eval, swap, double_eval (forward ref),
simplify_neg (nested match) → ExampleBaseSem.lean
- ExampleMain.lean: ExprList, Tree/Forest (mutual types), list_sum,
assert_eval, tree_sum/forest_sum (mutual functions),
is_even/is_odd (mutual recursion), GList‹T› with length‹T›
(generic types), add_noise/use_unconstrained (unconstrained calls)
→ ExampleMainSem.lean (imports base)
- Example.lean: theorems over generated semantic propositions
(determinism, totality, involution, assertEq semantics, spec
soundness, mutual type/function soundness, mutual recursion path
exclusivity, generic length soundness, unconstrained call form
vs constrained determinism)
39ee1b1 to
9ac136e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add G field arithmetic (Add, Sub, Mul, eqZero), u8/u32 semantic functions with range predicates, and commutativity theorems to Goldilocks.lean. Enable precompileModules on Ix library for native evaluation under Lean's
modulesystem.Add
#aiur_gencommand that evaluates an Aiur Toplevel at elaboration time and writes a .lean file with:enum Foo‹T›) become explicit Lean params(T : Type).{T : Type}. Unconstrained calls (#fn(…)) produce universally quantified variables with no premises.Add multi-file example: