Realization machinery for the ZF first-order language #
This module sets up the first-order language 𝓛ZF of ZF set theory with a single
membership relation, together with notation and metaprogramming infrastructure for
building and realizing bounded formulas in models of ZF.
Equations
Instances For
The exUnique declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The ite declaration.
Instances For
The ofFunc declaration.
Equations
- FirstOrder.Language.BoundedFormula.ofFunc φ vars ψ = (FirstOrder.Language.BoundedFormula.relabel (Fin.snoc (Sum.map id Fin.castSucc ∘ vars) (Sum.inr (Fin.last n))) φ ⊓ ψ).ex
Instances For
The #_ notation.
Equations
- FirstOrder.«term#_» = Lean.ParserDescr.node `FirstOrder.«term#_» 1023 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "#") (Lean.ParserDescr.cat `term 1023))
Instances For
The _∈ᶻ'_ notation: membership in the ZF first-order language 𝓛ZF.
Equations
- FirstOrder.«term_∈ᶻ'_» = Lean.ParserDescr.trailingNode `FirstOrder.«term_∈ᶻ'_» 88 89 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ∈ᶻ' ") (Lean.ParserDescr.cat `term 89))
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
The label#_ declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The label&_ declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The Value_of_labels(_) declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The _@(_) notation.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The ZFStructure declaration.
Equations
- ZFStructure M = 𝓛ZF.Structure M
Instances For
Equations
- instMembershipZFStructure = { mem := fun (x y : M) => FirstOrder.Language.Structure.RelMap memRel.mem ![y, x] }
The ElementaryEmbeddingClass type.
Instances
Equations
- instEmptyCollectionM = { emptyCollection := Exists.choose ⋯ }
Equations
Equations
Equations
- EncodeExpr.instToJsonWeakLevel.toJson EncodeExpr.WeakLevel.a = Lean.toJson "a"
- EncodeExpr.instToJsonWeakLevel.toJson a.b = Lean.Json.mkObj [("b", EncodeExpr.instToJsonWeakLevel.toJson a)]
- EncodeExpr.instToJsonWeakLevel.toJson (a.c a_1) = Lean.Json.mkObj [("c", Lean.Json.arr #[EncodeExpr.instToJsonWeakLevel.toJson a, EncodeExpr.instToJsonWeakLevel.toJson a_1])]
- EncodeExpr.instToJsonWeakLevel.toJson (a.d a_1) = Lean.Json.mkObj [("d", Lean.Json.arr #[EncodeExpr.instToJsonWeakLevel.toJson a, EncodeExpr.instToJsonWeakLevel.toJson a_1])]
- EncodeExpr.instToJsonWeakLevel.toJson (EncodeExpr.WeakLevel.e a) = Lean.Json.mkObj [("e", Lean.toJson a)]
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
- EncodeExpr.instReprWeakLevel.repr EncodeExpr.WeakLevel.a prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "EncodeExpr.WeakLevel.a")).group prec✝
Instances For
Equations
- EncodeExpr.instReprWeakLevel = { reprPrec := EncodeExpr.instReprWeakLevel.repr }
The WeakBinderInfo type.
- a : WeakBinderInfo
- b : WeakBinderInfo
- c : WeakBinderInfo
- d : WeakBinderInfo
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
- EncodeExpr.instToJsonWeakBinderInfo.toJson EncodeExpr.WeakBinderInfo.a = Lean.toJson "a"
- EncodeExpr.instToJsonWeakBinderInfo.toJson EncodeExpr.WeakBinderInfo.b = Lean.toJson "b"
- EncodeExpr.instToJsonWeakBinderInfo.toJson EncodeExpr.WeakBinderInfo.c = Lean.toJson "c"
- EncodeExpr.instToJsonWeakBinderInfo.toJson EncodeExpr.WeakBinderInfo.d = Lean.toJson "d"
Instances For
Equations
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
The WeakExprItem type.
- a : ℕ → WeakExprItem
- b : WeakLevel → WeakExprItem
- c : ℕ → List WeakLevel → WeakExprItem
- d : ℕ → ℕ → WeakExprItem
- e : ℕ → ℕ → ℕ → ℕ → WeakExprItem
- f : ℕ → ℕ → ℕ → ℕ → WeakExprItem
- g : ℕ → ℕ → ℕ → ℕ → Bool → WeakExprItem
- h : ℕ → WeakExprItem
- i : String → WeakExprItem
- j : ℕ → ℕ → ℕ → WeakExprItem
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
Equations
- One or more equations did not get rendered due to their size.
- EncodeExpr.instToJsonWeakExprItem.toJson (EncodeExpr.WeakExprItem.a a) = Lean.Json.mkObj [("a", Lean.toJson a)]
- EncodeExpr.instToJsonWeakExprItem.toJson (EncodeExpr.WeakExprItem.b a) = Lean.Json.mkObj [("b", Lean.toJson a)]
- EncodeExpr.instToJsonWeakExprItem.toJson (EncodeExpr.WeakExprItem.c a a_1) = Lean.Json.mkObj [("c", Lean.Json.arr #[Lean.toJson a, Lean.toJson a_1])]
- EncodeExpr.instToJsonWeakExprItem.toJson (EncodeExpr.WeakExprItem.d a a_1) = Lean.Json.mkObj [("d", Lean.Json.arr #[Lean.toJson a, Lean.toJson a_1])]
- EncodeExpr.instToJsonWeakExprItem.toJson (EncodeExpr.WeakExprItem.e a a_1 a_2 a_3) = Lean.Json.mkObj [("e", Lean.Json.arr #[Lean.toJson a, Lean.toJson a_1, Lean.toJson a_2, Lean.toJson a_3])]
- EncodeExpr.instToJsonWeakExprItem.toJson (EncodeExpr.WeakExprItem.f a a_1 a_2 a_3) = Lean.Json.mkObj [("f", Lean.Json.arr #[Lean.toJson a, Lean.toJson a_1, Lean.toJson a_2, Lean.toJson a_3])]
- EncodeExpr.instToJsonWeakExprItem.toJson (EncodeExpr.WeakExprItem.h a) = Lean.Json.mkObj [("h", Lean.toJson a)]
- EncodeExpr.instToJsonWeakExprItem.toJson (EncodeExpr.WeakExprItem.i a) = Lean.Json.mkObj [("i", Lean.toJson a)]
- EncodeExpr.instToJsonWeakExprItem.toJson (EncodeExpr.WeakExprItem.j a a_1 a_2) = Lean.Json.mkObj [("j", Lean.Json.arr #[Lean.toJson a, Lean.toJson a_1, Lean.toJson a_2])]
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
The toWeakLevel declaration.
Equations
- Lean.Level.zero.toWeakLevel = EncodeExpr.WeakLevel.a
- u.succ.toWeakLevel = u.toWeakLevel.b
- (u.max v).toWeakLevel = u.toWeakLevel.c v.toWeakLevel
- (u.imax v).toWeakLevel = u.toWeakLevel.d v.toWeakLevel
- (Lean.Level.param name).toWeakLevel = EncodeExpr.WeakLevel.e name.toString
- (Lean.Level.mvar a).toWeakLevel = default
Instances For
The numeric encoding of binder information round-trips back to the original.
The numeric BinderInfo encoding is injective on the four valid binder kinds.
Mutable state threaded through expression serialization: deduplicating maps from subexpressions and names to their indices, together with the output arrays.
- hashExpr : Std.HashMap Lean.Expr ℕ
Cache from already-serialized subexpressions to their indices.
- hashName : Std.HashMap Lean.Name ℕ
Cache from already-serialized names to their indices.
- arrayExpr : Array WeakExprItem
The serialized expression items, indexed in insertion order.
The serialized name strings, indexed in insertion order.
Instances For
A serialized closed expression: the array of expression items together with the array of referenced name strings.
Equations
Instances For
The serialization monad: a state monad over WeakExprState with failure.
Equations
Instances For
Append a new serialized item for e, recording its index in the cache.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Serialize a name, returning the index of its (deduplicated) string.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Recursively serialize an expression into the state, returning its index.
Equations
- One or more equations did not get rendered due to their size.
- EncodeExpr.toWeakExprAux (Lean.Expr.fvar fvarId) = do let __do_lift ← get match __do_lift.hashExpr.get? (Lean.Expr.fvar fvarId) with | some n => pure n | x => failure
- EncodeExpr.toWeakExprAux (Lean.Expr.mvar mvarId) = do let __do_lift ← get match __do_lift.hashExpr.get? (Lean.Expr.mvar mvarId) with | some n => pure n | x => failure
Instances For
Serialize a closed expression into its WeakExpr representation.
Equations
- e.toWeakExpr = ((OptionT.run (EncodeExpr.toWeakExprAux e) { }).2.arrayExpr, (OptionT.run (EncodeExpr.toWeakExprAux e) { }).2.arrayName)
Instances For
The toExpr declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The HeadBeta(_) declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The Expr(_) declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The toSyntax' declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The VariableParam type.
- freeVariable (binderInfo : Lean.BinderInfo) : VariableParam
- hypothesis (t : Lean.Term) : VariableParam
Instances For
Equations
The isFreeVariable declaration.
Equations
- (VariableParam.freeVariable binderInfo).isFreeVariable = true
- x✝.isFreeVariable = false
Instances For
The toTerm declaration.
Instances For
A variable parameter is a free variable exactly when it is not a hypothesis.
The numFreeVariables declaration.
Equations
- ps.numFreeVariables = Array.countP (fun (x : VariableParam) => x.isFreeVariable) ps
Instances For
The numHypotheses declaration.
Equations
- ps.numHypotheses = Array.countP (fun (x : VariableParam) => x.isHypothesis) ps
Instances For
The freeVarsBefore declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The BuildFormulaState type.
- attrDeclName : Lean.Name
The
attrDeclNamedeclaration. - hasEmptyInstance? : Bool
The
hasEmptyInstance?declaration. The
classParamsdeclaration.- variableParams : VariableParams
The
variableParamsdeclaration. - variableType : Lean.Expr
The
variableTypedeclaration. The
localVarsdeclaration.The
Intermediatesdeclaration.
Instances For
The removeNameSuffix declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Stripping the recognized suffixes from the anonymous name leaves it unchanged.
The attrDeclName declaration.
Equations
- BuildFormula.attrDeclName = do let __do_lift ← get pure __do_lift.attrDeclName
Instances For
The name declaration.
Equations
- BuildFormula.name = do let __do_lift ← get pure (BuildFormula.removeNameSuffix __do_lift.attrDeclName)
Instances For
The isFunction declaration.
Equations
- BuildFormula.isFunction = do let __do_lift ← Lean.getEnv let __do_lift_1 ← BuildFormula.name pure (__do_lift.contains (__do_lift_1 ++ `eu))
Instances For
The isRealizeIffStage declaration.
Equations
- BuildFormula.isRealizeIffStage = do let __do_lift ← BuildFormula.attrDeclName pure (__do_lift.lastComponentAsString == "realize_iff")
Instances For
The hasEmptyInstanceState declaration.
Equations
- BuildFormula.hasEmptyInstanceState = do let __do_lift ← get pure __do_lift.hasEmptyInstance?
Instances For
The classParams declaration.
Equations
- BuildFormula.classParams = do let __do_lift ← get pure __do_lift.classParams
Instances For
The variableParams declaration.
Equations
- BuildFormula.variableParams = do let __do_lift ← get pure __do_lift.variableParams
Instances For
The getHypothesis declaration.
Equations
- BuildFormula.getHypothesis i = do let __do_lift ← BuildFormula.variableParams pure (Array.filter (fun (x : VariableParam) => x.isHypothesis) __do_lift)[i]!.toTerm
Instances For
The freeVarsBefore declaration.
Equations
- BuildFormula.freeVarsBefore i = do let __do_lift ← BuildFormula.variableParams pure (__do_lift.freeVarsBefore i)
Instances For
The numFreeVars declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The numHypotheses declaration.
Equations
- BuildFormula.numHypotheses = do let __do_lift ← get pure __do_lift.variableParams.numHypotheses
Instances For
The numAllVars declaration.
Equations
- BuildFormula.numAllVars = do let __do_lift ← BuildFormula.classParams let __do_lift_1 ← BuildFormula.variableParams pure (2 + __do_lift.size + Array.size __do_lift_1)
Instances For
The variableType declaration.
Equations
- BuildFormula.variableType = do let __do_lift ← get pure __do_lift.variableType
Instances For
The Intermediates declaration.
Equations
- BuildFormula.termIntermediates = do let __do_lift ← get pure __do_lift.termIntermediates
Instances For
The addIntermediate declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The clearIntermediates declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The findVar declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The getIndexSeq declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The withNewVars declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The empty parameter list contributes no free variables.
The throwTranslateError declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The decomposeApp declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Translate a term-level subexpression into an intermediate index, using fuel to
bound the recursion (any fuel at least the expression depth suffices).
Equations
- One or more equations did not get rendered due to their size.
- BuildFormula.goTerm 0 e = BuildFormula.throwTranslateError e
- BuildFormula.goTerm fuel_2.succ (Lean.Expr.fvar fvarId) = BuildFormula.findVar (Lean.Expr.fvar fvarId)
- BuildFormula.goTerm fuel_2.succ e = BuildFormula.throwTranslateError e
Instances For
Translate a proposition into a BoundedFormula, using fuel to bound the
recursion (any fuel at least the expression depth suffices).
Equations
- One or more equations did not get rendered due to their size.
- BuildFormula.go 0 e = BuildFormula.throwTranslateError e
- BuildFormula.go fuel_2.succ e = BuildFormula.throwTranslateError e
Instances For
The checkSorry declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The addDeclSimple declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The explicitize declaration.
Equations
- BuildFormula.explicitize (Lean.Expr.lam name type body binderInfo) n.succ = Lean.Expr.lam name type (BuildFormula.explicitize body n) Lean.BinderInfo.default
- BuildFormula.explicitize x✝¹ x✝ = x✝¹
Instances For
The mkLambdaFVarsExplicit declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The init declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The simpFormulaPre declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The simpFormula declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The definitionProp declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The buildFormula declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The prefixIdents declaration.
Equations
- BuildFormula.prefixIdents typeLetter = #[Lean.mkIdent typeLetter.toName, Lean.mkIdent ("s" ++ typeLetter).toName]
Instances For
The prefix identifiers are exactly the carrier type and its structure instance.
The classIdents declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The varIdents declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The hypothesisIdents declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The identsBefore declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The allIdentsWithHypotheses declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The classParamBinders declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The mkBinders declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The mkTermApp declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The mkParam declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The mkBindersWithHypotheses declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The mkIdent' declaration.
Equations
- BuildFormula.mkIdent' name = Lean.mkIdent (`_root_ ++ name)
Instances For
The buildFunction declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The realizedTerm declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The buildRealizeIff declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The buildInstFormulaToFunction declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The mkVarVec declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The buildToRealize declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The buildElementarity declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The runIfNotFound declaration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Build all the Formula.Realize companion declarations for the decl attrDeclName
tagged with @[realize].
Equations
- One or more equations did not get rendered due to their size.