Physlib.Meta.Sorry
8 declarations
Monad for collecting axiom-dependent results
#MThe monad is defined as . It provides a computational context that combines read-only access to the Lean with a mutable for the purpose of traversing and collecting the names of constants that depend on the axioms (representing "sorry" proofs) and (representing pseudo-definitions).
Update Monad with Axiom Dependencies of Name
#collectGiven a Lean name and a set of names representing its ancestors in the dependency graph, , the function updates the state within the monad by determining if the constant or its dependencies rely on the axioms (indicating "sorry" proofs) or (indicating pseudo-definitions).
Update Monad with Axiom Dependencies for Array
#allSorryPseudoGiven an array of Lean names , the function iterates through each name and applies the function with an empty set of ancestor names. This operation updates the internal state of the monad by identifying whether the constants corresponding to the names in and their recursive dependencies rely on the axioms (representing "sorry" proofs) or (representing pseudo-definitions).
Collect `sorryAx` and `ofReduceBool` dependencies for
#collectSorryPseudoGiven an array of names , this function identifies all constants in the dependency closure of that rely on the or axioms. It returns a pair of arrays in the `CoreM` monad, where contains the names of results depending on (representing "sorry" proofs) and contains the names of results depending on (representing pseudo-definitions).
All user-defined constants with or dependencies
#allWithSorryPseudoThis function, operating within the Lean core environment monad (), identifies all user-defined constants in the current environment that depend on either the or axioms. It returns a pair of arrays , where is the collection of names of constants whose definitions or proofs rely on the axiom (indicating the presence of ), and is the collection of names of constants relying on the axiom (indicating pseudo-definitions).
Names attributed `sorryful`
#allSorryfulAttributedThe computation retrieves and returns an array containing all names in the current environment that have been explicitly marked with the `sorryful` attribute.
Array of all names attributed as `pseudo`
#allPseudoAttributedWithin the context of the Lean core environment monad (), this function retrieves an array of all constant identifiers (names) that have been assigned the `pseudo` attribute.
Consistency test for `sorryful` and `pseudo` attributes
#sorryfulPseudoTestWithin the meta-programming monad (), this procedure verifies the consistency of the `sorryful` and `pseudo` attributes for all user-defined constants in the environment. Specifically, it checks that a constant is attributed `sorryful` if and only if its definition or proof depends on the `sorryAx` axiom. Simultaneously, it verifies that a constant is attributed `pseudo` if and only if it depends on the `Lean.ofReduceBool` axiom (typically associated with `native_decide`). If any discrepancies are found—either a constant possessing an attribute without the corresponding dependency or a constant having the dependency without the attribute—the function terminates with a detailed error message listing the inconsistent identifiers. Otherwise, it prints a success message indicating that the metadata is correctly applied.
