Sequence
Difficulty: moderate — 0 definitions, 0 abbreviations, 0 lemmas, 0 theorems, 0 examples.
Sequences written the way they are written on paper: \(a_1, \dots, a_n\), freely mixing single entries with stretches standing for many at once. This module gives that reading a notation, so a statement about a distinguished position in a sequence can be written directly.
Logic uses it for the premises and conclusions of a rule, but nothing here is about logic: an entry is anything at all, and a stretch is a list of them.
ToSeq
What may stand as one entry in a sequence: a single item, or a whole list of them. This is what lets the notation below mix the two.
structure ToSeq (α β : Type) : Type
Read the entry as a list.
toSeq : β → List α
instToSeq
instance instToSeq {α : Type} : ToSeq α α
Show details
| instToSeq = { toSeq := fun a => [a] }
Complexity: 19 (size of the value term)
Outer dependencies: ToSeq
Used by: Logic.Popper.Basis1.Demonstrable, Logic.Popper.Basis1.Demonstrate, Logic.Popper.Basis1.Follows, Logic.Popper.Basis1.IsClassicalNegation, Logic.Popper.Basis1.IsConjunction, Logic.Popper.Basis1.IsDisjunction, Logic.Popper.Basis1.IsImplication, Logic.Popper.Basis1.IsIntuitionisticNegation, Logic.Popper.Basis1.Refutable, Logic.Popper.Basis1.contract, Logic.Popper.Basis1.contradictory_of_isClassicalNegation, Logic.Popper.Basis1.contradictory_of_isIntuitionisticNegation, Logic.Popper.Basis1.cut, Logic.Popper.Basis1.demonstrate_congr_conclusion, Logic.Popper.Basis1.demonstrate_congr_premise, Logic.Popper.Basis1.demonstrate_cons_of_isConjunction, Logic.Popper.Basis1.demonstrate_cons_of_isDisjunction, Logic.Popper.Basis1.demonstrate_mono, Logic.Popper.Basis1.demonstrate_mp, Logic.Popper.Basis1.demonstrate_of_mem, Logic.Popper.Basis1.demonstrate_singleton, Logic.Popper.Basis1.exchange, Logic.Popper.Basis1.follows_refl, Logic.Popper.Basis1.follows_trans, Logic.Popper.Basis1.isClassicalNegation_congr, Logic.Popper.Basis1.isClassicalNegation_unique, Logic.Popper.Basis1.isConjunction_congr, Logic.Popper.Basis1.isConjunction_unique, Logic.Popper.Basis1.isDisjunction_congr, Logic.Popper.Basis1.isDisjunction_unique, Logic.Popper.Basis1.isImplication_congr, Logic.Popper.Basis1.isImplication_unique, Logic.Popper.Basis1.isIntuitionisticNegation_congr, Logic.Popper.Basis1.isIntuitionisticNegation_unique, Logic.Popper.Basis1.mutual_of_demonstrate, Logic.Popper.Basis1.substitutivity, Logic.Popper.Basis3.follows_toBasis1, Logic.PropositionalLogic.Formula.demonstrate_semantic_iff_syntactic, Logic.PropositionalLogic.Formula.semantic_iff_provable, Logic.PropositionalLogic.Formula.syntactic_iff_provable, Logic.PropositionalLogic.semanticConnectives, Logic.PropositionalLogic.syntacticConnectives, toSeq_single
instToSeqList
instance instToSeqList {α : Type} : ToSeq α (List α)
Show details
| instToSeqList = { toSeq := fun P => P }
Complexity: 15 (size of the value term)
Outer dependencies: ToSeq
Lean core dependencies: List
Used by: Logic.Popper.Basis1.Demonstrate, Logic.Popper.Basis1.IsImplication, Logic.Popper.Basis1.contract, Logic.Popper.Basis1.contradictory_of_isClassicalNegation, Logic.Popper.Basis1.cut, Logic.Popper.Basis1.demonstrate_congr_conclusion, Logic.Popper.Basis1.demonstrate_congr_premise, Logic.Popper.Basis1.demonstrate_cons_of_isConjunction, Logic.Popper.Basis1.demonstrate_cons_of_isDisjunction, Logic.Popper.Basis1.demonstrate_mono, Logic.Popper.Basis1.demonstrate_mp, Logic.Popper.Basis1.demonstrate_of_mem, Logic.Popper.Basis1.demonstrate_singleton, Logic.Popper.Basis1.exchange, Logic.Popper.Basis1.isClassicalNegation_congr, Logic.Popper.Basis1.isConjunction_congr, Logic.Popper.Basis1.isDisjunction_congr, Logic.Popper.Basis1.isImplication_congr, Logic.Popper.Basis1.isImplication_unique, Logic.Popper.Basis1.isIntuitionisticNegation_congr, Logic.Popper.Basis1.weaken, Logic.ProofTheory.CutFree, Logic.ProofTheory.CutFree.DerivationsOf, Logic.ProofTheory.CutFree.DerivationsOf.graft, Logic.ProofTheory.CutFree.DerivationsOf.mono, Logic.ProofTheory.CutFree.DerivationsOf.of_forall, Logic.ProofTheory.CutFree.DerivationsOf.toDerivationsOf, Logic.ProofTheory.CutFree.toDerivation, Logic.ProofTheory.Derivation.toCutFree, Logic.ProofTheory.Schema.instance, Logic.PropositionalLogic.derivable_mp, Logic.PropositionalLogic.semanticConnectives, Logic.PropositionalLogic.syntacticConnectives, toSeq_list
toSeq_single
toSeq_list
A list contributes all of its items, spliced in.
theorem toSeq_list {α : Type} (P : List α) : ⟪P⟫ = P
Show details
fun {α} P => rfl
Complexity: 25 (size of the value term)
Dependencies: instToSeqList
Used by: (none)
«term⟪_⟫»
A sequence written as \(a_1, \dots, a_n\), mixing single items with stretches standing for many: whatever entry is a list is spliced in, and whatever entry is a single item contributes just itself.
def «term⟪_⟫» : ParserDescr
Show details
| «term⟪_⟫» = ParserDescr.node `«term⟪_⟫» 1024 (ParserDescr.binary `andthen (ParserDescr.binary `andthen (ParserDescr.symbol "⟪") ((ParserDescr.cat `term 0).sepBy "," (ParserDescr.symbol ", "))) (ParserDescr.symbol "⟫"))
Complexity: 61 (size of the value term)
Outer dependencies: (none)
Lean core dependencies: Lean.Name.mkStr1, Lean.ParserDescr, Nat
Used by: (none)
unexpandToSeq
Print a lone entry back as a one-element sequence.
def unexpandToSeq : PrettyPrinter.Unexpander
Show details
| unexpandToSeq x✝ = if x✝.isOfKind `Lean.Parser.Term.app = true then have __discr := x✝.getArg 0; have __discr := x✝.getArg 1; if __discr.matchesNull 1 = true then have __discr := __discr.getArg 0; have x := { raw := __discr }; do let info ← MonadRef.mkInfoFromRefPos let _ ← getCurrMacroScope let _ ← MonadQuotation.getContext pure { raw := Syntax.node3 info `«term⟪_⟫» (Syntax.atom info "⟪") (Syntax.node1 info `null x.raw) (Syntax.atom info "⟫") }.raw else have __discr := x✝.getArg 1; throw () else have __discr := x✝; throw ()
Complexity: 490 (size of the value term)
Outer dependencies: (none)
Lean core dependencies: Bool, EStateM, Eq, Lean.MacroScope, Lean.MonadRef.mkInfoFromRefPos, Lean.Name, Lean.Name.mkStr1, Lean.Name.mkStr4, Lean.PrettyPrinter.UnexpandM, Lean.PrettyPrinter.Unexpander, Lean.SourceInfo, Lean.Syntax, Lean.Syntax.getArg, Lean.Syntax.isOfKind, Lean.Syntax.matchesNull, Lean.Syntax.node1, Lean.Syntax.node3, Lean.SyntaxNodeKind, Lean.TSyntax, Nat, PUnit, Unit, Unit.unit, ite
Used by: (none)
unexpandSeqAppend
Print two adjacent sequences back as one, so a whole sequence prints as it was written.
def unexpandSeqAppend : PrettyPrinter.Unexpander
Show details
| unexpandSeqAppend x✝ = if x✝.isOfKind `Lean.Parser.Term.app = true then have __discr := x✝.getArg 0; have __discr := x✝.getArg 1; if __discr.matchesNull 2 = true then have __discr_1 := __discr.getArg 0; if __discr_1.isOfKind `«term⟪_⟫» = true then have __discr_2 := __discr_1.getArg 0; have __discr_3 := __discr_1.getArg 1; have __discr_4 := __discr_1.getArg 2; have __discr_5 := __discr.getArg 1; if __discr_5.isOfKind `«term⟪_⟫» = true then have __discr := __discr_5.getArg 0; have __discr := __discr_5.getArg 1; have __discr_6 := __discr_5.getArg 2; have ys := { elemsAndSeps := __discr.getArgs }; have xs := { elemsAndSeps := __discr_3.getArgs }; have entries := xs.getElems ++ ys.getElems; do let info ← MonadRef.mkInfoFromRefPos let _ ← getCurrMacroScope let _ ← MonadQuotation.getContext pure { raw := Syntax.node3 info `«term⟪_⟫» (Syntax.atom info "⟪") (Syntax.node info `null (#[].append (Syntax.TSepArray.ofElems entries).elemsAndSeps)) (Syntax.atom info "⟫") }.raw else have __discr := __discr.getArg 1; throw () else have __discr_2 := __discr.getArg 0; have __discr := __discr.getArg 1; throw () else have __discr := x✝.getArg 1; throw () else have __discr := x✝; throw ()
Complexity: 976 (size of the value term)
Outer dependencies: (none)
Lean core dependencies: Array.append, Array.mkArray0, Bool, EStateM, Eq, Lean.MacroScope, Lean.MonadRef.mkInfoFromRefPos, Lean.Name, Lean.Name.mkStr1, Lean.Name.mkStr4, Lean.PrettyPrinter.UnexpandM, Lean.PrettyPrinter.Unexpander, Lean.SourceInfo, Lean.Syntax, Lean.Syntax.TSepArray, Lean.Syntax.TSepArray.getElems, Lean.Syntax.TSepArray.ofElems, Lean.Syntax.getArg, Lean.Syntax.getArgs, Lean.Syntax.isOfKind, Lean.Syntax.matchesNull, Lean.Syntax.node3, Lean.SyntaxNodeKind, Lean.TSyntax, Lean.TSyntaxArray, Nat, PUnit, Unit, Unit.unit, ite
Used by: (none)
Dependency diagram
Drag to pan, Ctrl+scroll (or Cmd+scroll, or pinch on a touch screen) to zoom, click a node to jump to it.