chore: cleanup

This commit is contained in:
Leonardo de Moura 2020-10-22 07:32:23 -07:00
parent 4efad86fa5
commit af968c60e6
27 changed files with 41 additions and 41 deletions

View file

@ -26,7 +26,7 @@ structure PreDefinition :=
(type : Expr)
(value : Expr)
instance PreDefinition.inhabited : Inhabited PreDefinition :=
instance : Inhabited PreDefinition :=
⟨⟨DefKind.«def», [], {}, arbitrary _, arbitrary _, arbitrary _⟩⟩
def instantiateMVarsAtPreDecls (preDefs : Array PreDefinition) : TermElabM (Array PreDefinition) :=

View file

@ -15,7 +15,7 @@ the strategy selection attributes while we rely on the Lean3 elaborator.
inductive ElaboratorStrategy
| simple | withExpectedType | asEliminator
instance ElaboratorStrategy.inhabited : Inhabited ElaboratorStrategy :=
instance : Inhabited ElaboratorStrategy :=
⟨ElaboratorStrategy.withExpectedType⟩
builtin_initialize elaboratorStrategyAttrs : EnumAttributes ElaboratorStrategy ←

View file

@ -727,7 +727,7 @@ abbrev PExprSet := PersistentExprSet
structure ExprStructEq :=
(val : Expr)
instance exprToExprStructEq : Coe Expr ExprStructEq := ⟨ExprStructEq.mk⟩
instance : Coe Expr ExprStructEq := ⟨ExprStructEq.mk⟩
namespace ExprStructEq

View file

@ -24,13 +24,13 @@ namespace Lean
depth : 24-bits -/
def Level.Data := UInt64
instance Level.Data.inhabited : Inhabited Level.Data :=
instance : Inhabited Level.Data :=
inferInstanceAs (Inhabited UInt64)
def Level.Data.hash (c : Level.Data) : USize :=
c.toUInt32.toUSize
instance Level.Data.hasBeq : HasBeq Level.Data :=
instance : HasBeq Level.Data :=
⟨fun (a b : UInt64) => a == b⟩
def Level.Data.depth (c : Level.Data) : UInt32 :=

View file

@ -392,7 +392,7 @@ class MonadLCtx (m : Type → Type) :=
export MonadLCtx (getLCtx)
instance monadLCtxTrans (m n) [MonadLCtx m] [MonadLift m n] : MonadLCtx n :=
instance (m n) [MonadLCtx m] [MonadLift m n] : MonadLCtx n :=
{ getLCtx := liftM (getLCtx : m _) }
def replaceFVarIdAtLocalDecl (fvarId : FVarId) (e : Expr) (d : LocalDecl) : LocalDecl :=

View file

@ -13,12 +13,12 @@ structure AbstractMVarsResult :=
(numMVars : Nat)
(expr : Expr)
instance AbstractMVarsResult.inhabited : Inhabited AbstractMVarsResult := ⟨⟨#[], 0, arbitrary _⟩⟩
instance : Inhabited AbstractMVarsResult := ⟨⟨#[], 0, arbitrary _⟩⟩
def AbstractMVarsResult.beq (r₁ r₂ : AbstractMVarsResult) : Bool :=
r₁.paramNames == r₂.paramNames && r₁.numMVars == r₂.numMVars && r₁.expr == r₂.expr
instance AbstractMVarsResult.hasBeq : HasBeq AbstractMVarsResult := ⟨AbstractMVarsResult.beq⟩
instance : HasBeq AbstractMVarsResult := ⟨AbstractMVarsResult.beq⟩
namespace AbstractMVars

View file

