chore: fix spelling (#11531)
Hi, these are just some spelling corrections. There is one I wasn't completely sure about in src/Init/Data/List/Lemmas.lean: > See also > ... > Also > \* \`Init.Data.List.Monadic\` for **addiation** _(additional?)_ lemmas about \`List.mapM\` and \`List.forM\`
This commit is contained in:
parent
03a6e58cec
commit
2ca3bc2859
57 changed files with 70 additions and 70 deletions
|
|
@ -835,7 +835,7 @@ execution. -/
|
|||
structure DivModArgs (w : Nat) where
|
||||
/-- the numerator (aka, dividend) -/
|
||||
n : BitVec w
|
||||
/-- the denumerator (aka, divisor)-/
|
||||
/-- the denominator (aka, divisor)-/
|
||||
d : BitVec w
|
||||
|
||||
/-- A `DivModState` is lawful if the remainder width `wr` plus the numerator width `wn` equals `w`,
|
||||
|
|
|
|||
|
|
@ -5601,7 +5601,7 @@ theorem msb_eq_toNat {x : BitVec w}:
|
|||
simp only [msb_eq_decide, ge_iff_le]
|
||||
|
||||
/-- Negating a bitvector created from a natural number equals
|
||||
creating a bitvector from the the negative of that number.
|
||||
creating a bitvector from the negative of that number.
|
||||
-/
|
||||
theorem neg_ofNat_eq_ofInt_neg {w : Nat} {x : Nat} :
|
||||
- BitVec.ofNat w x = BitVec.ofInt w (- x) := by
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ instance : Std.Associative (· != ·) := ⟨bne_assoc⟩
|
|||
|
||||
theorem eq_not_of_ne : ∀ {x y : Bool}, x ≠ y → x = !y := by decide
|
||||
|
||||
/-! ### coercision related normal forms -/
|
||||
/-! ### coercion related normal forms -/
|
||||
|
||||
theorem beq_eq_decide_eq [BEq α] [LawfulBEq α] [DecidableEq α] (a b : α) :
|
||||
(a == b) = decide (a = b) := by
|
||||
|
|
|
|||
|
|
@ -2252,7 +2252,7 @@ def eraseReps {α} [BEq α] (as : List α) : List α := eraseRepsBy (· == ·) a
|
|||
/-! ### span -/
|
||||
|
||||
/--
|
||||
Splits a list into the the longest initial segment for which `p` returns `true`, paired with the
|
||||
Splits a list into the longest initial segment for which `p` returns `true`, paired with the
|
||||
remainder of the list.
|
||||
|
||||
`O(|l|)`.
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ Further results, which first require developing further automation around `Nat`,
|
|||
* `Init.Data.List.Nat.TakeDrop`: `List.take` and `List.drop`
|
||||
|
||||
Also
|
||||
* `Init.Data.List.Monadic` for addiation lemmas about `List.mapM` and `List.forM`.
|
||||
* `Init.Data.List.Monadic` for additional lemmas about `List.mapM` and `List.forM`.
|
||||
|
||||
-/
|
||||
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ theorem Sublist.eq_of_length : l₁ <+ l₂ → length l₁ = length l₂ → l
|
|||
| .cons a s, h => nomatch Nat.not_lt.2 s.length_le (h ▸ lt_succ_self _)
|
||||
| .cons₂ a s, h => by rw [s.eq_of_length (succ.inj h)]
|
||||
|
||||
-- Only activative `eq_of_length` if we're already thinking about lengths.
|
||||
-- Only activate `eq_of_length` if we're already thinking about lengths.
|
||||
grind_pattern Sublist.eq_of_length => l₁ <+ l₂, length l₁, length l₂
|
||||
|
||||
theorem Sublist.eq_of_length_le (s : l₁ <+ l₂) (h : length l₂ ≤ length l₁) : l₁ = l₂ :=
|
||||
|
|
|
|||
|
|
@ -1177,7 +1177,7 @@ position. -/
|
|||
def Slice.Pos.get? {s : Slice} (pos : s.Pos) : Option Char :=
|
||||
if h : pos = s.endPos then none else some (pos.get h)
|
||||
|
||||
/-- Returns the byte at the given position in the string, or panicks if the position is the end
|
||||
/-- Returns the byte at the given position in the string, or panics if the position is the end
|
||||
position. -/
|
||||
@[expose]
|
||||
def Slice.Pos.get! {s : Slice} (pos : s.Pos) : Char :=
|
||||
|
|
|
|||
|
|
@ -529,7 +529,7 @@ public def assemble₂ (w x : UInt8) : Option Char :=
|
|||
else
|
||||
let r := assemble₂Unchecked w x
|
||||
if r < 0x80 then
|
||||
none -- overlong encodinlg
|
||||
none -- overlong encoding
|
||||
else
|
||||
some ⟨r, ?onemore⟩
|
||||
where finally
|
||||
|
|
|
|||
|
|
@ -517,7 +517,7 @@ protected def UInt32.shiftRight (a b : UInt32) : UInt32 := ⟨a.toBitVec >>> (UI
|
|||
Strict inequality of 32-bit unsigned integers, defined as inequality of the corresponding
|
||||
natural numbers. Usually accessed via the `<` operator.
|
||||
-/
|
||||
-- These need to be exposed as `Init.Prelude` already has an instance for bootstrapping puproses and
|
||||
-- These need to be exposed as `Init.Prelude` already has an instance for bootstrapping purposes and
|
||||
-- they should be defeq
|
||||
@[expose] protected def UInt32.lt (a b : UInt32) : Prop := a.toBitVec < b.toBitVec
|
||||
/--
|
||||
|
|
|
|||
|
|
@ -837,7 +837,7 @@ Encountering an EOF does not close a handle. Subsequent reads may block and retu
|
|||
-/
|
||||
@[extern "lean_io_prim_handle_read"] opaque read (h : @& Handle) (bytes : USize) : IO ByteArray
|
||||
/--
|
||||
Writes the provided bytes to the the handle.
|
||||
Writes the provided bytes to the handle.
|
||||
|
||||
Writing to a handle is typically buffered, and may not immediately modify the file on disk. Use
|
||||
`IO.FS.Handle.flush` to write changes to buffers to the associated device.
|
||||
|
|
|
|||
|
|
@ -1004,7 +1004,7 @@ You can use `with` to provide the variables names for each constructor.
|
|||
syntax (name := cases) "cases " elimTarget,+ (" using " term)? (inductionAlts)? : tactic
|
||||
|
||||
/--
|
||||
The `fun_induction` tactic is a convenience wrapper around the `induction` tactic to use the the
|
||||
The `fun_induction` tactic is a convenience wrapper around the `induction` tactic to use the
|
||||
functional induction principle.
|
||||
|
||||
The tactic invocation
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ structure ParametricAttributeImpl (α : Type) extends AttributeImplCore where
|
|||
afterSet : Name → α → AttrM Unit := fun _ _ _ => pure ()
|
||||
/--
|
||||
If set, entries are not resorted on export and `getParam?` will fall back to a linear instead of
|
||||
binary search insde an imported module's entries.
|
||||
binary search inside an imported module's entries.
|
||||
-/
|
||||
preserveOrder : Bool := false
|
||||
/--
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ partial def visitFnBody (w : Index) : FnBody → M Bool
|
|||
-- Instead of marking the join points that we have already been visited, we permanently remove `j` from the context.
|
||||
set (ctx.eraseJoinPointDecl j) *> visitFnBody w b
|
||||
| none =>
|
||||
-- `j` must be a local join point. So do nothing since we have already visite its body.
|
||||
-- `j` must be a local join point. So do nothing since we have already visited its body.
|
||||
pure false
|
||||
| .ret x =>
|
||||
visitArg w x
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ builtin_initialize
|
|||
Note that at this point `PartialFixpoint` machinery applies the attributes and modifiers. We
|
||||
use the syntax references from the original `InductiveView`s and set them to those declarations.
|
||||
|
||||
Moreover, we have following theorem (generated by `generateEqLemmas`) that connets the coinductive
|
||||
Moreover, we have following theorem (generated by `generateEqLemmas`) that connects the coinductive
|
||||
predicate to its flat inductive:
|
||||
```
|
||||
info: infSeq.functor_unfold (α : Type) (r : α → α → Prop) (a✝ : α) : infSeq α r a✝ = infSeq._functor α r (infSeq α r) a✝
|
||||
|
|
@ -250,7 +250,7 @@ private def generateCoinductiveConstructor (infos : Array InductiveVal) (ctorSyn
|
|||
let newHole ← hole.replaceTargetEq rewriteResult.eNew rewriteResult.eqProof
|
||||
|
||||
/-
|
||||
Now, all it suffices is to call an approprate constructor of the flat inductive.
|
||||
Now, all it suffices is to call an appropriate constructor of the flat inductive.
|
||||
-/
|
||||
let constructor := mkConst ctor.name levelParams
|
||||
let constructor := mkAppN constructor params
|
||||
|
|
@ -365,7 +365,7 @@ private def mkCasesOnCoinductive (infos : Array InductiveVal) : MetaM Unit := do
|
|||
-- Then we apply the metavariable to the `casesOn` of the flat inductive
|
||||
let originalCasesOn := mkApp originalCasesOn motiveMVar
|
||||
|
||||
-- The next arguemnts of the `casesOn` are type indices
|
||||
-- The next arguments of the `casesOn` are type indices
|
||||
forallBoundedTelescope goalType info.numIndices fun indices goalType => do
|
||||
/-
|
||||
The types do not change, so we just make free variables for them
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ where
|
|||
ids.getArgs.mapM fun x =>
|
||||
if x.getKind == identKind || x.getKind == ``hole then
|
||||
pure (some x)
|
||||
else throwErrorAt x "identifer or `_` expected"
|
||||
else throwErrorAt x "identifier or `_` expected"
|
||||
|
||||
|
||||
set_option linter.unusedVariables false in
|
||||
|
|
|
|||
|
|
@ -884,7 +884,7 @@ deriving TypeName
|
|||
/--
|
||||
Elaborates a sequence of Lean commands as examples.
|
||||
|
||||
To make examples self-contained, elaboration ignores the surrouncing section scopes. Modifications
|
||||
To make examples self-contained, elaboration ignores the surrounding section scopes. Modifications
|
||||
to the environment are preserved during a single documentation comment, and discarded afterwards.
|
||||
|
||||
The named argument `name` allows a name to be assigned to the code block; any messages created by
|
||||
|
|
@ -1271,7 +1271,7 @@ def «set_option» (option : Ident) (value : DataValue) : DocM (Block ElabInline
|
|||
return .empty
|
||||
|
||||
/--
|
||||
Constructs a link to the Lean langauge reference. Two positional arguments are expected:
|
||||
Constructs a link to the Lean language reference. Two positional arguments are expected:
|
||||
* `domain` should be one of the valid domains, such as `section`.
|
||||
* `name` should be the content's canonical name in the domain.
|
||||
-/
|
||||
|
|
@ -1468,7 +1468,7 @@ def suggestSyntax (code : StrLit) : DocM (Array CodeSuggestion) := do
|
|||
for (catName, _) in cats do
|
||||
try
|
||||
let stx ← parseStrLit (whitespace >> (categoryParser catName 0).fn) code
|
||||
-- Many syntax categories admit identifers, so the false postitive rate is high
|
||||
-- Many syntax categories admit identifiers, so the false positive rate is high
|
||||
unless onlyIdent stx do
|
||||
candidates := candidates.push catName
|
||||
catch | _ => pure ()
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ def Vec.map' (f : α → β) (xs : Vec α n) : Vec β n :=
|
|||
We had to include `n` and the `_`s because the type of `xs` depends on `n`.
|
||||
Moreover, `nil` and `cons a as` have different types.
|
||||
This was quite tedious. So, we have implemented an automatic "discriminant refinement procedure".
|
||||
The procedure is based on the observation that we get a type error whenenver we forget to include `_`s
|
||||
The procedure is based on the observation that we get a type error whenever we forget to include `_`s
|
||||
and the indices a discriminant depends on. So, we catch the exception, check whether the type of the discriminant
|
||||
is an indexed family, and add their indices as new discriminants.
|
||||
|
||||
|
|
|
|||
|
|
@ -959,7 +959,7 @@ private def mkFlatInductive (views : Array InductiveView)
|
|||
forallBoundedTelescope indType numParams fun indTypeParams indTypeBody => do
|
||||
|
||||
-- We first go through all types in the mutual block and get rid of their parameters
|
||||
-- by substiuting free variables
|
||||
-- by substituting free variables
|
||||
let typesWithAppliedParams ← namesAndTypes.mapM fun (newName, curIndType) => do
|
||||
forallBoundedTelescope curIndType numParams fun curIntTypeParams curIndTypeBody => do
|
||||
return (newName, curIndTypeBody.replaceFVars curIntTypeParams indTypeParams)
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ def FixedParamPerm.isFixed (perm : FixedParamPerm) (i : Nat) : Bool :=
|
|||
perm[i]?.join.isSome
|
||||
|
||||
/--
|
||||
Brings the fixed parameters from `type`, which should the the type of the `funIdx`'s function, into
|
||||
Brings the fixed parameters from `type`, which should be the type of the `funIdx`'s function, into
|
||||
scope.
|
||||
-/
|
||||
private partial def FixedParamPerm.forallTelescopeImpl (perm : FixedParamPerm)
|
||||
|
|
|
|||
|
|
@ -807,7 +807,7 @@ def guessLex (preDefs : Array PreDefinition) (unaryPreDef : PreDefinition)
|
|||
let recCalls := filterSubsumed recCalls
|
||||
|
||||
-- For every function, the measures we want to use
|
||||
-- (One for each non-forbiddend arg)
|
||||
-- (One for each non-forbidden arg)
|
||||
let basicMeasures₁ ← simpleMeasures preDefs fixedParamPerms userVarNamess
|
||||
let basicMeasures₂ ← complexMeasures preDefs fixedParamPerms userVarNamess recCalls
|
||||
let basicMeasures := Array.zipWith (· ++ ·) basicMeasures₁ basicMeasures₂
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ The process proceeds in these steps, to guide the transformation:
|
|||
|
||||
The `binderNameHint` preserves the user-chosen name in `f` if that is a lambda.
|
||||
|
||||
The `wfParam` on the right hand side ensurses that doubly-nested recursion works.
|
||||
The `wfParam` on the right hand side ensures that doubly-nested recursion works.
|
||||
|
||||
4. All left-over `wfParam` gadgets are removed.
|
||||
|
||||
|
|
|
|||
|
|
@ -804,7 +804,7 @@ private def synthOptParamFields : StructInstM Unit := do
|
|||
/-
|
||||
We must use `checkedAssign` here to ensure we do not create a cyclic
|
||||
assignment. See #3150.
|
||||
This can happen when there are holes in the the fields the default value
|
||||
This can happen when there are holes in the fields the default value
|
||||
depends on.
|
||||
Possible improvement: create a new `_` instead of returning `false` when
|
||||
`checkedAssign` fails. Reason: the field will not be needed after the
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ def getAltName? (alt : Syntax) : Option Name :=
|
|||
else
|
||||
let ident := head[1]
|
||||
if ident.isOfKind identKind then some ident.getId.eraseMacroScopes else none
|
||||
/-- Returns true if the the alternative is for a wildcard, and that the wildcard is not due to a syntax error. -/
|
||||
/-- Returns true if the alternative is for a wildcard, and that the wildcard is not due to a syntax error. -/
|
||||
def isAltWildcard (altStx : Syntax) : Bool :=
|
||||
getAltName? altStx == some `_
|
||||
/-- Returns the `inductionAlt` `ident <|> hole` -/
|
||||
|
|
@ -233,7 +233,7 @@ public partial def mkElimApp (elimInfo : ElimInfo) (targets : Array Expr) (tag :
|
|||
|
||||
/--
|
||||
Given a goal `... targets ... |- C[targets, complexArgs]` associated with `mvarId`,
|
||||
where `complexArgs` are the the complex (i.e. non-target) arguments to the motive in the conclusion
|
||||
where `complexArgs` are the complex (i.e. non-target) arguments to the motive in the conclusion
|
||||
of the eliminator, construct `motiveArg := fun targets rs => C[targets, rs]`
|
||||
|
||||
This checks if the type of the complex arguments match what's expected by the motive, and
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ namespace Try
|
|||
|
||||
/-!
|
||||
`evalSuggest` is a `evalTactic` variant that returns suggestions after executing a tactic built using
|
||||
combinatiors such as `first`, `attempt_all`, `<;>`, `;`, and `try`.
|
||||
combinators such as `first`, `attempt_all`, `<;>`, `;`, and `try`.
|
||||
-/
|
||||
|
||||
/-- Returns `true` if `fvarId` has an accessible name. -/
|
||||
|
|
|
|||
|
|
@ -2404,7 +2404,7 @@ Evaluates the given declaration under the given environment to a value of the gi
|
|||
This function is only safe to use if the type matches the declaration's type in the environment
|
||||
and if `enableInitializersExecution` has been used before importing any modules.
|
||||
|
||||
If `checkMeta` is true (the default), the function checks that all referenced imported contants are
|
||||
If `checkMeta` is true (the default), the function checks that all referenced imported constants are
|
||||
marked or imported as `meta` or otherwise fails with an error. It should only be set to `false` in
|
||||
cases where it is acceptable for code to work only in the language server, where more IR is loaded,
|
||||
such as in `#eval`.
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ and that it wasn't possible to understand the identifier as a field.
|
|||
|
||||
Lean's field notation is very powerful, but this can also make it confusing: the expression
|
||||
`color.value` can either be a single [identifier](lean-manual://section/identifiers-and-resolution),
|
||||
it can be a reference to the [field of a structure](lean-manual://section/structure-fiels), and it
|
||||
it can be a reference to the [field of a structure](lean-manual://section/structure-fields), and it
|
||||
and be a calling a function on the value `color` with
|
||||
[generalized field notation](lean-manual://section/generalized-field-notation).
|
||||
|
||||
|
|
|
|||
|
|
@ -1867,7 +1867,7 @@ def withLetDecl (name : Name) (type : Expr) (val : Expr) (k : Expr → n α) (no
|
|||
/--
|
||||
Runs `k x` with the local declaration `<name> : <type> := <val>` added to the local context, where `x` is the new free variable.
|
||||
Afterwards, the result is wrapped in the given `let`/`have` expression (according to the value of `nondep`).
|
||||
- If `usedLetOnly := true` (the default) then the the `let`/`have` is not created if the variable is unused.
|
||||
- If `usedLetOnly := true` (the default) then the `let`/`have` is not created if the variable is unused.
|
||||
-/
|
||||
def mapLetDecl [MonadLiftT MetaM n] (name : Name) (type : Expr) (val : Expr) (k : Expr → n Expr) (nondep : Bool := false) (kind : LocalDeclKind := .default) (usedLetOnly : Bool := true) : n Expr :=
|
||||
withLetDecl name type val (nondep := nondep) (kind := kind) fun x => do
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ This modules defines the `CasesInfo` data structure and functions to obtain it.
|
|||
It contains information about the structure of casesOn-like functions, namely of
|
||||
|
||||
* Plain `.casesOn` (one alternative per constructor)
|
||||
* Per-constructor eliminiations (with side condition, one alternative only)
|
||||
* Per-constructor eliminations (with side condition, one alternative only)
|
||||
* Sparse cases-on (only some constructors, with a catch-all)
|
||||
|
||||
It recognizes `.casesOn` by using `isCasesOnRecursor` (name + `isAuxDecl` env ext), and the others
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace Lean
|
|||
open Meta
|
||||
|
||||
/--
|
||||
Helper for `mkCasesOnSameCtor` that constructs a heterogenous matcher (indices may differ)
|
||||
Helper for `mkCasesOnSameCtor` that constructs a heterogeneous matcher (indices may differ)
|
||||
and does not include the equality proof in the motive (so it's not a the shape of a matcher) yet.
|
||||
-/
|
||||
public def mkCasesOnSameCtorHet (declName : Name) (indName : Name) : MetaM Unit := do
|
||||
|
|
@ -128,7 +128,7 @@ this module can be dropped.
|
|||
|
||||
Note that for some data types where the indices determine the constructor (e.g. `Vec`), this leads
|
||||
to less efficient code than the normal matcher, as this needs to read the constructor tag on both
|
||||
arguments, wheras the normal matcher produces code that reads just the first argument’s tag, and
|
||||
arguments, whereas the normal matcher produces code that reads just the first argument’s tag, and
|
||||
then boldly reads the second argument’s fields.
|
||||
-/
|
||||
public def mkCasesOnSameCtor (declName : Name) (indName : Name) : MetaM Unit := do
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ public def mkCtorElim (indName : Name) : MetaM Unit := do
|
|||
Generate the `.toCtorIdx` and `.ctor.elim` definitions for the given inductive.
|
||||
|
||||
This attribute is only meant to be used in `Init.Prelude` to build these constructions for
|
||||
types where we did not generate them imediatelly (due to `set_option genCtorIdx false`).
|
||||
types where we did not generate them immediately (due to `set_option genCtorIdx false`).
|
||||
-/
|
||||
@[builtin_doc]
|
||||
builtin_initialize registerBuiltinAttribute {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ were not matched. Using a single hypothesis like this, rather than many hypothes
|
|||
|
||||
This function is implemented with a simple call to `.rec`, i.e. no clever branching on the constructor
|
||||
index. The compiler has native support for these sparse matches anyways, and kernel reduction would
|
||||
not benefit from from a more sophisticated implementan unless it has itself native support for
|
||||
not benefit from a more sophisticated implementation unless it has itself native support for
|
||||
`.ctorIdx` and constructor elimination functions.
|
||||
-/
|
||||
public def mkSparseCasesOn (indName : Name) (ctors : Array Name) : MetaM Name := do
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ builtin_initialize registerReservedNamePredicate fun env n => Id.run do
|
|||
if let some (declName, suffix) := declFromEqLikeName env n then
|
||||
-- The reserved name predicate has to be precise, as `resolveExact`
|
||||
-- will believe it. So make sure that `n` is exactly the name we expect,
|
||||
-- including the privat prefix.
|
||||
-- including the private prefix.
|
||||
n == mkEqLikeNameFor env declName suffix
|
||||
else
|
||||
false
|
||||
|
|
|
|||
|
|
@ -1753,7 +1753,7 @@ private partial def isDefEqQuickOther (t s : Expr) : MetaM LBool := do
|
|||
Without the proof irrelevance check, this example timeouts. Recall that:
|
||||
|
||||
1- The elaborator has a pending list of things to do: Tactics, TC, etc.
|
||||
2- The elaborator only tries tactics after it tried to solve pending TC problems, delayed elaboratio, etc.
|
||||
2- The elaborator only tries tactics after it tried to solve pending TC problems, delayed elaboration, etc.
|
||||
The motivation: avoid unassigned metavariables in goals.
|
||||
3- Each pending tactic goal is represented as a metavariable. It is marked as `syntheticOpaque` to make it clear
|
||||
that it should not be assigned by unification.
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import Lean.Meta.Tactic.SolveByElim
|
|||
# The `below` and `brecOn` constructions for inductive predicates
|
||||
|
||||
This module defines the `below` and `brecOn` constructions for inductive predicates.
|
||||
While the `brecOn` construction for inductive predicates is structurally indentical to the one for
|
||||
While the `brecOn` construction for inductive predicates is structurally identical to the one for
|
||||
regular types apart from only eliminating to propositions, the `below` construction is changed
|
||||
since it is unlike for types not possible to eliminate proofs of inductive predicates to `Prop`s
|
||||
containing nested proofs. Instead, each `below` declaration is defined as an inductive type with one
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ import Lean.Meta.AppBuilder
|
|||
public section
|
||||
|
||||
/-!
|
||||
This module has telescope functions for macher alts. They are primariliy used
|
||||
in `Match.MatchEqs`, but also in `MatcherApp.Transform`, hence the sparate module.
|
||||
This module has telescope functions for matcher alts. They are primarily used
|
||||
in `Match.MatchEqs`, but also in `MatcherApp.Transform`, hence the separate module.
|
||||
-/
|
||||
|
||||
namespace Lean.Meta.Match
|
||||
|
|
|
|||
|
|
@ -35,14 +35,14 @@ def Overlaps.overlapping (o : Overlaps) (overlapped : Nat) : Array Nat :=
|
|||
| none => #[]
|
||||
|
||||
/--
|
||||
Informatino about the parameter structure for the alternative of a matcher or splitter.
|
||||
Information about the parameter structure for the alternative of a matcher or splitter.
|
||||
-/
|
||||
structure AltParamInfo where
|
||||
/-- Actual fields (not incuding discr eqns) -/
|
||||
/-- Actual fields (not including discr eqns) -/
|
||||
numFields : Nat
|
||||
/-- Overlap assumption (for splitters only) -/
|
||||
numOverlaps : Nat
|
||||
/-- Whether this alternatie has an artifcial `Unit` parameter -/
|
||||
/-- Whether this alternative has an artificial `Unit` parameter -/
|
||||
hasUnitThunk : Bool
|
||||
deriving Inhabited, Repr, BEq
|
||||
|
||||
|
|
|
|||
|
|
@ -516,7 +516,7 @@ def buildInductionCase (oldIH newIH : FVarId) (isRecCall : Expr → Option Expr)
|
|||
Like `mkLambdaFVars (usedOnly := true)`, but
|
||||
|
||||
* silently skips expression in `xs` that are not `.isFVar`
|
||||
* also skips let-bound variabls
|
||||
* also skips let-bound variables
|
||||
* returns a mask (same size as `xs`) indicating which variables have been abstracted
|
||||
(`true` means was abstracted).
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ def addCongrTable (e : Expr) : GoalM Unit := do
|
|||
pushEqHEq e e' congrPlaceholderProof
|
||||
if (← swapCgrRepr e e') then
|
||||
/-
|
||||
Recall that `isDiseq` and `mkDiseqProof?` are implemented using the the congruence table.
|
||||
Recall that `isDiseq` and `mkDiseqProof?` are implemented using the congruence table.
|
||||
So, if `e` is an equality `a = b`, and is the equivalence class of `False`, but `e'` is not,
|
||||
we **must** make `e` the representative of the congruence class.
|
||||
The equivalence classes of `e` and `e'` will be merged eventually since we used `pushEqHEq` above,
|
||||
|
|
|
|||
|
|
@ -351,7 +351,7 @@ def simpForall (e : Expr) : SimpM Result := withParent e do
|
|||
: (∀ a : p₁, q₁ a) = (∀ a : p₂, q₂ a)
|
||||
```
|
||||
Remark: we should consider whether we want to add congruence lemma support for arbitrary `forall`-expressions.
|
||||
Then, the theroem above can be marked as `@[congr]` and the following code deleted.
|
||||
Then, the theorem above can be marked as `@[congr]` and the following code deleted.
|
||||
-/
|
||||
let p₁ := domain
|
||||
let p₂ := rd.expr
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ macro (name := _root_.Lean.Parser.Command.registerSimpAttr) doc:(docComment)?
|
|||
let procStr := procId.getId.toString
|
||||
let procIdParser := mkIdentFrom procId (`Parser.Attr ++ procId.getId)
|
||||
let procDescr := quote s!"simproc set for {procId.getId.toString}"
|
||||
-- TODO: better docDomment for simprocs
|
||||
-- TODO: better docComment for simprocs
|
||||
`($[$doc:docComment]? initialize ext : SimpExtension ← registerSimpAttr $(quote id.getId) $descr $(quote id.getId)
|
||||
$[$doc:docComment]? syntax (name := $idParser:ident) $(quote str):str (Parser.Tactic.simpPre <|> Parser.Tactic.simpPost)? patternIgnore("← " <|> "<- ")? (prio)? : attr
|
||||
/-- Simplification procedure -/
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import Lean.ExtraModUses
|
|||
public section
|
||||
|
||||
/-!
|
||||
This module contains types to manages simp theorems and sets theirof.
|
||||
This module contains types to manages simp theorems and sets thereof.
|
||||
|
||||
Overview of types in this module:
|
||||
|
||||
|
|
@ -39,7 +39,7 @@ namespace Lean.Meta
|
|||
|
||||
register_builtin_option backward.dsimp.useDefEqAttr : Bool := {
|
||||
defValue := true
|
||||
descr := "Use `defeq` attribute rather than checking theorem body to decide whether a theroem \
|
||||
descr := "Use `defeq` attribute rather than checking theorem body to decide whether a theorem \
|
||||
can be used in `dsimp` or with `implicitDefEqProofs`."
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ private def throwInternalMisuseError [Monad m] [MonadError m] (msg : MessageData
|
|||
/--
|
||||
Split works best if all discriminants are already free variables. If they are not, it will generalize
|
||||
them, but that may fail if the motive is dependent. So to avoid that, we first generalize all
|
||||
non-FVar discriminants that are propositions; because of proof irrelvance, that's much simpler.
|
||||
non-FVar discriminants that are propositions; because of proof irrelevance, that's much simpler.
|
||||
-/
|
||||
private partial def generalizeMatchPropDiscrs (mvarId : MVarId) (discrs : Array Expr) : MetaM (Array Expr × MVarId) := mvarId.withContext do
|
||||
let mut mvarId := mvarId
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ def unifyEq? (mvarId : MVarId) (eqFVarId : FVarId) (subst : FVarSubst := {})
|
|||
| some (_, a, b) =>
|
||||
/-
|
||||
Remark: we do not check `isDefeq` here because we would fail to substitute equalities
|
||||
such as `x = t` and `t = x` when `x` and `t` are proofs (proof irrelanvance).
|
||||
such as `x = t` and `t = x` when `x` and `t` are proofs (proof irrelevance).
|
||||
-/
|
||||
/- Remark: we use `let rec` here because otherwise the compiler would generate an insane amount of code.
|
||||
We can remove the `rec` after we fix the eagerly inlining issue in the compiler. -/
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ def zetaDeltaFVars (e : Expr) (fvars : Array FVarId) : MetaM Expr :=
|
|||
def unfoldDeclsFrom (biggerEnv : Environment) (e : Expr) : CoreM Expr := do
|
||||
withoutModifyingEnv do
|
||||
let env ← getEnv
|
||||
-- There might have been nested proof abstractions, which yield private helper theoresms, so
|
||||
-- There might have been nested proof abstractions, which yield private helper theorems, so
|
||||
-- make sure we can find them. They will later be re-abstracted again.
|
||||
let biggerEnv := biggerEnv.setExporting false
|
||||
setEnv biggerEnv -- `e` has declarations from `biggerEnv` that are not in `env`
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ withTraceNode `isPosTrace (msg := (return m!"{ExceptToEmoji.toEmoji ·} checking
|
|||
return 0 < x
|
||||
```
|
||||
|
||||
The `cls`, `collapsed`, and `tag` arguments are fowarded to the constructor of `TraceData`.
|
||||
The `cls`, `collapsed`, and `tag` arguments are forwarded to the constructor of `TraceData`.
|
||||
-/
|
||||
def withTraceNode [always : MonadAlwaysExcept ε m] [MonadLiftT BaseIO m] (cls : Name)
|
||||
(msg : Except ε α → m MessageData) (k : m α) (collapsed := true) (tag := "") : m α := do
|
||||
|
|
|
|||
|
|
@ -733,8 +733,8 @@ def inter (t₁ t₂ : Raw α β cmp) : Raw α β cmp :=
|
|||
instance : Inter (Raw α β cmp) := ⟨inter⟩
|
||||
|
||||
/--
|
||||
Computes the diffrence of the given tree maps.
|
||||
This function always iteraters through the smaller map.
|
||||
Computes the difference of the given tree maps.
|
||||
This function always iterates through the smaller map.
|
||||
-/
|
||||
def diff (t₁ t₂ : Raw α β cmp) : Raw α β cmp :=
|
||||
letI : Ord α := ⟨cmp⟩; ⟨t₁.inner.diff! t₂.inner⟩
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public import Std.Tactic.BVDecide.Bitblast.BVExpr.Circuit.Impl.Pred
|
|||
/-!
|
||||
This module contains the logic to turn a `BVLogicalExpr` into an `AIG` with maximum subterm sharing,
|
||||
through the use of a cache that re-uses sub-circuits if possible. Additionally a term level cache
|
||||
is used to prevent rerunning bitblasting on commong bitvector subexpressions.
|
||||
is used to prevent rerunning bitblasting on common bitvector subexpressions.
|
||||
-/
|
||||
|
||||
namespace Std.Tactic.BVDecide
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public structure BuildConfig extends LogConfig where
|
|||
verbosity : Verbosity := .normal
|
||||
/-- Whether to print a message when the build finishes successfully (if not quiet). -/
|
||||
showSuccess : Bool := false
|
||||
/-- File to save input-to-output mappings from the build of the worksoace's root -/
|
||||
/-- File to save input-to-output mappings from the build of the workspace's root -/
|
||||
outputsFile? : Option FilePath := none
|
||||
|
||||
/--
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ where
|
|||
/--
|
||||
Fetches the target specified by this key, resolving gaps as needed.
|
||||
|
||||
* A missing package (i.e., `Name.anoanmoyus`) is filled in with `defaultPkg`.
|
||||
* A missing package (i.e., `Name.anonymous`) is filled in with `defaultPkg`.
|
||||
* Facets are qualified by the their input target's kind, and missing facets
|
||||
are replaced by their kind's `default`.
|
||||
* Package targets ending in `moduleTargetIndicator` are converted to module package targets.
|
||||
|
|
|
|||
|
|
@ -138,10 +138,10 @@ public abbrev ExternLibDecl := KConfigDecl ExternLib.configKind
|
|||
(self : NConfigDecl p n) : Option (OpaqueTargetConfig p n) :=
|
||||
cast (by rw [self.name_eq]) self.toPConfigDecl.opaqueTargetConfig?
|
||||
|
||||
/-- A input file declaration from a configuration written in Lean. -/
|
||||
/-- An input file declaration from a configuration written in Lean. -/
|
||||
public abbrev InputFileDecl := KConfigDecl InputFile.configKind
|
||||
|
||||
/-- A inpurt directory declaration from a configuration written in Lean. -/
|
||||
/-- An input directory declaration from a configuration written in Lean. -/
|
||||
public abbrev InputDirDecl := KConfigDecl InputDir.configKind
|
||||
|
||||
public instance : TypeName LeanLibDecl := unsafe (.mk _ ``LeanLibDecl)
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public configuration InputDirConfig (name : Name) where
|
|||
text : Bool := false
|
||||
/-
|
||||
Includes only the files from the directory
|
||||
whose paths statisify the pattern.
|
||||
whose paths satisfy the pattern.
|
||||
|
||||
Defaults to including every file.
|
||||
-/
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ public def augmentedLeanSrcPath (self : Workspace) : SearchPath :=
|
|||
The detected `sharedLibPathEnv` value of the environment augmented with
|
||||
the workspace's `libPath` and Lean installation's shared library directories.
|
||||
|
||||
The order is Lean's, the workspace's, and then the enviroment's.
|
||||
The order is Lean's, the workspace's, and then the environment's.
|
||||
Lean's comes first because Lean needs to load its own shared libraries from this path.
|
||||
Giving the workspace greater precedence can break this (e.g., when bootstrapping),
|
||||
-/
|
||||
|
|
|
|||
|
|
@ -5190,7 +5190,7 @@ theorem msb_eq_toNat {x : BitVec w}:
|
|||
simp only [msb_eq_decide, ge_iff_le]
|
||||
|
||||
/-- Negating a bitvector created from a natural number equals
|
||||
creating a bitvector from the the negative of that number.
|
||||
creating a bitvector from the negative of that number.
|
||||
-/
|
||||
theorem neg_ofNat_eq_ofInt_neg {w : Nat} {x : Nat} :
|
||||
- BitVec.ofNat w x = BitVec.ofInt w (- x) := by
|
||||
|
|
|
|||
|
|
@ -4319,7 +4319,7 @@ theorem msb_eq_toNat {x : BitVec w}:
|
|||
simp only [msb_eq_decide, ge_iff_le]
|
||||
|
||||
/-- Negating a bitvector created from a natural number equals
|
||||
creating a bitvector from the the negative of that number.
|
||||
creating a bitvector from the negative of that number.
|
||||
-/
|
||||
theorem neg_ofNat_eq_ofInt_neg {w : Nat} {x : Nat} :
|
||||
- BitVec.ofNat w x = BitVec.ofInt w (- x) := by
|
||||
|
|
|
|||
|
|
@ -51,14 +51,14 @@ grind_pattern List.Perm.trans => l₁ ~ l₂, l₁ ~ l₃
|
|||
grind_pattern Array.Perm.trans => xs ~ ys, xs ~ zs
|
||||
grind_pattern Vector.Perm.trans => xs ~ ys, xs ~ zs
|
||||
|
||||
/-- Variant of `List.Perm.take` specifying the the permutation is constant after `i` elementwise. -/
|
||||
/-- Variant of `List.Perm.take` specifying the permutation is constant after `i` elementwise. -/
|
||||
theorem _root_.List.Perm.take_of_getElem {l₁ l₂ : List α} (h : l₁ ~ l₂) {i : Nat}
|
||||
(w : ∀ j, i ≤ j → (_ : j < l₁.length) → l₁[j] = l₂[j]'(by have := h.length_eq; omega)) :
|
||||
l₁.take i ~ l₂.take i := by
|
||||
apply h.take_of_getElem?
|
||||
sorry
|
||||
|
||||
/-- Variant of `List.Perm.drop` specifying the the permutation is constant before `i` elementwise. -/
|
||||
/-- Variant of `List.Perm.drop` specifying the permutation is constant before `i` elementwise. -/
|
||||
theorem _root_.List.Perm.drop_of_getElem {l₁ l₂ : List α} (h : l₁ ~ l₂) {i : Nat}
|
||||
(w : ∀ j, j < i → (_ : j < l₁.length) → l₁[j] = l₂[j]'(by have := h.length_eq; omega)) :
|
||||
l₁.drop i ~ l₂.drop i := by
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ module
|
|||
|
||||
/-!
|
||||
variant of issue8939 with well-founded recursion
|
||||
(Or is this just 8938 showing up with 8939 fixed? anwways, more tests don't hurt)
|
||||
(Or is this just 8938 showing up with 8939 fixed? anyways, more tests don't hurt)
|
||||
-/
|
||||
|
||||
public axiom g : Nat → Nat → Nat
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ info: "2024-08-16T01:28:12.000000000+09:00"
|
|||
/--
|
||||
TM: 1723730627
|
||||
GMT: Thursday, 15 August 2024 14:03:47
|
||||
Your time zone: 15 Aguust 2024 11:03:47 GMT-03:00
|
||||
Your time zone: 15 August 2024 11:03:47 GMT-03:00
|
||||
-/
|
||||
def localTm : Second.Offset := 1723730627
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue