Repository navigation
A capture that cannot pass its own check is not a capture - #19
Merged
Merged
Conversation
reviewed_statement_pp is the string a review's survival depends on, and every
way of getting it wrong is silent: the field looks captured, mfc validate
passes, and the failure surfaces at the next dependency bump as not_checkable
-- which reads like a broken tool rather than a bad capture.
Capturing the first real one by hand took three attempts, with the schema, the
checker and the emitter all open:
1. pp.explicit ALONE left a `⋯` elision inside the K₀ quotient's proof
argument. Unparseable. pp.proofs, pp.deepTerms and a raised pp.maxSteps
close it.
2. Rendering via `#check @Decl` instantiates the constant with FRESH universe
metavariables printed as u_1, u_2, u_3. The declaration's levelParams were
[w, u, u'], so restateOne reported `unknown universe level u_2`.
3. Both were "verified" with a `universe u_1 u_2 u_3` command above an
example -- supplying by hand the level context restateOne does not have,
which answers the hard part before asking the question.
`--capture <decl>` renders ci.type under Emit.ppOpts with pp.explicit true,
then puts the result through restateOne: the same parse, the same elabTerm
under withoutErrToSorry, the same isDefEq, the same withLevelNames. It returns
the string ONLY on restated. All three failures above produce a rendering that
fails that check, so none of them can reach review.yaml through this path.
ci.type and never `#check @Decl`. The type carries the declaration's own level
parameters; the term carries metavariables under invented names no level
context can bind.
Emit.ppOpts stops being private rather than being copied. A capture rendered
under different options than the emitter uses is a different string about the
same declaration, and two lists drift.
Verified: capturing the polymorphic subject emits a rendering using the
declaration's own level name and round-trips as restated; feeding that string
straight back through the producer returns restated; an absent declaration
exits 1 with a reason and emits nothing.
613 passed, 1 skipped; lake build clean at 26 jobs.
Closes chris-dare-dev/derived-alg-geo-lean#654
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.
Closes chris-dare-dev/derived-alg-geo-lean#654.
reviewed_statement_ppis the string a review's survival depends on. Every way of getting it wrong is silent: the field looks captured,mfc validatepasses, and the failure appears at the next dependency bump asnot_checkable— which reads like a broken tool rather than a bad capture.Capturing the first real one by hand took three attempts, with the schema, the checker and the emitter all open:
pp.explicitalone left a⋯elision in the K₀ quotient's proof argument#check @Declinstantiates with fresh universe metavariables printedu_1, u_2, u_3; reallevelParamsare[w, u, u']unknown universe level u_2— reads as tooling failureuniverse u_1 u_2 u_3above anexamplerestateOnedoes not haveThe fix
--capture <decl>rendersci.typeunderEmit.ppOptswithpp.explicit := true, then puts the result throughrestateOneitself — the same parse, the sameelabTermunderwithoutErrToSorry, the sameisDefEq, the samewithLevelNames. It returns the string only onrestated.All three failures above produce a rendering that fails that check, so none can reach
review.yamlthrough this path.Two details that are the whole point:
ci.type, never#check @Decl. The type carries the declaration's own level parameters; the term carries metavariables under invented names no level context can bind.Emit.ppOptsstops being private rather than being copied. A capture rendered under different options than the emitter uses is a different string about the same declaration, and two lists drift.Verified
The test library asserts all three: the rendering uses the declaration's level name, it round-trips as
restatedthroughrestateOne, and an absent declaration errors rather than yielding an empty capture.613 passed, 1 skipped;
lake buildclean at 26 jobs.