@ -100,7 +100,7 @@ structure State :=
/- When `trackZeta == true`, then any let-decl free variable that is zeta expansion performed by `MetaM` is stored in `zetaFVarIds`. -/
(zetaFVarIds : NameSet := {})
instance State.inhabited : Inhabited State := ⟨{}⟩
instance : Inhabited State := ⟨{}⟩
structure Context :=
(config : Config := {})
@ -118,7 +118,7 @@ abbrev DefEqM := StateRefT (PersistentArray PostponedEntry) MetaM
instance : MonadIO MetaM :=
{ liftIO := fun x => liftM (liftIO x : CoreM _) }
instance MetaM.inhabited {α} : Inhabited (MetaM α) :=
instance {α} : Inhabited (MetaM α) :=
⟨fun _ _ => arbitrary _⟩
instance : MonadLCtx MetaM :=
@ -140,7 +140,7 @@ Prod.fst <$> x.run ctx s
let ((a, s), sCore) ← (x.run ctx s).toIO ctxCore sCore
pure (a, sCore, s)
instance hasEval {α} [MetaHasEval α] : MetaHasEval (MetaM α) :=
instance {α} [MetaHasEval α] : MetaHasEval (MetaM α) :=
⟨fun env opts x _ => MetaHasEval.eval env opts x.run' true⟩
protected def throwIsDefEqStuck {α} : DefEqM α :=

View file

@ -247,7 +247,7 @@ partial def Trie.format {α} [HasFormat α] : Trie α → Format
"node" ++ (if vs.isEmpty then Format.nil else " " ++ fmt vs)
++ Format.join (cs.toList.map $ fun ⟨k, c⟩ => Format.line ++ Format.paren (fmt k ++ " => " ++ format c))
instance Trie.hasFormat {α} [HasFormat α] : HasFormat (Trie α) := ⟨Trie.format⟩
instance {α} [HasFormat α] : HasFormat (Trie α) := ⟨Trie.format⟩
partial def format {α} [HasFormat α] (d : DiscrTree α) : Format :=
let (_, r) := d.root.foldl
@ -256,7 +256,7 @@ let (_, r) := d.root.foldl
(true, Format.nil)
Format.group r
instance DiscrTree.hasFormat {α} [HasFormat α] : HasFormat (DiscrTree α) := ⟨format⟩
instance {α} [HasFormat α] : HasFormat (DiscrTree α) := ⟨format⟩
private def getKeyArgs (e : Expr) (isMatch? : Bool) : MetaM (Key × Array Expr) := do
let e ← whnfEta e

View file

