Executable declaration checks at the semantic boundaries #
These examples run DeclSolver.check, DeclSolver.solve, and
DeclSolver.conversionExact on small unit systems chosen to separate
consistency from global completeness and to exercise exact irrational output.
Each namespace sets up its own UnitSys:
Length: feet and meters with no declaration are consistent but rejected as incomplete, andfoot = 0.3048 meter(link) makes the system pass, as in Section 3 of our paper; a redundant reciprocal is accepted and a conflicting factor is rejected.Root: the dimensionless equationu = 2/uforces the factor√2, returned as radicand2and degree2.Unsound: a solvable declaration that equates independent dimensions is rejected.EmptyandDependentDimensions: an empty unit system, and dimension rows that coincide.RadicalChain: a radical factor derived through a compound right-hand side; in an incomplete system, a determined factor is still extracted and an undetermined one is refused.Nanometer: the paper's wavefunction-amplitude example (exactAmplitude).
Each check is a #guard, and allChecks and report run the same
computations in the native executable, which exits nonzero on failure.
Length.linkedFactor_returned and Root.rootFactor_returned prove what the
solver returns; Length.linkedFactor_correct and Root.rootFactor_correct
prove the returned factor equal to the conversion factor in every satisfying
real valuation, independently of the solver's chosen free magnitudes.
Equations
- LambdaS.DeclarationSolverExamples.Length.instUnitSysFinOfNatNat = { dim := fun (x : Fin 2) => LambdaS.Term.ofBase 0 }
Instances For
Instances For
Instances For
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
conversionExact from foot to meter returns linkedFactor, the exact factor
built from the coefficient witness ![1].
The returned factor equals the foot-to-meter conversion factor in every
valuation satisfying link.
Equations
- LambdaS.DeclarationSolverExamples.Root.instUnitSysFinOfNatNat = { dim := fun (x : Fin 1) => LambdaS.Term.one }
Instances For
Instances For
A dimensionless generator satisfying u = 2/u has magnitude sqrt(2).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
conversionExact from unit to the dimensionless unit returns rootFactor,
the exact factor built from the coefficient witness ![1/2].
The returned factor equals the conversion factor from unit to 1 in every
valuation satisfying selfDecl.
Equations
- LambdaS.DeclarationSolverExamples.Unsound.instUnitSysFinOfNatNat = { dim := fun (b : Fin 2) => LambdaS.Term.ofBase b }
Instances For
The equations have a solution, but equating independent dimensions is illegal.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Equations
- LambdaS.DeclarationSolverExamples.Empty.accepted = (LambdaS.DeclSolver.check (Equiv.refl (Fin 0)) (Equiv.refl (Fin 0)) fun (i : Fin 0) => i.elim0).isSome
Instances For
Equations
- LambdaS.DeclarationSolverExamples.DependentDimensions.instUnitSysFinOfNatNat = { dim := fun (x : Fin 2) => (LambdaS.Term.ofBase 0).mul (LambdaS.Term.ofBase 1) }
Instances For
Both dimension rows coincide; a declaration still fixes the only unit ratio.
Equations
Instances For
Three length units linked through a compound rational-power right-hand side, so that the radical a conversion needs is derived rather than declared.
Equations
- LambdaS.DeclarationSolverExamples.RadicalChain.instUnitSysFinOfNatNat = { dim := fun (x : Fin 3) => LambdaS.Term.ofBase 0 }
Instances For
Instances For
Instances For
Instances For
The geometric mean of b and c.
Equations
Instances For
a = 2 · (b·c)^(1/2).
Equations
- One or more equations did not get rendered due to their size.
Instances For
b = 2 · c.
Equations
- One or more equations did not get rendered due to their size.
Instances For
a = 3 · c, which contradicts the other two: they force a/c = 2^(3/2).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Both declared ratios together span the kernel of dim.
Equations
- One or more equations did not get rendered due to their size.
Instances For
log(a/c) = (3/2) log 2, cleared to log 8 / 2.
Equations
- One or more equations did not get rendered due to their size.
Instances For
log(a/b) = (1/2) log 2.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The contradiction is decided exactly: 2 log 3 − log 8 = log (9/8) ≠ 0.
Equations
- One or more equations did not get rendered due to their size.
Instances For
With viaMean alone, b/c is undetermined, so the global check rejects the system.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
A one-dimensional wavefunction amplitude carries a half-power of inverse
length. A rational declared factor between nanometer and meter then yields a
radical factor between the amplitude units. Section 3 of our paper cites
exactAmplitude.
Equations
- LambdaS.DeclarationSolverExamples.Nanometer.instUnitSysFinOfNatNat = { dim := fun (x : Fin 2) => LambdaS.Term.ofBase 0 }
Instances For
Instances For
Instances For
nm = 10^(-9) m.
Equations
- One or more equations did not get rendered due to their size.
Instances For
nm^(-1/2) to m^(-1/2) multiplies by 10^(9/2): radicand 10^9, degree 2.
Equations
- One or more equations did not get rendered due to their size.
Instances For
All declaration regressions, also evaluated by the native artifact executable.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A compact runtime reading identifying the declaration checks.