@ -15,7 +15,7 @@ structure CaseArraySizesSubgoal :=
(diseqs : Array FVarId := #[])
(subst : FVarSubst := {})
instance CaseArraySizesSubgoal.inhabited : Inhabited CaseArraySizesSubgoal :=
instance : Inhabited CaseArraySizesSubgoal :=
⟨{ mvarId := arbitrary _ }⟩
def getArrayArgType (a : Expr) : MetaM Expr := do

View file

@ -14,7 +14,7 @@ structure CaseValueSubgoal :=
(newH : FVarId)
(subst : FVarSubst := {})
instance CaseValueSubgoal.inhabited : Inhabited CaseValueSubgoal :=
instance : Inhabited CaseValueSubgoal :=
⟨{ mvarId := arbitrary _, newH := arbitrary _ }⟩
/--
@ -65,7 +65,7 @@ structure CaseValuesSubgoal :=
(newHs : Array FVarId := #[])
(subst : FVarSubst := {})
instance CaseValueSubgoals.inhabited : Inhabited CaseValuesSubgoal :=
instance : Inhabited CaseValuesSubgoal :=
⟨{ mvarId := arbitrary _ }⟩
/--

View file

@ -773,7 +773,7 @@ structure Entry :=
structure State :=
(map : SMap Name MatcherInfo := {})
instance State.inhabited : Inhabited State :=
instance : Inhabited State :=
⟨{}⟩
def State.addEntry (s : State) (e : Entry) : State := { s with map := s.map.insert e.name e.info }

View file

@ -24,7 +24,7 @@ inductive RecursorUnivLevelPos
| motive -- marks where the universe of the motive should go
| majorType (idx : Nat) -- marks where the #idx universe of the major premise type goes
instance RecursorUnivLevelPos.hasToString : HasToString RecursorUnivLevelPos :=
instance : HasToString RecursorUnivLevelPos :=
⟨fun pos => match pos with
| RecursorUnivLevelPos.motive => "<motive-univ>"
| RecursorUnivLevelPos.majorType idx => toString idx⟩

View file

@ -33,7 +33,7 @@ structure GeneratorNode :=
(instances : Array Expr)
(currInstanceIdx : Nat)
instance GeneratorNode.inhabited : Inhabited GeneratorNode := ⟨⟨arbitrary _, arbitrary _, arbitrary _, arbitrary _, 0⟩⟩
instance : Inhabited GeneratorNode := ⟨⟨arbitrary _, arbitrary _, arbitrary _, arbitrary _, 0⟩⟩
structure ConsumerNode :=
(mvar : Expr)
@ -41,7 +41,7 @@ structure ConsumerNode :=
(mctx : MetavarContext)
(subgoals : List Expr)
instance Consumernode.inhabited : Inhabited ConsumerNode := ⟨⟨arbitrary _, arbitrary _, arbitrary _, []⟩⟩
instance : Inhabited ConsumerNode := ⟨⟨arbitrary _, arbitrary _, arbitrary _, []⟩⟩
inductive Waiter
| consumerNode : ConsumerNode → Waiter
@ -137,7 +137,7 @@ structure Answer :=
(result : AbstractMVarsResult)
(resultType : Expr)
instance Answer.inhabited : Inhabited Answer := ⟨⟨arbitrary _, arbitrary _⟩⟩
instance : Inhabited Answer := ⟨⟨arbitrary _, arbitrary _⟩⟩
structure TableEntry :=
(waiters : Array Waiter)

View file

@ -41,7 +41,7 @@ structure InductionSubgoal :=
(fields : Array Expr := #[])
(subst : FVarSubst := {})
instance InductionSubgoal.inhabited : Inhabited InductionSubgoal := ⟨{ mvarId := arbitrary _ }⟩
instance : Inhabited InductionSubgoal := ⟨{ mvarId := arbitrary _ }⟩
private def getTypeBody (mvarId : MVarId) (type : Expr) (x : Expr) : MetaM Expr := do
type ← whnfForall type

View file

@ -1113,7 +1113,7 @@ class MonadMCtx (m : Type → Type) :=
export MonadMCtx (getMCtx)
instance monadMCtxTrans (m n) [MonadMCtx m] [MonadLift m n] : MonadMCtx n :=
instance (m n) [MonadMCtx m] [MonadLift m n] : MonadMCtx n :=
{ getMCtx := liftM (getMCtx : m _) }
end Lean

View file

@ -65,7 +65,7 @@ structure ParserExtensionState :=
(categories : ParserCategories := {})
(newEntries : List ParserExtensionOleanEntry := [])
instance ParserExtensionState.inhabited : Inhabited ParserExtensionState := ⟨{}⟩
instance : Inhabited ParserExtensionState := ⟨{}⟩
abbrev ParserExtension := PersistentEnvExtension ParserExtensionOleanEntry ParserExtensionEntry ParserExtensionState

View file

@ -47,7 +47,7 @@ abbrev FormatterM := ReaderT Formatter.Context $ StateRefT Formatter.State $ Cor
p₁
(fun _ => do set s; p₂)
instance Formatter.orelse {α} : HasOrelse (FormatterM α) := ⟨FormatterM.orelse⟩
instance {α} : HasOrelse (FormatterM α) := ⟨FormatterM.orelse⟩
abbrev Formatter := FormatterM Unit
@ -90,7 +90,7 @@ open Lean.Parser
def throwBacktrack {α} : FormatterM α :=
throw $ Exception.internal backtrackExceptionId
instance FormatterM.monadTraverser : Syntax.MonadTraverser FormatterM := ⟨{
instance : Syntax.MonadTraverser FormatterM := ⟨{
get := State.stxTrav <$> get,
set := fun t => modify (fun st => { st with stxTrav := t }),
modifyGet := fun f => modifyGet (fun st => let (a, t) := f st.stxTrav; (a, { st with stxTrav := t }))

View file

@ -109,7 +109,7 @@ abbrev Parenthesizer := ParenthesizerM Unit
p₁
(fun _ => do set s; p₂)
instance Parenthesizer.orelse {α} : HasOrelse (ParenthesizerM α) := ⟨ParenthesizerM.orelse⟩
instance {α} : HasOrelse (ParenthesizerM α) := ⟨ParenthesizerM.orelse⟩
unsafe def mkParenthesizerAttribute : IO (KeyedDeclsAttribute Parenthesizer) :=
KeyedDeclsAttribute.init {
@ -173,7 +173,7 @@ open Lean.Format
def throwBacktrack {α} : ParenthesizerM α :=
throw $ Exception.internal backtrackExceptionId
instance ParenthesizerM.monadTraverser : Syntax.MonadTraverser ParenthesizerM := ⟨{
instance : Syntax.MonadTraverser ParenthesizerM := ⟨{
get := State.stxTrav <$> get,
set := fun t => modify (fun st => { st with stxTrav := t }),
modifyGet := fun f => modifyGet (fun st => let (a, t) := f st.stxTrav; (a, { st with stxTrav := t }))
@ -193,7 +193,7 @@ def visitArgs (x : ParenthesizerM Unit) : ParenthesizerM Unit := do
-- Macro scopes in the parenthesizer output are ultimately ignored by the pretty printer,
-- so give a trivial implementation.
instance monadQuotation : MonadQuotation ParenthesizerM := {
instance : MonadQuotation ParenthesizerM := {
getCurrMacroScope := pure $ arbitrary _,
getMainModule := pure $ arbitrary _,
withFreshMacroScope := fun x => x,

View file

@ -22,7 +22,7 @@ def mkProjectionInfoEx (ctorName : Name) (nparams : Nat) (i : Nat) (fromClass :
@[export lean_projection_info_from_class]
def ProjectionFunctionInfo.fromClassEx (info : ProjectionFunctionInfo) : Bool := info.fromClass
instance ProjectionFunctionInfo.inhabited : Inhabited ProjectionFunctionInfo :=
instance : Inhabited ProjectionFunctionInfo :=
⟨{ ctorName := arbitrary _, nparams := arbitrary _, i := 0, fromClass := false }⟩
builtin_initialize projectionFnInfoExt : SimplePersistentEnvExtension (Name × ProjectionFunctionInfo) (NameMap ProjectionFunctionInfo) ←

View file

@ -11,7 +11,7 @@ namespace Lean
inductive ReducibilityStatus
| reducible | semireducible | irreducible
instance ReducibilityStatus.inhabited : Inhabited ReducibilityStatus := ⟨ReducibilityStatus.semireducible⟩
instance : Inhabited ReducibilityStatus := ⟨ReducibilityStatus.semireducible⟩
builtin_initialize reducibilityAttrs : EnumAttributes ReducibilityStatus ←
registerEnumAttributes `reducibility

View file

@ -151,7 +151,7 @@ class MonadResolveName (m : Type → Type) :=
export MonadResolveName (getCurrNamespace getOpenDecls)
instance monadResolveNameFromLift (m n) [MonadResolveName m] [MonadLift m n] : MonadResolveName n :=
instance (m n) [MonadResolveName m] [MonadLift m n] : MonadResolveName n :=
{ getCurrNamespace := liftM (getCurrNamespace : m _),
getOpenDecls := liftM (getOpenDecls : m _) }

View file

@ -332,7 +332,7 @@ partial def structEq : Syntax → Syntax → Bool
| Syntax.ident _ rawVal val preresolved, Syntax.ident _ rawVal' val' preresolved' => rawVal == rawVal' && val == val' && preresolved == preresolved'
| _, _ => false
instance structHasBeq : HasBeq Lean.Syntax := ⟨structEq⟩
instance : HasBeq Lean.Syntax := ⟨structEq⟩
/--
Represents a cursor into a syntax tree that can be read, written, and advanced down/up/left/right.

View file

@ -12,7 +12,7 @@ structure State :=
(visitedExpr : ExprSet := {})
(fvarSet : NameSet := {})
instance State.inhabited : Inhabited State := ⟨{}⟩
instance : Inhabited State := ⟨{}⟩
abbrev Visitor := State → State

View file

@ -15,7 +15,7 @@ structure State :=
(visitedExpr : ExprSet := {})
(params : Array Name := #[])
instance State.inhabited : Inhabited State := ⟨{}⟩
instance : Inhabited State := ⟨{}⟩
abbrev Visitor := State → State

View file

@ -14,7 +14,7 @@ structure State :=
(visitedExpr : ExprSet := {})
(result : Array MVarId := #[])
instance State.inhabited : Inhabited State := ⟨{}⟩
instance : Inhabited State := ⟨{}⟩
abbrev Visitor := State → State

View file

@ -22,11 +22,11 @@ match b? with
MonadCache.cache a b
pure b
instance readerLift {α β ρ : Type} {m : Type → Type} [MonadCache α β m] : MonadCache α β (ReaderT ρ m) :=
instance {α β ρ : Type} {m : Type → Type} [MonadCache α β m] : MonadCache α β (ReaderT ρ m) :=
{ findCached? := fun a r => MonadCache.findCached? a,
cache := fun a b r => MonadCache.cache a b }
instance exceptLift {α β ε : Type} {m : Type → Type} [MonadCache α β m] [Monad m] : MonadCache α β (ExceptT ε m) :=
instance {α β ε : Type} {m : Type → Type} [MonadCache α β m] [Monad m] : MonadCache α β (ExceptT ε m) :=
{ findCached? := fun a => ExceptT.lift $ MonadCache.findCached? a,
cache := fun a b => ExceptT.lift $ MonadCache.cache a b }
@ -88,7 +88,7 @@ let s ← get; pure s.cache
@[inline] def modifyCache {α β σ : Type} [HasBeq α] [Hashable α] (f : HashMap α β → HashMap α β) : StateM (WithHashMapCache α β σ) Unit :=
modify fun s => { s with cache := f s.cache }
instance stateAdapter (α β σ : Type) [HasBeq α] [Hashable α] : MonadHashMapCacheAdapter α β (StateM (WithHashMapCache α β σ)) :=
instance (α β σ : Type) [HasBeq α] [Hashable α] : MonadHashMapCacheAdapter α β (StateM (WithHashMapCache α β σ)) :=
{ getCache := WithHashMapCache.getCache,
modifyCache := WithHashMapCache.modifyCache }
@ -98,7 +98,7 @@ let s ← get; pure s.cache
@[inline] def modifyCacheE {α β ε σ : Type} [HasBeq α] [Hashable α] (f : HashMap α β → HashMap α β) : EStateM ε (WithHashMapCache α β σ) Unit :=
modify fun s => { s with cache := f s.cache }
instance estateAdapter (α β ε σ : Type) [HasBeq α] [Hashable α] : MonadHashMapCacheAdapter α β (EStateM ε (WithHashMapCache α β σ)) :=
instance (α β ε σ : Type) [HasBeq α] [Hashable α] : MonadHashMapCacheAdapter α β (EStateM ε (WithHashMapCache α β σ)) :=
{ getCache := WithHashMapCache.getCacheE,
modifyCache := WithHashMapCache.modifyCacheE }

View file

@ -32,7 +32,7 @@ structure PPFns :=
(ppExpr : PPContext → Expr → IO Format)
(ppTerm : PPContext → Syntax → IO Format)
instance PPFns.inhabited : Inhabited PPFns := ⟨⟨arbitrary _, arbitrary _⟩⟩
instance : Inhabited PPFns := ⟨⟨arbitrary _, arbitrary _⟩⟩
builtin_initialize ppFnsRef : IO.Ref PPFns ←
IO.mkRef {