Lean core references

Every Lean core declaration referred to directly by this project’s own code, grouped by the module it comes from.

definition abbreviation theorem
legend

BinderNameHint

The expression binderNameHint v binder e defined to be e.

If it is used on the right-hand side of an equation that is used for rewriting by rw or simp, and v is a local variable, and binder is an expression that (after beta-reduction) is a binder (fun w => … or ∀ w, …), then it will rename v to the name used in that binder, and remove the binderNameHint.

A typical use of this gadget would be as follows; the gadget ensures that after rewriting, the local variable is still name, and not x:

theorem all_eq_not_any_not (l : List α) (p : α → Bool) :
    l.all p = !l.any fun x => binderNameHint x p (!p x) := sorry

example (names : List String) : names.all (fun name => "Waldo".isPrefixOf name) = true := by
  rw [all_eq_not_any_not]
  -- ⊢ (!names.any fun name => !"Waldo".isPrefixOf name) = true

If binder is not a binder, then the name of v attains a macro scope. This only matters when the resulting term is used in a non-hygienic way, e.g. in termination proofs for well-founded recursion.

This gadget is supported by * simp, dsimp and rw in the right-hand-side of an equation * simp in the assumptions of congruence rules

It is ineffective in other positions (hypotheses of rewrite rules) or when used by other tactics (e.g. apply).

def binderNameHint.{u, v, w} {α : Sort u} {β : Sort v} {γ : Sort w} (v : α) (binder : β) (e : γ) : γ

ByCases

theorem if_true.{u_1} {α : Sort u_1} {x✝ : Decidable True} (t e : α) : (if True then t else e) = t

Classical

theorem Classical.byContradiction {p : Prop} (h : ¬p → False) : p

Given that there exists an element satisfying p, returns one such element.

This is a straightforward consequence of, and equivalent to, Classical.choice.

See also choose_spec, which asserts that the returned value has property p.

def Classical.choose.{u} {α : Sort u} {p : α → Prop} (h : ∃ x, p x) : α
theorem Classical.choose_spec.{u} {α : Sort u} {p : α → Prop} (h : ∃ x, p x) : p (Classical.choose h)
theorem Classical.not_forall.{u_1} {α : Sort u_1} {p : α → Prop} : (¬∀ (x : α), p x) ↔ ∃ x, ¬p x
theorem Classical.or_iff_not_imp_left {a b : Prop} : a ∨ b ↔ ¬a → b

Extract an element from an existential statement, using Classical.choose.

def Exists.choose.{u_1} {α : Sort u_1} {p : α → Prop} (P : ∃ a, p a) : α

Show that an element extracted from P : ∃ a, p a using P.choose satisfies p.

theorem Exists.choose_spec.{u_1} {α : Sort u_1} {p : α → Prop} (P : ∃ a, p a) : p P.choose

Control.Id

The identity function on types, used primarily for its Monad instance.

The identity monad is useful together with monad transformers to construct monads for particular purposes. Additionally, it can be used with do-notation in order to use control structures such as local mutability, for-loops, and early returns in code that does not otherwise use monads.

Examples: lean example def containsFive (xs : List Nat) : Bool := Id.run do for x in xs do if x == 5 then return true return false

lean example #eval containsFive [1, 3, 5, 7]

true
def Id.{u} (type : Type u) : Type u

Runs a computation in the identity monad.

This function is the identity function. Because its parameter has type Id α, it causes do-notation in its arguments to use the Monad Id instance.

def Id.run.{u_1} {α : Type u_1} (x : Id α) : α

Core

theorem Bool.of_not_eq_true {b : Bool} : ¬b = true → b = false

Empty.elim : Empty → C says that a value of any type can be constructed from Empty. This can be thought of as a compiler-checked assertion that a code path is unreachable.

def Empty.elim.{u} {C : Sort u} : Empty → C

If h : α = β is a proof of type equality, then h.mp : α → β is the induced “cast” operation, mapping elements of α to elements of β.

You can prove theorems about the resulting element by induction on h, since rfl.mp is definitionally the identity function.

def Eq.mp.{u} {α β : Sort u} (h : α = β) (a : α) : β

Used by: BitFunction.exists_settle, BitFunction.iterate_stays, BitSequence.trueCount_strict, Channel.lossless_stationary, Channel.lossy_loses_overall, Component.Simplex.toInformationSystem, Component.monoidalCategory, Component.parallel, Component.sequential, Frame.crc32Ethernet_detects_single_bit_flip, Frame.crcFrom_detects_single_bit_flip, Frame.eq_of_associated_gf2, Frame.generator_not_dvd_pow, Frame.pos_length_of_any, Frame.toPoly_ne_zero_of_any, Frame.toPoly_xor, InformationSystem.Chain.ofIsChain, InformationSystem.Environment.universe, InformationSystem.Step.bottom, InformationSystem.Step.delta_alt, InformationSystem.Step.gains, InformationSystem.Step.loses, InformationSystem.eval_delta, InformationSystem.gatedFlow_success_AB, InformationSystem.gatedFlow_success_BA, InformationSystem.roundtrip_neutral, InformationSystem.spontaneous_no_self_return, InformationSystem.toSimplex, InformationSystem.zero_run_le, InterfaceOld.Value.join, InterfaceOld.Value.join_disjoint, InterfaceOld.tensor, Layer.eq_toFun_of_univalent, Layer.id_sequential, Layer.sequential_id, Layer.trace_superposing, Layer.trace_vanishing, Logic.FirstOrderLogic.hasExistential, Logic.FirstOrderLogic.hasUniversal, Logic.FirstOrderLogic.realize_all, Logic.FirstOrderLogic.realize_ex, Logic.FirstOrderLogic.realize_nonDep_update, Logic.FirstOrderLogic.realize_update_of_nonDep, Logic.Popper.Basis1.contract, Logic.Popper.Basis1.demonstrate_congr_premise, Logic.Popper.Basis1.demonstrate_singleton, Logic.Popper.Basis1.exchange, Logic.Popper.Basis1.follows_trans, Logic.Popper.Basis3.follows_toBasis1, Logic.ProofTheory.CutFree.DerivationsOf.graft, Logic.ProofTheory.CutFree.DerivationsOf.mono, Logic.ProofTheory.Schema.IsSimpleRule.of_isAxiom, Logic.PropositionalLogic.Formula.and_entails_left, Logic.PropositionalLogic.Formula.and_entails_right, Logic.PropositionalLogic.Formula.completeness, Logic.PropositionalLogic.Formula.eliminate, Logic.PropositionalLogic.Formula.entails_and_iff, Logic.PropositionalLogic.Formula.entails_of_entails_neg_contra, Logic.PropositionalLogic.Formula.kalmar, Logic.PropositionalLogic.Formula.semantic_iff_provable, Logic.PropositionalLogic.Formula.soundness, Logic.PropositionalLogic.semanticConnectives, Logic.PropositionalLogic.syntacticConnectives, SeqColimit.freshSeq_lt_ne, Structure.Arithmetic.S_iff_add_one, Structure.Arithmetic.Tower.sigmaLe_up, Structure.Arithmetic.Tower.stepTo_initial, Structure.Arithmetic.Tower.ι_le_iff, Structure.Arithmetic.exists_S_of_not_Z, Structure.Arithmetic.finTower, Structure.Arithmetic.fixedPoint_iter, Structure.Arithmetic.instDefS, Structure.Arithmetic.instUnivalentlyPrimitiveOfUnivalent, Structure.Arithmetic.orbit_subset, Structure.Arithmetic.rec_step, Topology.Step.coverageFunctor, Topology.isNerveCover_inter, Topology.join_preserves_connected, Topology.whole_adj_of_internal, arithPlus_iff, arithPlus_mk_eq, arithSuccFun_injective, arithSucc_functional, arithSucc_iff, arithSucc_mk_eq, irrational_logb_two_five, irrational_logb_two_three, irrational_phoneNumberInformation, no_pow_two_eq_pow_five, no_pow_two_eq_pow_three

If h : α = β is a proof of type equality, then h.mpr : β → α is the induced “cast” operation in the reverse direction, mapping elements of β to elements of α.

You can prove theorems about the resulting element by induction on h, since rfl.mpr is definitionally the identity function.

def Eq.mpr.{u} {α β : Sort u} (h : α = β) (b : β) : α

Used by: BitFunction.cardinality, BitFunction.cardinality_input_growth, BitFunction.cardinality_output_growth, BitFunction.fixedPoint_isFixed, BitFunction.iterate_dominates_succ, BitFunction.iterate_settles, BitFunction.iterate_stays, BitSequence.cardinality, BitSequence.trueCount_strict, Cell.erase_not_surjective, Channel.lossless_stationary, Channel.lossy_loses_overall, Component.Hom.comp_eqToHom, Component.Hom.eqToHom_comp, Component.Hom.recast_recast, Component.Hom.tensor_id_id, Component.Hom.tensor_recast_left, Component.Hom.tensor_recast_right, Component.Simplex.toInformationSystem, Component.braidedCategory, Component.braiding_naturality_left, Component.braiding_naturality_right, Component.empty_parallel, Component.equivalent_of_stationary, Component.hexagon_forward_arrow, Component.hexagon_reverse_arrow, Component.id_sequential, Component.interchange, Component.monoidalCategory, Component.parallel, Component.parallel_assoc, Component.parallel_comm, Component.parallel_congr, Component.parallel_empty, Component.recast, Component.recast_congr, Component.sequential, Component.sequential_assoc, Component.sequential_congr, Component.sequential_id, Component.symmetry, Component.symmetry_symmetry, Discrete.pi, Discrete.prod, Fin.append_eval, Frame.crcFrom_detects_single_bit_flip, Frame.crcStep_length, Frame.crcStep_poly, Frame.crc_poly_dvd, Frame.eq_of_associated_gf2, Frame.generator_not_dvd_pow, Frame.ofFn_update, Frame.toPoly, Frame.toPoly_append, Frame.toPoly_degree_lt, Frame.toPoly_ne_zero_of_any, Frame.toPoly_set_flip, Frame.toPoly_xor, Heap.combine_at_left, Heap.combine_at_right, Heap.create_delete, InformationSystem.Environment.universe, InformationSystem.Step.bottom, InformationSystem.Step.delta_alt, InformationSystem.Step.gains, InformationSystem.Step.loses, InformationSystem.eval, InformationSystem.eval_delta, InformationSystem.exists_repeat_equivalent, InformationSystem.gatedFlow, InformationSystem.gatedFlow_success_AB, InformationSystem.gatedFlow_success_BA, InformationSystem.irreversible, InformationSystem.parallel_delta, InformationSystem.roundtrip_neutral, InformationSystem.spontaneous_no_self_return, InformationSystem.toSimplex, InformationSystem.zero_run_le, InterfaceOld.Value.ext_of_fired_eq, InterfaceOld.Value.join, InterfaceOld.Value.join_disjoint, InterfaceOld.tensor, InterfaceOld.unit.Value.subsingleton, Layer.id_sequential, Layer.sequential_assoc, Layer.sequential_id, Layer.trace_naturality_left, Layer.trace_naturality_right, Layer.trace_sliding, Layer.trace_superposing, Layer.trace_vanishing, Layer.trace_yanking, Logic.FirstOrderLogic.basis3ext, Logic.FirstOrderLogic.exists_fresh_ne, Logic.FirstOrderLogic.hasExistential, Logic.FirstOrderLogic.hasUniversal, Logic.FirstOrderLogic.realize_SUB, Logic.FirstOrderLogic.realize_all, Logic.FirstOrderLogic.realize_ex, Logic.FirstOrderLogic.realize_update_of_nonDep, Logic.FirstOrderLogic.realize_update_of_not_mem_freeVarFinset, Logic.Popper.Basis1.contract, Logic.Popper.Basis1.contradictory_of_isClassicalNegation, Logic.Popper.Basis1.demonstrate_cons_of_isConjunction, Logic.Popper.Basis1.demonstrate_cons_of_isDisjunction, Logic.Popper.Basis1.demonstrate_of_mem, Logic.Popper.Basis1.exchange, Logic.ProofTheory.CutFree.DerivationsOf.mono, Logic.ProofTheory.Derivation.toCutFree, Logic.PropositionalLogic.Formula.and_entails_left, Logic.PropositionalLogic.Formula.and_entails_right, Logic.PropositionalLogic.Formula.demonstrate_semantic_iff_syntactic, Logic.PropositionalLogic.Formula.dnf_val, Logic.PropositionalLogic.Formula.entails_and_iff, Logic.PropositionalLogic.Formula.kalmar, Logic.PropositionalLogic.Formula.minterm_val, Logic.PropositionalLogic.Formula.semantic_iff_provable, Logic.PropositionalLogic.Formula.syntactic_iff_provable, Logic.PropositionalLogic.Formula.val, Logic.PropositionalLogic.NandFormula.ofFormula, Logic.PropositionalLogic.NandFormula.toFormula, Logic.PropositionalLogic.NandFormula.val, Logic.PropositionalLogic.semanticConnectives, Logic.PropositionalLogic.syntacticConnectives, SeqColimit.Rel.trans, SeqColimit.mk_stepTo, Specification.closed, Specification.terminalCone, Structure.Arithmetic.S_iff_add_one, Structure.Arithmetic.Tower.exists_of_le_ι, Structure.Arithmetic.Tower.instInfiniteColimit, Structure.Arithmetic.Tower.instOrderBotColimit, Structure.Arithmetic.Tower.lt_card_level, Structure.Arithmetic.Tower.same_trans, Structure.Arithmetic.Tower.sigmaLe_congr, Structure.Arithmetic.Tower.stepTo_bot, Structure.Arithmetic.Tower.stepTo_le_iff, Structure.Arithmetic.Tower.ι_le_iff, Structure.Arithmetic.count_strictMono, Structure.Arithmetic.count_surjective, Structure.Arithmetic.exists_S_of_not_Z, Structure.Arithmetic.finTower, Structure.Arithmetic.fixedPoint_iter, Structure.Arithmetic.instDefForallForallPropFixedPointOfPredicative, Structure.Arithmetic.instDefForallForallPropFixedPointPrimitiveOfSerialOfUnivalent, Structure.Arithmetic.instSerialRecPrimitive, Structure.Arithmetic.instUnivalentRecPrimitive, Structure.Arithmetic.iter_base, Structure.Arithmetic.iter_step, Structure.Arithmetic.lt_wf, Structure.Arithmetic.rec_base, Structure.Arithmetic.rec_step, Topology.isNerveCover_inter, Topology.join_preserves_connected, Topology.step_conserves, Topology.whole_adj_of_internal, Topology.whole_adj_of_link, Tower.card_lt_stepNeg, Tower.card_lt_stepPos, arithFromNat_toNat, arithPlus_iff, arithPlus_succ, arithPlus_zero, arithStepTo_val, arithStruct_congr, arithSucc_functional, arithSucc_iff, arithSucc_iff_eq_succFun, arithSucc_no_fixed_point, arithToNat, arithTranslatePos_stepTo_eq, arithZero_not_succ, arithZero_unique, irrational_logb_two_five, irrational_logb_two_three, irrational_phoneNumberInformation, irrational_trafficLightInformation, no_pow_two_eq_pow_five, no_pow_two_eq_pow_three, phoneNumberInformation_eq, phoneNumber_bits_needed, phoneNumber_cardinality, trafficLightInformation_eq, trafficLight_approx_two_bits

Existential quantification. If p : α → Prop is a predicate, then ∃ x : α, p x asserts that there is some x of type α such that p x holds. To create an existential proof, use the exists tactic, or the anonymous constructor notation ⟨x, h⟩. To unpack an existential, use cases h where h is a proof of ∃ x : α, p x, or let ⟨x, hx⟩ := h where `.

Because Lean has proof irrelevance, any two proofs of an existential are definitionally equal. One consequence of this is that it is impossible to recover the witness of an existential from the mere fact of its existence. For example, the following does not compile:

example (h : ∃ x : Nat, x = x) : Nat :=
  let ⟨x, _⟩ := h  -- fail, because the goal is `Nat : Type`
  x

The error message recursor 'Exists.casesOn' can only eliminate into Prop means that this only works when the current goal is another proposition:

example (h : ∃ x : Nat, x = x) : True :=
  let ⟨x, _⟩ := h  -- ok, because the goal is `True : Prop`
  trivial
inductive Exists.{u} {α : Sort u} (p : α → Prop) : Prop

Used by: BitFunction.exists_isFixedPoint, BitFunction.exists_settle, BitFunction.iterate_settles, Channel.lossy_loses_overall, Class.Active, Class.not_reactive_and_active, Class.reachable, Discrete, Finset.sum_preimage_map_disjUnion, Frame.eq_of_associated_gf2, Frame.generator_not_dvd_pow, Frame.toPoly_ne_zero_of_any, Heap.mem_reachable, Heap.reachable, HeapCover.whole, HeapCover.whole_at, InformationSystem.exists_repeat_equivalent, InformationSystem.exists_repeat_state, InformationSystem.natural, InformationSystem.not_spontaneous_and_perpetuous, InformationSystem.perpetuous, InformationSystem.perpetuous_coherent, InformationSystem.reversible, InterfaceOld.Value.join, InterfaceOld.Value.join_disjoint, InterfaceOld.Value.join_fired_inl, InterfaceOld.Value.join_fired_inr, Layer.Realizable, Layer.loop, Layer.sequential, Layer.sequential_assoc, Layer.sequential_rel, Layer.trace, Layer.trace_naturality_left, Layer.trace_naturality_right, Layer.trace_sliding, Layer.trace_superposing, Layer.trace_vanishing, Layer.trace_yanking, Logic.FirstOrderLogic.basis3ext, Logic.FirstOrderLogic.exists_fresh_ne, Logic.FirstOrderLogic.hasExistential, Logic.FirstOrderLogic.hasUniversal, Logic.FirstOrderLogic.realize_ex, Logic.FirstOrderLogic.realize_nonDep_update, Logic.Popper.Basis1.IsExistential, Logic.Popper.Basis1.IsUniversal, Logic.Popper.HasSubstitution, Logic.ProofTheory.CutFree.toDerivation, Logic.ProofTheory.Derivation.toCutFree, Logic.ProofTheory.Instances, Logic.PropositionalLogic.Formula.bigOr_val, Logic.PropositionalLogic.Formula.dnf_val, Logic.PropositionalLogic.Formula.exists_andOrNot_of_boolFun, Logic.PropositionalLogic.Formula.kalmar, Logic.PropositionalLogic.NandFormula.exists_nand_of_boolFun, Logic.PropositionalLogic.derivable_mp, Logic.PropositionalLogic.derivation_of_axiom, NetworkLayer.resolves, SeqColimit.Rel, SeqColimit.Rel.refl, SeqColimit.Rel.symm, SeqColimit.Rel.trans, SeqColimit.exists_not_mem_range, SeqColimit.freshSeq_lt_ne, SeqColimit.mk_injective, SeqColimit.mk_stepTo, Structure.Arithmetic.Def, Structure.Arithmetic.NonPeano, Structure.Arithmetic.Primitive, Structure.Arithmetic.Serial, Structure.Arithmetic.Tower, Structure.Arithmetic.Tower.Same, Structure.Arithmetic.Tower.SigmaLe, Structure.Arithmetic.Tower.exists_of_le_ι, Structure.Arithmetic.Tower.instArithColimit, Structure.Arithmetic.Tower.instNontrivialColimit, Structure.Arithmetic.Tower.instOrderBotColimit, Structure.Arithmetic.Tower.instPeanoColimit, Structure.Arithmetic.Tower.lt_card_level, Structure.Arithmetic.Tower.same_refl, Structure.Arithmetic.Tower.same_symm, Structure.Arithmetic.Tower.same_trans, Structure.Arithmetic.Tower.sigmaLe_antisymm, Structure.Arithmetic.Tower.sigmaLe_congr, Structure.Arithmetic.Tower.sigmaLe_refl, Structure.Arithmetic.Tower.sigmaLe_total, Structure.Arithmetic.Tower.sigmaLe_trans, Structure.Arithmetic.Tower.sigmaLe_up, Structure.Arithmetic.Tower.stepTo_initial, Structure.Arithmetic.Tower.ι_le_iff, Structure.Arithmetic.Tower.ι_stepTo, Structure.Arithmetic.count_surjective, Structure.Arithmetic.exists_S_of_not_Z, Structure.Arithmetic.exp_step, Structure.Arithmetic.finTower, Structure.Arithmetic.fixedPoint_iter, Structure.Arithmetic.instArithFin, Structure.Arithmetic.instDefForallForallPropFixedPointPrimitiveOfSerialOfUnivalent, Structure.Arithmetic.instDefS, Structure.Arithmetic.instTotallyPrimitiveOfSerial, Structure.Arithmetic.instUnivalentlyPrimitiveOfUnivalent, Structure.Arithmetic.lt_wf, Structure.Arithmetic.orbit_subset, Structure.Arithmetic.plus_step, Structure.Arithmetic.rec_base, Structure.Arithmetic.rec_step, Structure.Arithmetic.terminates_iff_bounded, Structure.Arithmetic.terminates_of_halts, Structure.Arithmetic.times_step, Structure.Arithmetic.ultrafinitism, Topology.IsNerveCover, Topology.isNerveCover_inter, Topology.nerveCoverage, Topology.restrictPresieve, Topology.whole, Topology.whole_adj_of_internal, Topology.whole_adj_of_link, Tower, Tower.heapBot, Tower.heapTop, Tower.structBot, Tower.structTop, TransportLayer.application, arithFromNat_toNat, arithPlus_iff, arithStepNeg_not_surjective, arithSucc_iff, arithToNat, arithTower, arithZero_unique, castSucc_not_surjective, doorBehavior, doorHeap.closed_reachable, doorHeap.opened_reachable, notRule_no_fixedPoint

An indication of whether a loop’s body terminated early that’s used to compile the for x in xs notation.

A collection’s ForIn or ForIn' instance describes how to iterate over its elements. The monadic action that represents the body of the loop returns a ForInStep α, where α is the local state used to implement features such as let mut.

inductive ForInStep.{u} (α : Type u) : Type u

If and only if, or logical bi-implication. a ↔︎ b means that a implies b and vice versa. By propext, this implies that a and b are equal and hence any expression involving a is equivalent to the corresponding expression with b instead.

Conventions for notations in identifiers:

  • The recommended spelling of ↔︎ in identifiers is iff.

  • The recommended spelling of <-> in identifiers is iff (prefer ↔︎ over <->).

structure Iff (a b : Prop) : Prop

Used by: BitSequence.trueCount_strict, Finset.sum_preimage_map_disjUnion, Heap.create_delete, InformationSystem.Step.gains, InformationSystem.Step.loses, InformationSystem.gatedFlow_success_AB, InformationSystem.gatedFlow_success_BA, InterfaceOld.Value.ext_of_fired_eq, InterfaceOld.Value.join, InterfaceOld.Value.join_fired_inl, InterfaceOld.Value.join_fired_inr, InterfaceOld.tensor, Layer.id_rel, Layer.parallel_rel, Layer.sequential_rel, Logic.FirstOrderLogic.basis3ext, Logic.FirstOrderLogic.exists_fresh_ne, Logic.FirstOrderLogic.hasExistential, Logic.FirstOrderLogic.hasUniversal, Logic.FirstOrderLogic.mutual_of_realize_iff, Logic.FirstOrderLogic.realize_SUB, Logic.FirstOrderLogic.realize_all, Logic.FirstOrderLogic.realize_ex, Logic.FirstOrderLogic.realize_iff_of_mutual, Logic.FirstOrderLogic.realize_nonDep_update, Logic.FirstOrderLogic.realize_update_of_not_mem_freeVarFinset, Logic.Popper.Basis1.IsClassicalNegation, Logic.Popper.Basis1.IsConjunction, Logic.Popper.Basis1.IsDisjunction, Logic.Popper.Basis1.IsExistential, Logic.Popper.Basis1.IsImplication, Logic.Popper.Basis1.IsIntuitionisticNegation, Logic.Popper.Basis1.IsUniversal, Logic.Popper.Basis1.demonstrate_cons_of_isConjunction, Logic.Popper.Basis1.demonstrate_cons_of_isDisjunction, Logic.Popper.Basis1.demonstrate_singleton, Logic.Popper.Basis1.instHasExistentialNatUnitTotalBasis1InferInstanceHasSubstitutionMutual, Logic.Popper.Basis1.instHasUniversalNatUnitTotalBasis1InferInstanceHasSubstitutionMutual, Logic.Popper.Basis1.substitutivity, Logic.Popper.Basis3.follows_toBasis1, Logic.ProofTheory.derivable_iff_derivableCutFree, Logic.PropositionalLogic.Formula.bigAnd_val, Logic.PropositionalLogic.Formula.bigOr_val, Logic.PropositionalLogic.Formula.demonstrate_bigAnd_cons, Logic.PropositionalLogic.Formula.demonstrate_bigOr_cons, Logic.PropositionalLogic.Formula.demonstrate_semantic_iff_syntactic, Logic.PropositionalLogic.Formula.dnf_val, Logic.PropositionalLogic.Formula.entails_and_iff, Logic.PropositionalLogic.Formula.entails_and_iff_syntactic, Logic.PropositionalLogic.Formula.exists_andOrNot_of_boolFun, Logic.PropositionalLogic.Formula.literal_val, Logic.PropositionalLogic.Formula.minterm_val, Logic.PropositionalLogic.Formula.semantic_iff_provable, Logic.PropositionalLogic.Formula.syntactic_iff_provable, Logic.PropositionalLogic.semanticConnectives, Logic.PropositionalLogic.syntacticConnectives, Receiver.step_correct, Structure.Arithmetic.S_iff_add_one, Structure.Arithmetic.S_iff_succ, Structure.Arithmetic.Tower.stepTo_le_iff, Structure.Arithmetic.Tower.step_le_iff, Structure.Arithmetic.Tower.ι_le_iff, Structure.Arithmetic.Z_iff_zero, Structure.Arithmetic.Z_iff_zero_fin, Structure.Arithmetic.exp_base, Structure.Arithmetic.exp_step, Structure.Arithmetic.fixedPoint_iter, Structure.Arithmetic.instDefForallForallPropFixedPointPrimitiveOfSerialOfUnivalent, Structure.Arithmetic.plus_base, Structure.Arithmetic.plus_step, Structure.Arithmetic.rec_base, Structure.Arithmetic.rec_step, Structure.Arithmetic.terminates_iff_bounded, Structure.Arithmetic.times_base, Structure.Arithmetic.times_step, Structure.Arithmetic.ultrafinitism, Topology.join_preserves_connected, Tower, arithPlus_iff, arithPlus_succ, arithStruct_congr, arithSucc_iff, arithSucc_iff_eq_succFun, arithTower

theorem Iff.of_eq {a b : Prop} (h : a = b) : a ↔ b

Used by: arithTower

theorem Iff.symm {a b : Prop} (h : a ↔ b) : b ↔ a

The inverse image of r : β → β → Prop by a function α → β is the relation s : α → α → Prop defined by s a b = r (f a) (f b).

def InvImage.{u, v} {α : Sort u} {β : Sort v} (r : β → β → Prop) (f : α → β) : α → α → Prop
theorem Nat.add_zero (n : ℕ) : n + 0 = n

a ≠ b, or Ne a b is defined as ¬ (a = b) or a = b → False, and asserts that a and b are not equal.

Conventions for notations in identifiers:

  • The recommended spelling of ≠ in identifiers is ne.
def Ne.{u} {α : Sort u} (a b : α) : Prop

Fully universe-polymorphic dependent pairs, in which the second element’s type depends on the value of the first element and both types are allowed to be propositions. The type PSigma β is typically written Σ' a : α, β a or (a : α) ×' β a.

In practice, this generality leads to universe level constraints that are difficult to solve, so PSigma is rarely used in manually-written code. It is usually only used in automation that constructs pairs of arbitrary types.

To pair a value with a proof that a predicate holds for it, use Subtype. To demonstrate that a value exists that satisfies a predicate, use Exists. A dependent pair with a proposition as its first component is not typically useful due to proof irrelevance: there’s no point in depending on a specific proof because all proofs are equal anyway.

structure PSigma.{u, v} {α : Sort u} (β : α → Sort v) : Sort (max (max 1 u) v)

The disjoint union of arbitrary sorts α β, or α ⊕' β.

It differs from α ⊕ β in that it allows α and β to have arbitrary sorts Sort u and Sort v, instead of restricting them to Type u and Type v. This means that it can be used in situations where one side is a proposition, like True ⊕' Nat. However, the resulting universe level constraints are often more difficult to solve than those that result from Sum.

inductive PSum.{u, v} (α : Sort u) (β : Sort v) : Sort (max (max 1 u) v)

Quotient types coarsen the propositional equality for a type so that terms related by some equivalence relation are considered equal. The equivalence relation is given by an instance of Setoid.

Set-theoretically, Quotient s can seen as the set of equivalence classes of α modulo the Setoid instance’s relation s.r. Functions from Quotient s must prove that they respect s.r: to define a function f : Quotient s → β, it is necessary to provide f' : α → β and prove that for all x : α and y : α, s.r x y → f' x = f' y. Quotient.lift implements this operation.

The key quotient operators are: * Quotient.mk places elements of the underlying type α into the quotient. * Quotient.lift allows the definition of functions from the quotient to some other type. * Quotient.sound asserts the equality of elements related by r * Quotient.ind is used to write proofs about quotients by assuming that all elements are constructed with Quotient.mk.

Quotient is built on top of the primitive quotient type Quot, which does not require a proof that the relation is an equivalence relation. Quotient should be used instead of Quot for relations that actually are equivalence relations.

def Quotient.{u} {α : Sort u} (s : Setoid α) : Sort u

If two values are equal in a quotient, then they are related by its equivalence relation.

theorem Quotient.exact.{u} {α : Sort u} {s : Setoid α} {a b : α} : ⟦a⟧ = ⟦b⟧ → a ≈ b

A reasoning principle for quotients that allows proofs about quotients to assume that all values are constructed with Quotient.mk.

theorem Quotient.ind.{u} {α : Sort u} {s : Setoid α} {motive : Quotient s → Prop} :
  (∀ (a : α), motive ⟦a⟧) → ∀ (q : Quotient s), motive q

Lifts a function from an underlying type to a function on a quotient, requiring that it respects the quotient’s equivalence relation.

Given s : Setoid α and a quotient Quotient s, applying a function f : α → β requires a proof h that f respects the equivalence relation s.r. In this case, the function Quotient.lift f h : Quotient s → β computes the same values as f.

Quotient.liftOn is a version of this operation that takes the quotient value as its first explicit parameter.

abbrev Quotient.lift.{u, v} {α : Sort u} {β : Sort v} {s : Setoid α} (f : α → β) :
  (∀ (a b : α), a ≈ b → f a = f b) → Quotient s → β

Lifts a binary function from the underlying types to a binary function on quotients. The function must respect both quotients’ equivalence relations.

Quotient.lift is a version of this operation for unary functions. Quotient.liftOn₂ is a version that take the quotient parameters first.

abbrev Quotient.lift₂.{uA, uB, uC} {α : Sort uA} {β : Sort uB} {φ : Sort uC} {s₁ : Setoid α}
  {s₂ : Setoid β} (f : α → β → φ)
  (c : ∀ (a₁ : α) (b₁ : β) (a₂ : α) (b₂ : β), a₁ ≈ a₂ → b₁ ≈ b₂ → f a₁ b₁ = f a₂ b₂)
  (q₁ : Quotient s₁) (q₂ : Quotient s₂) : φ

Places an element of a type into the quotient that equates terms according to an equivalence relation.

The setoid instance is provided explicitly. Quotient.mk' uses instance synthesis instead.

Given v : α, Quotient.mk s v : Quotient s is like v, except all observations of v’s value must respect s.r. Quotient.lift allows values in a quotient to be mapped to other types, so long as the mapping respects s.r.

def Quotient.mk.{u} {α : Sort u} (s : Setoid α) (a : α) : Quotient s

The quotient axiom, which asserts the equality of elements related in the setoid.

Because Quotient is built on a lower-level type Quot, Quotient.sound is implemented as a theorem. It is derived from Quot.sound, the soundness axiom for the lower-level quotient type Quot.

theorem Quotient.sound.{u} {α : Sort u} {s : Setoid α} {a b : α} : a ≈ b → ⟦a⟧ = ⟦b⟧

The transitive closure TransGen r of a relation r is the smallest relation which is transitive and contains r. TransGen r a z if and only if there exists a sequence a r b r ... r z of length at least 1 connecting a to z.

inductive Relation.TransGen.{u} {α : Sort u} (r : α → α → Prop) : α → α → Prop

A setoid is a type with a distinguished equivalence relation, denoted ≈.

The Quotient type constructor requires a Setoid instance.

structure Setoid.{u} (α : Sort u) : Sort (max 1 u)

Dependent pairs, in which the second element’s type depends on the value of the first element. The type Sigma β is typically written Σ a : α, β a or (a : α) × β a.

Although its values are pairs, Sigma is sometimes known as the dependent sum type, since it is the type level version of an indexed summation.

structure Sigma.{u, v} {α : Type u} (β : α → Type v) : Type (max u v)

A subsingleton is a type with at most one element. It is either empty or has a unique element.

All propositions are subsingletons because of proof irrelevance: false propositions are empty, and all proofs of a true proposition are equal to one another. Some non-propositional types are also subsingletons.

structure Subsingleton.{u} (α : Sort u) : Prop

If a type is a subsingleton, then all of its elements are equal.

theorem Subsingleton.elim.{u} {α : Sort u} [h : Subsingleton α] (a b : α) : a = b
theorem Subtype.ext.{u} {α : Sort u} {p : α → Prop} {a1 a2 : { x // p x }} : ↑a1 = ↑a2 → a1 = a2

The disjoint union of types α and β, ordinarily written α ⊕ β.

An element of α ⊕ β is either an a : α wrapped in Sum.inl or a b : β wrapped in Sum.inr. α ⊕ β is not equivalent to the set-theoretic union of α and β because its values include an indication of which of the two types was chosen. The union of a singleton set with itself contains one element, while Unit ⊕ Unit contains distinct values inl () and inr ().

inductive Sum.{u, v} (α : Type u) (β : Type v) : Type (max u v)

x != y is boolean not-equal. It is the negation of x == y which is supplied by the BEq typeclass.

Unlike x ≠ y (which is notation for Ne x y), this is Bool valued instead of Prop valued. It is mainly intended for programming applications.

Conventions for notations in identifiers:

  • The recommended spelling of != in identifiers is bne.
def bne.{u} {α : Type u} [BEq α] (a b : α) : Bool

Used by: Frame.toPoly_xor

theorem decide_true (h : Decidable True) : decide True = true
theorem dif_neg.{u} {c : Prop} {h : Decidable c} (hnc : ¬c) {α : Sort u} {t : c → α} {e : ¬c → α} :
  dite c t e = e hnc
theorem dif_pos.{u} {c : Prop} {h : Decidable c} (hc : c) {α : Sort u} {t : c → α} {e : ¬c → α} :
  dite c t e = t hc

Function extensionality. If two functions return equal results for all possible arguments, then they are equal.

It is called “extensionality” because it provides a way to prove two objects equal based on the properties of the underlying mathematical functions, rather than based on the syntax used to denote them. Function extensionality is a theorem that can be proved using quotient types.

theorem funext.{u, v} {α : Sort u} {β : α → Sort v} {f g : (x : α) → β x} (h : ∀ (x : α), f x = g x) : f = g
theorem if_neg.{u} {c : Prop} {h : Decidable c} (hnc : ¬c) {α : Sort u} {t e : α} : (if c then t else e) = e

Auxiliary definition for generating compact noConfusion for enumeration types

abbrev noConfusionEnum.{u, v, w} {α : Sort u} {β : Sort v} [inst : DecidableEq β] (f : α → β) {P : Sort w}
  {x y : α} (h : x = y) : noConfusionTypeEnum f P x y

Auxiliary definition for generating compact noConfusion for enumeration types

abbrev noConfusionTypeEnum.{u, v, w} {α : Sort u} {β : Sort v} [inst : DecidableEq β] (f : α → β)
  (P : Sort w) (x y : α) : Sort w

Data.Array.Basic

Appends two arrays. Normally used via the ++ operator.

Appending arrays takes time proportional to the length of the second array.

Examples: * #[1, 2, 3] ++ #[4, 5] = #[1, 2, 3, 4, 5]. * #[] ++ #[4, 5] = #[4, 5]. * #[1, 2, 3] ++ #[] = #[1, 2, 3].

def Array.append.{u} {α : Type u} (as bs : Array α) : Array α

Checks whether a is an element of as, using == to compare elements.

Array.elem is a synonym that takes the element before the array.

Examples: * #[1, 4, 2, 3, 3, 7].contains 3 = true * Array.contains #[1, 4, 2, 3, 3, 7] 5 = false

def Array.contains.{u} {α : Type u} [BEq α] (as : Array α) (a : α) : Bool

Data.Bool

theorem Bool.and_eq_true_iff {x y : Bool} : (x && y) = true ↔ x = true ∧ y = true
theorem Bool.and_not_self (x : Bool) : (x && !x) = false
theorem Bool.bne_false (b : Bool) : (b != false) = b

Used by: Frame.toPoly_xor

theorem Bool.bne_true (b : Bool) : (b != true) = !b

Used by: Frame.toPoly_xor

theorem Bool.eq_iff_iff {a b : Bool} : a = b ↔ (a = true ↔ b = true)

De Morgan’s law for boolean and

theorem Bool.not_and (x y : Bool) : (!(x && y)) = (!x || !y)
theorem Bool.not_or_self (x : Bool) : (!x || x) = true
theorem Bool.or_eq_true_iff {x y : Bool} : (x || y) = true ↔ x = true ∨ y = true
theorem Bool.true_eq_false : (true = false) = False

Boolean “exclusive or”. xor x y can be written x ^^ y.

x ^^ y is true when precisely one of x or y is true. Unlike and and or, it does not have short-circuiting behavior, because one argument’s value never determines the final value. Also unlike and and or, there is no commonly-used corresponding propositional connective.

Examples: * false ^^ false = false * true ^^ false = true * false ^^ true = true * true ^^ true = false

Conventions for notations in identifiers:

  • The recommended spelling of ^^ in identifiers is xor.
abbrev Bool.xor : Bool → Bool → Bool

Data.Cast

The canonical homomorphism Nat → R. In most use cases, the target type will have a (semi)ring structure, and this homomorphism should be a (semi)ring homomorphism.

NatCast and IntCast exist to allow different libraries with their own types that can be notated as natural numbers to have consistent simp normal forms without needing to create coercion simplification sets that are aware of all combinations. Libraries should make it easy to work with NatCast where possible. For instance, in Mathlib there will be such a homomorphism (and thus a NatCast R instance) whenever R is an additive monoid with a 1.

The prototypical example is Int.ofNat.

def Nat.cast.{u} {R : Type u} [NatCast R] : ℕ → R

Used by: Bit.discrete, BitFunction.exists_settle, Bool.discrete, Channel.capacity, Component.hexagon_forward_arrow, Component.hexagon_reverse_arrow, Component.parallel_assoc, Discrete, Discrete.pi, Discrete.prod, Discrete.size, Discrete.size_eq, Fin.append_eval, Frame.crc32Ethernet_detects_single_bit_flip, Frame.crcFrom_detects_single_bit_flip, Frame.crcStep_length, Frame.crcStep_poly, Frame.generator_not_dvd_pow, Frame.reflectIndex, Frame.reflectIndex_involutive, Frame.toPoly_degree_lt, Frame.toPoly_ne_zero_of_any, Frame.toPoly_set_flip, InformationSystem.exists_repeat_state, Logic.ProofTheory.Derivation.toCutFree, Receiver.step, Sender.step, Structure.Arithmetic.S_iff_add_one, Structure.Arithmetic.S_iff_succ, Structure.Arithmetic.Tower.instInfiniteColimit, Structure.Arithmetic.Tower.lt_card_level, Structure.Arithmetic.Z_iff_zero, Structure.Arithmetic.finTower, Structure.Arithmetic.instNeZeroNat_structure, Structure.Arithmetic.instPeanoNat, Topology.step_conserves, Tower, Tower.LangBot, Tower.LangTop, Tower.LevelBot, Tower.LevelTop, Tower.card_lt_stepNeg, Tower.card_lt_stepPos, Tower.card_zero_le_neg, Tower.card_zero_le_pos, Tower.heapBot, Tower.heapTop, Tower.instInfiniteLevelBot, Tower.instInfiniteLevelTop, Tower.lang0ToBot, Tower.lang0ToTop, Tower.structBot, Tower.structTop, Unit.discrete, arithFromNat, arithFromNat_toNat, arithLevel_negNatAbs, arithPlus, arithPlus_iff, arithPlus_mk_eq, arithPlus_succ, arithPlus_zero, arithStepNeg, arithStepNeg_injective, arithStepNeg_not_surjective, arithStepNeg_val, arithStepPos, arithStepPos_val, arithStepTo_val, arithSucc, arithSucc_iff, arithSucc_mk_eq, arithSucc_no_fixed_point, arithToNat, arithToNat_mk, arithTower, arithTranslatePos_stepTo_eq, arithZero_not_succ, instNormPacket, instNormSetBlock, irrational_logb_two_five, irrational_logb_two_three, no_pow_two_eq_pow_five, no_pow_two_eq_pow_three, phoneNumberInformation, phoneNumberInformation_eq, trafficLightInformation, trafficLightInformation_eq

Data.Fin.Basic

Uses a proof that two bounds are equal to allow a value bounded by one to be used with the other.

In other words, when eq : n = m, Fin.cast eq i converts i : Fin n into a Fin m.

def Fin.cast {n m : ℕ} (eq : n = m) (i : Fin n) : Fin m

Coarsens a bound to one at least as large.

See also Fin.natAdd and Fin.addNat for addition functions that increase the bound, and Fin.castLE for a version that uses an explicit inequality proof.

def Fin.castAdd {n : ℕ} (m : ℕ) : Fin n → Fin (n + m)

Coarsens a bound by one.

def Fin.castSucc {n : ℕ} : Fin n → Fin (n + 1)

The type Fin 0 is uninhabited, so it can be used to derive any result whatsoever.

This is similar to Empty.elim. It can be thought of as a compiler-checked assertion that a code path is unreachable, or a logical contradiction from which False and thus anything else could be derived.

def Fin.elim0.{u} {α : Sort u} : Fin 0 → α

The greatest value of Fin (n+1), namely n.

Examples: * Fin.last 4 = (4 : Fin 5) * (Fin.last 0).val = (0 : Nat)

def Fin.last (n : ℕ) : Fin (n + 1)

Adds a natural number to a Fin, increasing the bound.

This is a generalization of Fin.succ.

Fin.addNat is a version of this function that takes its Nat parameter second.

Examples: * Fin.natAdd 3 (5 : Fin 8) = (8 : Fin 11) * Fin.natAdd 1 (0 : Fin 8) = (1 : Fin 9) * Fin.natAdd 1 (2 : Fin 8) = (3 : Fin 9)

def Fin.natAdd {m : ℕ} (n : ℕ) (i : Fin m) : Fin (n + m)

The successor, with an increased bound.

This differs from adding 1, which instead wraps around.

Examples: * (2 : Fin 3).succ = (3 : Fin 4) * (2 : Fin 3) + 1 = (0 : Fin 3)

def Fin.succ {n : ℕ} : Fin n → Fin (n + 1)
theorem Fin.val_congr {n : ℕ} {a b : Fin n} (h : a = b) : ↑a = ↑b

Used by: Fin.append_eval

theorem Fin.val_lt_of_le {n b : ℕ} (i : Fin b) (h : b ≤ n) : ↑i < n

Data.Fin.Lemmas

Proves a statement by cases on the underlying Nat value in a Fin (n + 1).

The two cases are: * zero, used when the value is of the form (0 : Fin (n + 1)) * succ, used when the value is of the form (j : Fin n).succ

The corresponding induction principle is Fin.induction.

def Fin.cases.{u_1} {n : ℕ} {motive : Fin (n + 1) → Sort u_1} (zero : motive 0)
  (succ : (i : Fin n) → motive i.succ) (i : Fin (n + 1)) : motive i
theorem Fin.castSucc_lt_last {n : ℕ} (a : Fin n) : a.castSucc < Fin.last n
theorem Fin.cast_refl (n : ℕ) (h : n = n) : Fin.cast h = id
theorem Fin.ext_iff {n : ℕ} {a b : Fin n} : a = b ↔ ↑a = ↑b
theorem Fin.le_def {n : ℕ} {a b : Fin n} : a ≤ b ↔ ↑a ≤ ↑b
theorem Fin.lt_def {n : ℕ} {a b : Fin n} : a < b ↔ ↑a < ↑b
theorem Fin.val_add {n : ℕ} (a b : Fin n) : ↑(a + b) = (↑a + ↑b) % n
theorem Fin.val_castSucc {n : ℕ} (i : Fin n) : ↑i.castSucc = ↑i
theorem Fin.val_eq_zero (a : Fin 1) : ↑a = 0
theorem Fin.val_last (n : ℕ) : ↑(Fin.last n) = n
theorem Fin.zero_le {n : ℕ} [NeZero n] (a : Fin n) : 0 ≤ a

Data.Function

A function f : α → β is called surjective if every b : β is equal to f a for some a : α.

def Function.Surjective.{u_1, u_2} {α : Sort u_1} {β : Sort u_2} (f : α → β) : Prop

Data.Int.Basic

The integers.

This type is special-cased by the compiler and overridden with an efficient implementation. The runtime has a special representation for Int that stores “small” signed numbers directly, while larger numbers use a fast arbitrary-precision arithmetic library (usually GMP). A “small number” is an integer that can be encoded with one fewer bits than the platform’s pointer size (i.e. 63 bits on 64-bit architectures and 31 bits on 32-bit architectures).

inductive Int : Type

Used by: BitFunction.exists_settle, Channel.lossless_stationary, Channel.lossy_loses_overall, Component.Simplex.toInformationSystem, Component.hexagon_forward_arrow, Component.hexagon_reverse_arrow, Component.parallel, Component.parallel_assoc, Component.sequential, Fin.append_eval, Frame.crc32Ethernet_detects_single_bit_flip, Frame.crcFrom_detects_single_bit_flip, Frame.crcStep_length, Frame.crcStep_poly, Frame.crc_poly_dvd, Frame.generator_not_dvd_pow, Frame.reflectIndex, Frame.reflectIndex_involutive, Frame.toPoly_ne_zero_of_any, Frame.toPoly_set_flip, InformationSystem.Environment.universe, InformationSystem.Step.bottom, InformationSystem.Step.delta_alt, InformationSystem.Step.gains, InformationSystem.Step.loses, InformationSystem.eval_delta, InformationSystem.exists_repeat_state, InformationSystem.parallel_delta, InformationSystem.roundtrip_neutral, InformationSystem.spontaneous_no_self_return, InformationSystem.toSimplex, InformationSystem.zero_run_le, Logic.ProofTheory.Derivation.toCutFree, Structure.Arithmetic.S_iff_add_one, Structure.Arithmetic.S_iff_succ, Structure.Arithmetic.Tower.instInfiniteColimit, Structure.Arithmetic.Tower.lt_card_level, Structure.Arithmetic.Z_iff_zero, Structure.Arithmetic.finTower, Structure.Arithmetic.instNeZeroNat_structure, Structure.Arithmetic.instPeanoNat, Topology.step_conserves, Tower, Tower.LangBot, Tower.LangTop, Tower.LevelBot, Tower.LevelTop, Tower.Place, Tower.card_lt_stepNeg, Tower.card_lt_stepPos, Tower.card_zero_le_neg, Tower.card_zero_le_pos, Tower.grothendieckTopology, Tower.heapBot, Tower.heapTop, Tower.instInfiniteLevelBot, Tower.instInfiniteLevelTop, Tower.lang0ToBot, Tower.lang0ToTop, Tower.structBot, Tower.structTop, Tower.wholeHeap, arithFromNat, arithFromNat_toNat, arithLevel, arithLevel_negNatAbs, arithPlus, arithPlus_iff, arithPlus_mk_eq, arithPlus_succ, arithPlus_zero, arithStepNeg, arithStepNeg_injective, arithStepNeg_not_surjective, arithStepNeg_val, arithStepPos, arithStepPos_val, arithStepTo_val, arithSucc, arithSucc_iff, arithSucc_mk_eq, arithSucc_no_fixed_point, arithToNat, arithToNat_mk, arithTower, arithTranslatePos_stepTo_eq, arithZero_not_succ, irrational_logb_two_five, irrational_logb_two_three, no_pow_two_eq_pow_five, no_pow_two_eq_pow_three

The canonical homomorphism Int → R. In most use cases, the target type will have a ring structure, and this homomorphism should be a ring homomorphism.

IntCast and NatCast exist to allow different libraries with their own types that can be notated as natural numbers to have consistent simp normal forms without needing to create coercion simplification sets that are aware of all combinations. Libraries should make it easy to work with IntCast where possible. For instance, in Mathlib there will be such a homomorphism (and thus an IntCast R instance) whenever R is an additive group with a 1.

def Int.cast.{u} {R : Type u} [IntCast R] : ℤ → R

The absolute value of an integer is its distance from 0.

This function is overridden by the compiler with an efficient implementation. This definition is the logical model.

Examples: * (7 : Int).natAbs = 7 * (0 : Int).natAbs = 0 * (-11 : Int).natAbs = 11

def Int.natAbs (m : ℤ) : ℕ

Converts an integer into a natural number. Negative numbers are converted to 0.

Examples: * (7 : Int).toNat = 7 * (0 : Int).toNat = 0 * (-7 : Int).toNat = 0

def Int.toNat : ℤ → ℕ

Data.Int.DivMod.Basic

theorem Int.natCast_ediv (m n : ℕ) : ↑(m / n) = ↑m / ↑n

Data.Int.DivMod.Bootstrap

theorem Int.emod_def (a b : ℤ) : a % b = a - b * (a / b)
theorem Int.lt_mul_ediv_self_add {x k : ℤ} (h : 0 < k) : x < k * (x / k) + k
theorem Int.mul_ediv_self_le {x k : ℤ} (h : k ≠ 0) : k * (x / k) ≤ x
theorem Int.natCast_emod (m n : ℕ) : ↑(m % n) = ↑m % ↑n

Data.Int.Lemmas

theorem Int.natCast_mul (n m : ℕ) : ↑(n * m) = ↑n * ↑m

Data.Int.Order

theorem Int.natAbs_neg (a : ℤ) : (-a).natAbs = a.natAbs
theorem Int.toNat_of_nonneg {a : ℤ} (h : 0 ≤ a) : ↑a.toNat = a

Data.List.Basic

List membership, typically accessed via the ∈ operator.

a ∈ l means that a is an element of the list l. Elements are compared according to Lean’s logical equality.

The related function List.elem is a Boolean membership test that uses a BEq α instance.

Examples: * a ∈ [x, y, z] ↔︎ a = x ∨ a = y ∨ a = z

inductive List.Mem.{u} {α : Type u} (a : α) : List α → Prop

The list has no duplicates: it contains every element at most once.

It is defined as Pairwise (· ≠ ·): each element is unequal to all other elements.

def List.Nodup.{u} {α : Type u} : List α → Prop

Returns true if p returns true for any element of l.

O(|l|). Short-circuits upon encountering the first true.

Examples: * [2, 4, 6].any (· % 2 = 0) = true * [2, 4, 6].any (· % 2 = 1) = false * [2, 4, 5, 6].any (· % 2 = 0) = true * [2, 4, 5, 6].any (· % 2 = 1) = true

def List.any.{u} {α : Type u} (l : List α) (p : α → Bool) : Bool
theorem List.append_assoc.{u} {α : Type u} (as bs cs : List α) : as ++ bs ++ cs = as ++ (bs ++ cs)
theorem List.append_nil.{u} {α : Type u} (as : List α) : as ++ [] = as
theorem List.cons_append.{u} {α : Type u} {a : α} {as bs : List α} : a :: as ++ bs = a :: (as ++ bs)

Returns the list of elements in l for which p returns true.

O(|l|).

Examples: * [1, 2, 5, 2, 7, 7].filter (· > 2) = [5, 7, 7] * [1, 2, 5, 2, 7, 7].filter (fun _ => false) = [] * [1, 2, 5, 2, 7, 7].filter (fun _ => true) = [1, 2, 5, 2, 7, 7]

def List.filter.{u} {α : Type u} (p : α → Bool) (l : List α) : List α

Applies a function that returns an Option to each element of a list, collecting the non-none values.

O(|l|).

Example: lean example #eval [1, 2, 5, 2, 7, 7].filterMap fun x => if x > 2 then some (2 * x) else none

[10, 14, 14]
def List.filterMap.{u, v} {α : Type u} {β : Type v} (f : α → Option β) : List α → List β

Used by: getConceptsOf

Returns the first element of the list for which the predicate p returns true, or none if no such element is found.

O(|l|).

Examples: * [7, 6, 5, 8, 1, 2, 6].find? (· < 5) = some 1 * [7, 6, 5, 8, 1, 2, 6].find? (· < 1) = none

def List.find?.{u} {α : Type u} (p : α → Bool) : List α → Option α

Used by: resolveRelation

Folds a function over a list from the right, accumulating a value starting with init. The accumulated value is combined with the each element of the list in reverse order, using f.

O(|l|). Replaced at runtime with List.foldrTR.

Examples: * [a, b, c].foldr f init = f a (f b (f c init)) * [1, 2, 3].foldr (toString · ++ ·) "" = "123" * [1, 2, 3].foldr (s!"({·} {·})") "!" = "(1 (2 (3 !)))"

def List.foldr.{u, v} {α : Type u} {β : Type v} (f : α → β → β) (init : β) (l : List α) : β

Returns the last element of a non-empty list.

Examples: * ["circle", "rectangle"].getLast (by decide) = "rectangle" * ["circle"].getLast (by decide) = "circle"

def List.getLast.{u} {α : Type u} (as : List α) : as ≠ [] → α

Returns the last element in the list, or none if the list is empty.

Alternatives include List.getLastD, which takes a fallback value for empty lists, and List.getLast!, which panics on empty lists.

Examples: * ["circle", "rectangle"].getLast? = some "rectangle" * ["circle"].getLast? = some "circle" * ([] : List String).getLast? = none

def List.getLast?.{u} {α : Type u} : List α → Option α

Returns the first element of a non-empty list.

def List.head.{u} {α : Type u} (as : List α) : as ≠ [] → α

Returns the first element in the list, if there is one. Returns none if the list is empty.

Use List.headD to provide a fallback value for empty lists, or List.head! to panic on empty lists.

Examples: * ([] : List Nat).head? = none * [3, 2, 1].head? = some 3

def List.head?.{u} {α : Type u} : List α → Option α
theorem List.head?_cons.{u} {α : Type u} {a : α} {l : List α} : (a :: l).head? = some a

Returns the first element in the list if there is one, or fallback if the list is empty.

Use List.head? to return an Option, and List.head! to panic on empty lists.

Examples: * [].headD "empty" = "empty" * [].headD 2 = 2 * ["head", "shoulders", "knees"].headD "toes" = "head"

def List.headD.{u} {α : Type u} (as : List α) (fallback : α) : α
theorem List.length_append.{u} {α : Type u} {as bs : List α} : (as ++ bs).length = as.length + bs.length
theorem List.length_replicate.{u} {α : Type u} {n : ℕ} {a : α} : (List.replicate n a).length = n
theorem List.length_set.{u} {α : Type u} {as : List α} {i : ℕ} {a : α} : (as.set i a).length = as.length

Creates a list that contains n copies of a.

  • List.replicate 5 "five" = ["five", "five", "five", "five", "five"]
  • List.replicate 0 "zero" = []
  • List.replicate 2 ' ' = [' ', ' ']
def List.replicate.{u} {α : Type u} (n : ℕ) (a : α) : List α

Reverses a list.

O(|as|).

Because of the “functional but in place” optimization implemented by Lean’s compiler, this function does not allocate a new list when its reference to the input list is unshared: it simply walks the linked list and reverses all the node pointers.

Examples: * [1, 2, 3, 4].reverse = [4, 3, 2, 1] * [].reverse = []

def List.reverse.{u} {α : Type u} (as : List α) : List α

Computes the sum of the elements of a list.

Examples: * [a, b, c].sum = a + (b + (c + 0)) * [1, 2, 5].sum = 8

def List.sum.{u_1} {α : Type u_1} [Add α] [Zero α] : List α → α

Drops the first element of a nonempty list, returning the tail. Returns [] when the argument is empty.

Examples: * ["apple", "banana", "grape"].tail = ["banana", "grape"] * ["apple"].tail = [] * ([] : List String).tail = []

def List.tail.{u} {α : Type u} : List α → List α

Extracts the first n elements of xs, or the whole list if n is greater than xs.length.

O(min n |xs|).

Examples: * [a, b, c, d, e].take 0 = [] * [a, b, c, d, e].take 3 = [a, b, c] * [a, b, c, d, e].take 6 = [a, b, c, d, e]

def List.take.{u} {α : Type u} (n : ℕ) (xs : List α) : List α

Applies a function to the corresponding elements of two lists, stopping at the end of the shorter list.

O(min |xs| |ys|).

Examples: * [1, 2].zipWith (· + ·) [5, 6] = [6, 8] * [1, 2, 3].zipWith (· + ·) [5, 6, 10] = [6, 8, 13] * [].zipWith (· + ·) [5, 6] = [] * [x₁, x₂, x₃].zipWith f [y₁, y₂, y₃, y₄] = [f x₁ y₁, f x₂ y₂, f x₃ y₃]

def List.zipWith.{u, v, w} {α : Type u} {β : Type v} {γ : Type w} (f : α → β → γ) (xs : List α)
  (ys : List β) : List γ

Data.List.BasicAux

Returns the last element in the list. Panics and returns default if the list is empty.

Safer alternatives include: * getLast?, which returns an Option, * getLastD, which takes a fallback value for empty lists, and * getLast, which requires a proof that the list is non-empty.

Examples: * ["circle", "rectangle"].getLast! = "rectangle" * ["circle"].getLast! = "circle"

def List.getLast!.{u_1} {α : Type u_1} [Inhabited α] : List α → α

Used by: qualityOf

Data.List.Control

Applies the monadic action f to every element in the list, left-to-right, and returns the list of results.

This implementation is tail recursive. List.mapM' is a non-tail-recursive variant that may be more convenient to reason about. List.forM is the variant that discards the results and List.mapA is the variant that works with Applicative.

def List.mapM.{u, v, w} {m : Type u → Type v} [Monad m] {α : Type w} {β : Type u} (f : α → m β)
  (as : List α) : m (List β)

Data.List.FinRange

Lists all elements of Fin n in order, starting at 0.

Examples: * List.finRange 0 = ([] : List (Fin 0)) * List.finRange 2 = ([0, 1] : List (Fin 2))

def List.finRange (n : ℕ) : List (Fin n)
theorem List.mem_finRange {n : ℕ} (x : Fin n) : x ∈ List.finRange n

Data.List.Lemmas

theorem List.eq_or_mem_of_mem_cons.{u_1} {α : Type u_1} {a b : α} {l : List α} : a ∈ b :: l → a = b ∨ a ∈ l
theorem List.ext_getElem.{u_1} {α : Type u_1} {l₁ l₂ : List α} (hl : l₁.length = l₂.length)
  (h : ∀ (i : ℕ) (h₁ : i < l₁.length) (h₂ : i < l₂.length), l₁[i] = l₂[i]) : l₁ = l₂
theorem List.forall_mem_map.{u_1, u_2} {α : Type u_1} {β : Type u_2} {f : α → β} {l : List α}
  {P : β → Prop} : (∀ i ∈ List.map f l, P i) ↔ ∀ j ∈ l, P (f j)
theorem List.getElem_set_ne.{u_1} {α : Type u_1} {l : List α} {i j : ℕ} (h : i ≠ j) {a : α}
  (hj : j < (l.set i a).length) : (l.set i a)[j] = l[j]
theorem List.getElem_set_self.{u_1} {α : Type u_1} {l : List α} {i : ℕ} {a : α}
  (h : i < (l.set i a).length) : (l.set i a)[i] = a
theorem List.getLast?_cons_cons.{u_1} {α✝ : Type u_1} {a b : α✝} {l : List α✝} :
  (a :: b :: l).getLast? = (b :: l).getLast?
theorem List.getLast_mem_getLast?.{u_1} {α : Type u_1} {l : List α} (h : l ≠ []) : l.getLast h ∈ l.getLast?

simp unfolds headD in terms of head? and Option.getD.

theorem List.headD_eq_head?_getD.{u_1} {α : Type u_1} {a : α} {l : List α} : l.headD a = l.head?.getD a
theorem List.head_mem_head?.{u_1} {α : Type u_1} {l : List α} (h : l ≠ []) : l.head h ∈ l.head?
theorem List.length_tail.{u_1} {α : Type u_1} {l : List α} : l.tail.length = l.length - 1
theorem List.map_congr_left.{u_1, u_2} {α✝ : Type u_1} {l : List α✝} {α✝¹ : Type u_2} {f g : α✝ → α✝¹}
  (h : ∀ a ∈ l, f a = g a) : List.map f l = List.map g l
theorem List.mem_cons_of_mem.{u_1} {α : Type u_1} (y : α) {a : α} {l : List α} : a ∈ l → a ∈ y :: l
theorem List.mem_filter.{u_1} {α✝ : Type u_1} {p : α✝ → Bool} {as : List α✝} {x : α✝} :
  x ∈ List.filter p as ↔ x ∈ as ∧ p x = true
theorem List.mem_map.{u_1, u_2} {α : Type u_1} {β : Type u_2} {b : β} {f : α → β} {l : List α} :
  b ∈ List.map f l ↔ ∃ a ∈ l, f a = b
theorem List.mem_map_of_mem.{u_1, u_2} {α : Type u_1} {β : Type u_2} {l : List α} {a : α} {f : α → β}
  (h : a ∈ l) : f a ∈ List.map f l
theorem List.not_mem_nil.{u_1} {α : Type u_1} {a : α} : a ∉ []
theorem List.reverse_reverse.{u_1} {α : Type u_1} (as : List α) : as.reverse.reverse = as

Data.List.Nat.TakeDrop

theorem List.length_zipWith.{u_1, u_2, u_3} {α : Type u_1} {β : Type u_2} {γ : Type u_3} {f : α → β → γ}
  {l₁ : List α} {l₂ : List β} : (List.zipWith f l₁ l₂).length = min l₁.length l₂.length

Data.List.OfFn

theorem List.getElem_ofFn.{u_1} {n : ℕ} {α : Type u_1} {i : ℕ} {f : Fin n → α}
  (h : i < (List.ofFn f).length) : (List.ofFn f)[i] = f ⟨i, ⋯⟩
theorem List.length_ofFn.{u_1} {n : ℕ} {α : Type u_1} {f : Fin n → α} : (List.ofFn f).length = n

Creates a list by applying f to each potential index in order, starting at 0.

Examples: * List.ofFn (n := 3) toString = ["0", "1", "2"] * List.ofFn (fun i => #["red", "green", "blue"].get i.val i.isLt) = ["red", "green", "blue"]

def List.ofFn.{u_1} {α : Type u_1} {n : ℕ} (f : Fin n → α) : List α
theorem List.ofFn_succ.{u_1} {α : Type u_1} {n : ℕ} {f : Fin (n + 1) → α} :
  List.ofFn f = f 0 :: List.ofFn fun i => f i.succ

ofFn on an empty domain is the empty list.

theorem List.ofFn_zero.{u_1} {α : Type u_1} {f : Fin 0 → α} : List.ofFn f = []

Data.List.Pairwise

theorem List.nodup_cons.{u_1} {α : Type u_1} {a : α} {l : List α} : (a :: l).Nodup ↔ a ∉ l ∧ l.Nodup

Data.List.Sublist

theorem List.nil_subset.{u_1} {α : Type u_1} (l : List α) : [] ⊆ l
theorem List.subset_cons_self.{u_1} {α : Type u_1} (a : α) (l : List α) : l ⊆ a :: l

Data.List.Zip

theorem List.zipWith_self.{u_1, u_2} {α : Type u_1} {δ : Type u_2} {f : α → α → δ} {l : List α} :
  List.zipWith f l l = List.map (fun a => f a a) l

Used by: Frame.toPoly_xor

Data.Nat.Basic

theorem Nat.add_lt_add_left {n m : ℕ} (h : n < m) (k : ℕ) : k + n < k + m
theorem Nat.add_sub_cancel (n m : ℕ) : n + m - m = n
theorem Nat.eq_zero_or_pos (n : ℕ) : n = 0 ∨ n > 0
theorem Nat.exists_eq_succ_of_ne_zero {n : ℕ} : n ≠ 0 → ∃ k, n = k.succ

Used by: arithZero_unique

theorem Nat.le_of_lt {n m : ℕ} : n < m → n ≤ m
theorem Nat.le_of_succ_le {n m : ℕ} (h : n.succ ≤ m) : n ≤ m
theorem Nat.le_zero {i : ℕ} : i ≤ 0 ↔ i = 0
theorem Nat.lt_add_right {a b : ℕ} (c : ℕ) (h : a < b) : a < b + c
theorem Nat.lt_of_succ_lt_succ {n m : ℕ} : n.succ < m.succ → n < m
theorem Nat.mul_assoc (n m k : ℕ) : n * m * k = n * (m * k)
theorem Nat.mul_comm (n m : ℕ) : n * m = m * n

A recursor for Nat that uses the notations 0 for Nat.zero and n + 1 for Nat.succ.

It is otherwise identical to the default recursor Nat.rec. It is used by the induction tactic by default for Nat.

abbrev Nat.recAux.{u} {motive : ℕ → Sort u} (zero : motive 0) (succ : (n : ℕ) → motive n → motive (n + 1))
  (t : ℕ) : motive t

Data.Nat.Bitwise.Basic

Asserts that the (n+1)th least significant bit of m is not set.

(This definition is used by Lean internally for compact bitmaps.)

def Nat.hasNotBit (m n : ℕ) : Prop

Bitwise and. Usually accessed via the &&& operator.

Each bit of the resulting value is set if the corresponding bit is set in both of the inputs.

def Nat.land : ℕ → ℕ → ℕ

Shifts the binary representation of a value right by the specified number of bits. Usually accessed via the >>> operator.

Examples: * 4 >>> 2 = 1 * 8 >>> 2 = 2 * 8 >>> 3 = 1 * 0 >>> 3 = 0 * 0xf13a >>> 8 = 0xf1

def Nat.shiftRight : ℕ → ℕ → ℕ

Returns true if the (n+1)th least significant bit is 1, or false if it is 0.

def Nat.testBit (m n : ℕ) : Bool

Data.Nat.Bitwise.Lemmas

theorem Nat.testBit_zero (x : ℕ) : x.testBit 0 = decide (x % 2 = 1)

Data.Nat.Div.Basic

theorem Nat.mod_eq_of_lt {a b : ℕ} (h : a < b) : a % b = a
theorem Nat.mod_self (n : ℕ) : n % n = 0

Data.Nat.Lemmas

theorem Nat.add_right_cancel_iff {m k n : ℕ} : m + n = k + n ↔ m = k
theorem Nat.le_self_pow {n : ℕ} (hn : n ≠ 0) (a : ℕ) : a ≤ a ^ n
theorem Nat.min_self (a : ℕ) : min a a = a

Used by: Frame.toPoly_xor

theorem Nat.mod_succ (n : ℕ) : n % n.succ = n
theorem Nat.pow_mod (a b n : ℕ) : a ^ b % n = (a % n) ^ b % n

Data.Nat.Simproc

theorem Nat.Simproc.sub_add_eq_comm (a b c : ℕ) : a - (b + c) = a - c - b

Data.NeZero

A type-class version of n ≠ 0.

structure NeZero.{u_1} {R : Type u_1} [Zero R] (n : R) : Prop

Data.Option.Basic

Returns true on some x and false on none.

def Option.isSome.{u_1} {α : Type u_1} : Option α → Bool

Used by: NormalBehavior

Data.Option.Instances

theorem Option.mem_def.{u_1} {α : Type u_1} {a : α} {b : Option α} : a ∈ b ↔ b = some a

Data.Ord.Basic

The result of a comparison according to a total order.

The relationship between the compared items may be: * Ordering.lt: less than * Ordering.eq: equal * Ordering.gt: greater than

inductive Ordering : Type

Uses decidable less-than and equality relations to find an Ordering.

In particular, if x < y then the result is Ordering.lt. If x = y then the result is Ordering.eq. Otherwise, it is Ordering.gt.

compareOfLessAndBEq uses BEq instead of DecidableEq.

def compareOfLessAndEq.{u_1} {α : Type u_1} (x y : α) [LT α] [Decidable (x < y)] [DecidableEq α] :
  Ordering

Data.Range.Basic

Data.Rat.Basic

Rational numbers, implemented as a pair of integers num / den such that the denominator is positive and the numerator and denominator are coprime.

structure Rat : Type

Data.Sum.Basic

Case analysis for sums that applies the appropriate function f or g after checking which constructor is present.

def Sum.elim.{u_1, u_2, u_3} {α : Type u_1} {β : Type u_2} {γ : Sort u_3} (f : α → γ) (g : β → γ) :
  α ⊕ β → γ

Meta.Defs

Extracts the non-separator elements of a separated array.

def Lean.Syntax.TSepArray.getElems {k : SyntaxNodeKinds} {sep : String} (sa : Syntax.TSepArray k sep) :
  TSyntaxArray k

Constructs a typed separated array from elements by adding suitable separators. The provided array should not include the separators.

Like Syntax.SepArray.ofElems but for typed syntax.

def Lean.Syntax.TSepArray.ofElems {k : SyntaxNodeKinds} {sep : String} (elems : Array (TSyntax k)) :
  Syntax.TSepArray k sep

Omega.Coeffs

Are the coefficients all zero?

abbrev Lean.Omega.Coeffs.isZero (xs : Omega.Coeffs) : Prop

Omega.Constraint

Omega.Int

theorem Lean.Omega.Int.mul_congr {a b c d : ℤ} (h₁ : a = b) (h₂ : c = d) : a * c = b * d
theorem Lean.Omega.Int.ofNat_pow (a b : ℕ) : ↑(a ^ b) = ↑a ^ b
theorem Lean.Omega.Int.ofNat_sub_sub {a b c : ℕ} : ↑(a - b - c) = ↑(a - (b + c))

Omega.LinearCombo

theorem Lean.Omega.LinearCombo.coordinate_eval_4 {a0 a1 a2 a3 a4 : ℤ} {t : List ℤ} :
  (Omega.LinearCombo.coordinate 4).eval (Omega.Coeffs.ofList (a0 :: a1 :: a2 :: a3 :: a4 :: t)) = a4
theorem Lean.Omega.LinearCombo.coordinate_eval_5 {a0 a1 a2 a3 a4 a5 : ℤ} {t : List ℤ} :
  (Omega.LinearCombo.coordinate 5).eval
      (Omega.Coeffs.ofList (a0 :: a1 :: a2 :: a3 :: a4 :: a5 :: t)) =
    a5
theorem Lean.Omega.LinearCombo.coordinate_eval_6 {a0 a1 a2 a3 a4 a5 a6 : ℤ} {t : List ℤ} :
  (Omega.LinearCombo.coordinate 6).eval
      (Omega.Coeffs.ofList (a0 :: a1 :: a2 :: a3 :: a4 :: a5 :: a6 :: t)) =
    a6
theorem Lean.Omega.LinearCombo.coordinate_eval_7 {a0 a1 a2 a3 a4 a5 a6 a7 : ℤ} {t : List ℤ} :
  (Omega.LinearCombo.coordinate 7).eval
      (Omega.Coeffs.ofList (a0 :: a1 :: a2 :: a3 :: a4 :: a5 :: a6 :: a7 :: t)) =
    a7

Multiplication of two linear combinations. This is useful only if at least one of the linear combinations is constant, and otherwise should be considered as a junk value.

def Lean.Omega.LinearCombo.mul (l₁ l₂ : Omega.LinearCombo) : Omega.LinearCombo
theorem Lean.Omega.LinearCombo.mul_eval (l₁ l₂ : Omega.LinearCombo) (v : Omega.Coeffs)
  (w : l₁.coeffs.isZero ∨ l₂.coeffs.isZero) : (l₁.mul l₂).eval v = l₁.eval v * l₂.eval v

Omega.Logic

theorem Lean.Omega.Decidable.and_not_or_not_and_of_not_iff {a b : Prop} [Decidable a] [Decidable b]
  (h : ¬(a ↔ b)) : a ∧ ¬b ∨ ¬a ∧ b

Used by: arithPlus_succ

Prelude

And a b, or a ∧ b, is the conjunction of propositions. It can be constructed and destructed like a pair: if ha : a and hb : b then ⟨ha, hb⟩ : a ∧ b, and if h : a ∧ b then h.left : a and h.right : b.

Conventions for notations in identifiers:

  • The recommended spelling of ∧ in identifiers is and.
structure And (a b : Prop) : Prop

Used by: BitFunction.exists_settle, BitFunction.iterate_settles, BitSequence.trueCount_strict, Class.Passive, Component.hexagon_forward_arrow, Component.hexagon_reverse_arrow, Component.parallel_assoc, DataLinkLayer.network, Fin.append_eval, Finset.sum_preimage_map_disjUnion, Frame.crcStep_length, Frame.eq_of_associated_gf2, Frame.generator_not_dvd_pow, Frame.reflectIndex, Frame.reflectIndex_involutive, Frame.toPoly_degree_lt, Frame.toPoly_ne_zero_of_any, Frame.toPoly_set_flip, Heap.create_delete, InformationSystem.Chain.ofIsChain, InformationSystem.exists_repeat_equivalent, InformationSystem.exists_repeat_state, InformationSystem.gatedFlow, InformationSystem.gatedFlow_success_AB, InformationSystem.gatedFlow_success_BA, InformationSystem.isolated, InformationSystem.natural, InformationSystem.not_spontaneous_and_perpetuous, InformationSystem.perpetuous, InformationSystem.perpetuous_coherent, InformationSystem.spontaneous_no_self_return, InterfaceOld.Value.join, InterfaceOld.Value.join_disjoint, InterfaceOld.Value.join_fired_inl, InterfaceOld.Value.join_fired_inr, InterfaceOld.tensor, Internal, Layer.id_sequential, Layer.parallel, Layer.parallel_rel, Layer.sequential, Layer.sequential_assoc, Layer.sequential_id, Layer.sequential_rel, Layer.symmetry, Layer.trace_naturality_left, Layer.trace_naturality_right, Layer.trace_sliding, Layer.trace_vanishing, Layer.trace_yanking, Logic.FirstOrderLogic.basis3ext, Logic.FirstOrderLogic.exists_fresh_ne, Logic.FirstOrderLogic.hasExistential, Logic.FirstOrderLogic.hasUniversal, Logic.Popper.Basis1.IsExistential, Logic.Popper.Basis1.IsUniversal, Logic.Popper.Basis1.Mutual, Logic.Popper.Basis1.instHasExistentialNatUnitTotalBasis1InferInstanceHasSubstitutionMutual, Logic.Popper.Basis1.instHasUniversalNatUnitTotalBasis1InferInstanceHasSubstitutionMutual, Logic.ProofTheory.CutFree.toDerivation, Logic.ProofTheory.Derivation.toCutFree, Logic.ProofTheory.Instances, Logic.PropositionalLogic.Formula.and_entails_left, Logic.PropositionalLogic.Formula.and_entails_right, Logic.PropositionalLogic.Formula.bigAnd_val, Logic.PropositionalLogic.Formula.bigOr_val, Logic.PropositionalLogic.Formula.dnf_val, Logic.PropositionalLogic.Formula.eliminate, Logic.PropositionalLogic.Formula.entails_and_iff, Logic.PropositionalLogic.Formula.entails_and_iff_syntactic, Logic.PropositionalLogic.Formula.kalmar, Logic.PropositionalLogic.derivable_mp, Logic.PropositionalLogic.derivation_of_axiom, Logic.PropositionalLogic.semanticConnectives, Logic.PropositionalLogic.syntacticConnectives, NetworkLayer.forwards, NetworkLayer.resolves, NormalBehavior, Ontology.decidableWellFormed, Ontology.empty_wellFormed, Ontology.wellFormed, Structure.Arithmetic.NonPeano, Structure.Arithmetic.Peano, Structure.Arithmetic.Primitive, Structure.Arithmetic.S, Structure.Arithmetic.S_iff_add_one, Structure.Arithmetic.S_iff_succ, Structure.Arithmetic.S_lt, Structure.Arithmetic.S_unique, Structure.Arithmetic.Tower.instLinearOrderColimit, Structure.Arithmetic.Tower.instPeanoColimit, Structure.Arithmetic.exists_S_of_not_Z, Structure.Arithmetic.exp_step, Structure.Arithmetic.fixedPoint_iter, Structure.Arithmetic.instDefForallForallPropFixedPointPrimitiveOfSerialOfUnivalent, Structure.Arithmetic.instDefS, Structure.Arithmetic.instPeanoNat, Structure.Arithmetic.instPeanoStandard, Structure.Arithmetic.instTotallyPrimitiveOfSerial, Structure.Arithmetic.instUnivalentlyPrimitiveOfUnivalent, Structure.Arithmetic.lt_succ, Structure.Arithmetic.lt_wf, Structure.Arithmetic.orbit_subset, Structure.Arithmetic.plus_step, Structure.Arithmetic.rec_base, Structure.Arithmetic.rec_step, Structure.Arithmetic.terminates_iff_bounded, Structure.Arithmetic.terminates_of_halts, Structure.Arithmetic.times_step, Structure.Arithmetic.ultrafinitism, Topology.IsNerveCover, Topology.isNerveCover_inter, Topology.nerveCoverage, Topology.restrictPresieve, Topology.whole, Topology.whole_adj_of_internal, Topology.whole_adj_of_link, Tower.heapBot, Tower.heapTop, Tower.structBot, Tower.structTop, TransportLayer.application, arithPlus_iff, arithPlus_succ, arithSucc_iff, doorBehavior, no_pow_two_eq_pow_five, no_pow_two_eq_pow_three, phoneNumber_bits_needed, trafficLight_approx_two_bits

Array α is the type of dynamic arrays with elements from α. This type has special support in the runtime.

Arrays perform best when unshared. As long as there is never more than one reference to an array, all updates will be performed destructively. This results in performance comparable to mutable arrays in imperative programming languages.

An array has a size and a capacity. The size is the number of elements present in the array, while the capacity is the amount of memory currently allocated for elements. The size is accessible via Array.size, but the capacity is not observable from Lean code. Array.emptyWithCapacity n creates an array which is equal to #[], but internally allocates an array of capacity n. When the size exceeds the capacity, allocation is required to grow the array.

From the point of view of proofs, Array α is just a wrapper around List α.

structure Array.{u} (α : Type u) : Type u

Create array #[]

def Array.mkArray0.{u} {α : Type u} : Array α

Gets the number of elements stored in an array.

This is a cached value, so it is O(1) to access. The space allocated for an array, referred to as its capacity, is at least as large as its size, but may be larger. The capacity of an array is an internal detail that’s not observable by Lean code.

def Array.size.{u} {α : Type u} (a : Array α) : ℕ

The Boolean values, true and false.

Logically speaking, this is equivalent to Prop (the type of propositions). The distinction is public important for programming: both propositions and their proofs are erased in the code generator, while Bool corresponds to the Boolean type in most programming languages and carries precisely one bit of run-time information.

inductive Bool : Type

Used by: Bit, BitFunction.exists_settle, BitSequence.Dominates.bot, BitSequence.trueCount_strict, Bool.discrete, Cell, Cell.eraseSecondBit, Cell.erase_not_injective, Component.hexagon_forward_arrow, Component.hexagon_reverse_arrow, Component.parallel_assoc, DataLinkLayer.interface, DataLinkLayer.links, DataLinkLayer.network, DataLinkLayer.physical, Fin.append_eval, Frame, Frame.crc, Frame.crc32Ethernet, Frame.crc32EthernetPoly, Frame.crc32EthernetPoly_any, Frame.crc32Ethernet_detects_single_bit_flip, Frame.crcFrom, Frame.crcFrom_detects_single_bit_flip, Frame.crcStep, Frame.crcStep_length, Frame.crcStep_poly, Frame.crc_detects_single_bit_flip, Frame.crc_poly_dvd, Frame.eq_of_associated_gf2, Frame.generator_not_dvd_pow, Frame.make, Frame.make_valid, Frame.ofFn_update, Frame.pos_length_of_any, Frame.reflectIndex, Frame.reflectIndex_involutive, Frame.toPoly, Frame.toPoly_append, Frame.toPoly_degree_lt, Frame.toPoly_ne_zero_of_any, Frame.toPoly_replicate_false, Frame.toPoly_set_flip, Frame.toPoly_xor, Frame.valid, InformationSystem.exists_repeat_state, InformationSystem.gatedFlow, InformationSystem.gatedFlow_success_AB, InformationSystem.gatedFlow_success_BA, Logic.ProofTheory.Derivation.toCutFree, Logic.PropositionalLogic.BoolFun, Logic.PropositionalLogic.Formula.SemanticEntails, Logic.PropositionalLogic.Formula.SemanticEntails.refl, Logic.PropositionalLogic.Formula.SemanticEntails.trans, Logic.PropositionalLogic.Formula.Tautology, Logic.PropositionalLogic.Formula.and_entails_left, Logic.PropositionalLogic.Formula.and_entails_right, Logic.PropositionalLogic.Formula.bigAnd_val, Logic.PropositionalLogic.Formula.bigOr_val, Logic.PropositionalLogic.Formula.completeness, Logic.PropositionalLogic.Formula.dnf, Logic.PropositionalLogic.Formula.dnf_val, Logic.PropositionalLogic.Formula.eliminate, Logic.PropositionalLogic.Formula.entails_and_iff, Logic.PropositionalLogic.Formula.entails_of_entails_neg_contra, Logic.PropositionalLogic.Formula.exists_andOrNot_of_boolFun, Logic.PropositionalLogic.Formula.kalmar, Logic.PropositionalLogic.Formula.literal, Logic.PropositionalLogic.Formula.literal_val, Logic.PropositionalLogic.Formula.minterm_val, Logic.PropositionalLogic.Formula.or_entails_left, Logic.PropositionalLogic.Formula.or_entails_right, Logic.PropositionalLogic.Formula.semantic_iff_provable, Logic.PropositionalLogic.Formula.soundness, Logic.PropositionalLogic.Formula.starred, Logic.PropositionalLogic.Formula.val, Logic.PropositionalLogic.Formula.val_falsum', Logic.PropositionalLogic.Formula.val_verum', Logic.PropositionalLogic.NandFormula.exists_nand_of_boolFun, Logic.PropositionalLogic.NandFormula.ofFormula_val, Logic.PropositionalLogic.NandFormula.toFormula_val, Logic.PropositionalLogic.NandFormula.val, Logic.PropositionalLogic.Valuation, Logic.PropositionalLogic.semanticConnectives, NetworkArchitecture, NetworkArchitecture.application, NetworkArchitecture.dataLink, NetworkArchitecture.network, NetworkArchitecture.physical, NetworkArchitecture.stack, NetworkArchitecture.transport, NetworkLayer.resolves, NetworkLayer.transport, NormalBehavior, Receiver.step, Receiver.step_correct, Sender.step, Structure.Arithmetic.S_iff_add_one, Structure.Arithmetic.S_iff_succ, Structure.Arithmetic.Tower.instInfiniteColimit, Structure.Arithmetic.Tower.lt_card_level, Structure.Arithmetic.Z_iff_zero, Structure.Arithmetic.finTower, Structure.Arithmetic.instNeZeroNat_structure, Structure.Arithmetic.instPeanoNat, Topology.joinFunctor, Topology.joinGrothendieck, Topology.joinHistory, TrafficLightColor_cardinality, arithLang, arithPlus_succ, arithPlus_zero, arithSucc_no_fixed_point, arithZero_not_succ, doorBehavior, doorClass, doorHeap, doorHeap.closedVal, doorHeap.closed_reachable, doorHeap.openedVal, doorHeap.opened_reachable, doorInterface, doorObject, getConceptsOf, instDecidableEqCell, instFintypeCell, instNonemptyCell, instNonemptyElemDoorStateReachableBoolDoorHeapStateDoorClass, instNonemptyFrame, instNormBool_computerNetworks, instNormFrame, instNormNonnegBit, instNormNonnegBool, instNormNonnegCell, instStructureDoorLanguageElemDoorStateReachableBoolDoorHeap, irrational_logb_two_five, irrational_logb_two_three, irrational_phoneNumberInformation, isExample, isIgnored, isLemma, no_pow_two_eq_pow_five, no_pow_two_eq_pow_three, notRule_no_fixedPoint, phoneNumberInformation_eq, phoneNumber_bits_needed, qualityOf, trafficLight_approx_two_bits, unexpandSeqAppend, unexpandToSeq

Boolean “and”, also known as conjunction. and x y can be written x && y.

The corresponding propositional connective is And : Prop → Prop → Prop, written with the ∧ operator.

The Boolean and is a @[macro_inline] function in order to give it short-circuiting evaluation: if x is false then y is not evaluated at runtime.

Conventions for notations in identifiers:

  • The recommended spelling of && in identifiers is and.

  • The recommended spelling of || in identifiers is or.

def Bool.and (x y : Bool) : Bool

Boolean “or”, also known as disjunction. or x y can be written x || y.

The corresponding propositional connective is Or : Prop → Prop → Prop, written with the ∨ operator.

The Boolean or is a @[macro_inline] function in order to give it short-circuiting evaluation: if x is true then y is not evaluated at runtime.

def Bool.or (x y : Bool) : Bool

Either a proof that p is true or a proof that p is false. This is equivalent to a Bool paired with a proof that the Bool is true if and only if p is true.

Decidable instances are primarily used via if-expressions and the tactic decide. In conditional expressions, the Decidable instance for the proposition is used to select a branch. At run time, this case distinction code is identical to that which would be generated for a Bool-based conditional. In proofs, the tactic decide synthesizes an instance of Decidable p, attempts to reduce it to isTrue h, and then succeeds with the proof h if it can.

Because Decidable carries data, when writing @[simp] lemmas which include a Decidable instance on the LHS, it is best to use {_ : Decidable p} rather than [Decidable p] so that non-canonical instances can be found via unification rather than instance synthesis.

inductive Decidable (p : Prop) : Type

A decidable predicate.

A predicate is decidable if the corresponding proposition is Decidable for each possible argument.

abbrev DecidablePred.{u} {α : Sort u} (r : α → Prop) : Sort (max 1 u)

A combined state and exception monad in which exceptions do not automatically roll back the state.

Instances of EStateM.Backtrackable provide a way to roll back some part of the state if needed.

EStateM ε σ is equivalent to ExceptT ε (StateM σ), but it is more efficient.

def EStateM.{u} (ε σ α : Type u) : Type u

The value returned from a combined state and exception monad in which exceptions do not automatically roll back the state.

Result ε σ α is equivalent to Except ε α × σ, but using a single combined inductive type yields a more efficient data representation.

inductive EStateM.Result.{u} (ε σ α : Type u) : Type u

Executes an EStateM action with the initial state s. The returned value includes the final state and indicates whether an exception was thrown or a value was returned.

def EStateM.run.{u} {ε σ α : Type u} (x : EStateM ε σ α) (s : σ) : EStateM.Result ε σ α

The empty type. It has no constructors.

Use Empty.elim in contexts where a value of type Empty is in scope.

inductive Empty : Type

The equality relation. It has one introduction rule, Eq.refl. We use a = b as notation for Eq a b. A fundamental property of equality is that it is an equivalence relation.

variable (α : Type) (a b c d : α)
variable (hab : a = b) (hcb : c = b) (hcd : c = d)

example : a = d :=
  Eq.trans (Eq.trans hab (Eq.symm hcb)) hcd

Equality is much more than an equivalence relation, however. It has the important property that every assertion respects the equivalence, in the sense that we can substitute equal expressions without changing the truth value. That is, given h1 : a = b and h2 : p a, we can construct a proof for p b using substitution: Eq.subst h1 h2. Example:

example (α : Type) (a b : α) (p : α → Prop)
        (h1 : a = b) (h2 : p a) : p b :=
  Eq.subst h1 h2

example (α : Type) (a b : α) (p : α → Prop)
    (h1 : a = b) (h2 : p a) : p b :=
  h1 ▸ h2

The triangle in the second presentation is a macro built on top of Eq.subst and Eq.symm, and you can enter it by typing \t. For more information: Equality

Conventions for notations in identifiers:

  • The recommended spelling of = in identifiers is eq.
inductive Eq.{u_1} {α : Sort u_1} : α → α → Prop

Used by: AddressResolution, ApplicationLayer.Op, ApplicationLayer.interface, Behavior, Bit.discrete, BitFunction.IsFixedPoint, BitFunction.cardinality, BitFunction.cardinality_input_growth, BitFunction.cardinality_output_growth, BitFunction.comp_assoc, BitFunction.exists_settle, BitFunction.fixedPoint_isFixed, BitFunction.iterate_dominates_succ, BitFunction.iterate_settles, BitFunction.iterate_stays, BitSequence.Dominates, BitSequence.Dominates.bot, BitSequence.cardinality, BitSequence.trueCount, BitSequence.trueCount_le, BitSequence.trueCount_strict, Bool.discrete, Cell.eraseSecondBit, Cell.erase_not_injective, Cell.erase_not_surjective, Channel, Channel.lossless, Channel.lossless_stationary, Channel.lossy_loses_overall, Channel.overall_loss, Class, Class.Passive, Component.Arrow, Component.Hom.comp_assoc, Component.Hom.comp_eqToHom, Component.Hom.comp_id, Component.Hom.eqToHom_comp, Component.Hom.eqToHom_eq_recast_id, Component.Hom.hexagon_forward, Component.Hom.hexagon_reverse, Component.Hom.id_comp, Component.Hom.recast, Component.Hom.recast_eqToHom, Component.Hom.recast_recast, Component.Hom.symmetry_symmetry, Component.Hom.tensor_assoc, Component.Hom.tensor_comm, Component.Hom.tensor_comp_tensor, Component.Hom.tensor_empty, Component.Hom.tensor_id_id, Component.Hom.tensor_recast_left, Component.Hom.tensor_recast_right, Component.Simplex.toInformationSystem, Component.braidedCategory, Component.braiding_naturality_left, Component.braiding_naturality_right, Component.empty, Component.empty_parallel, Component.equivalent_of_stationary, Component.hexagon_forward_arrow, Component.hexagon_reverse_arrow, Component.id, Component.id_sequential, Component.interchange, Component.monoidalCategory, Component.parallel, Component.parallel_assoc, Component.parallel_comm, Component.parallel_congr, Component.parallel_empty, Component.recast, Component.recast_congr, Component.recast_parallel_left, Component.recast_parallel_right, Component.recast_recast, Component.sequential, Component.sequential_assoc, Component.sequential_congr, Component.sequential_id, Component.symmetry, Component.symmetry_symmetry, Concept, Creation, DataLinkLayer.network, DataLinkLayer.physical, Destruction, Difficulty, Difficulty.ofString?, Discrete, Discrete.pi, Discrete.prod, Discrete.size, Discrete.size_eq, DoorState, Fin.append_eval, FiniteStateMachine, Finset.sum_preimage_map_disjUnion, ForwardingTable, Frame, Frame.crc32Ethernet, Frame.crc32EthernetPoly_any, Frame.crc32Ethernet_detects_single_bit_flip, Frame.crcFrom_detects_single_bit_flip, Frame.crcStep, Frame.crcStep_length, Frame.crcStep_poly, Frame.crc_detects_single_bit_flip, Frame.crc_poly_dvd, Frame.eq_of_associated_gf2, Frame.generator_not_dvd_pow, Frame.ofFn_update, Frame.pos_length_of_any, Frame.reflectEquiv, Frame.reflectEquiv_symm, Frame.reflectIndex, Frame.reflectIndex_involutive, Frame.toPoly, Frame.toPoly_append, Frame.toPoly_degree_lt, Frame.toPoly_ne_zero_of_any, Frame.toPoly_one_add_one, Frame.toPoly_replicate_false, Frame.toPoly_set_flip, Frame.toPoly_xor, Frame.valid, Heap, Heap.combine, Heap.combine_at_left, Heap.combine_at_right, Heap.combine_domain, Heap.create, Heap.create_delete, Heap.create_domain, Heap.delete_domain, Heap.materialize_dematerialize, Heap.mem_reachable, Heap.reachable, HeapCover, HeapCover.agree, HeapCover.whole_at, HeapCover.whole_domain, Icmp, InformationSystem, InformationSystem.Chain, InformationSystem.Chain.length, InformationSystem.Chain.ofIsChain, InformationSystem.Environment, InformationSystem.Environment.universe, InformationSystem.Environment.universe_isolated, InformationSystem.Run, InformationSystem.Run.cycle, InformationSystem.Run.trajectory_head, InformationSystem.Spontaneous, InformationSystem.Step, InformationSystem.Step.bottom, InformationSystem.Step.delta_alt, InformationSystem.Step.delta_trichotomy, InformationSystem.Step.gains, InformationSystem.Step.loses, InformationSystem.equivalent, InformationSystem.equivalent_output, InformationSystem.equivalent_step, InformationSystem.eval, InformationSystem.eval_append, InformationSystem.eval_delta, InformationSystem.eval_trichotomy, InformationSystem.exists_repeat_equivalent, InformationSystem.exists_repeat_state, InformationSystem.gatedFlow, InformationSystem.gatedFlow_success_AB, InformationSystem.gatedFlow_success_BA, InformationSystem.irreversible, InformationSystem.isolated, InformationSystem.natural, InformationSystem.not_spontaneous_and_perpetuous, InformationSystem.parallel_delta, InformationSystem.perpetuous, InformationSystem.perpetuous_coherent, InformationSystem.reversible, InformationSystem.roundtrip_neutral, InformationSystem.sequential_delta, InformationSystem.spontaneous_no_self_return, InformationSystem.spontaneous_not_perpetuous, InformationSystem.toSimplex, InformationSystem.zero_run_le, Interface, InterfaceOld, InterfaceOld.Value, InterfaceOld.Value.eq_of_heq, InterfaceOld.Value.ext_of_fired_eq, InterfaceOld.Value.join, InterfaceOld.Value.join_disjoint, InterfaceOld.Value.join_fired_inl, InterfaceOld.Value.join_fired_inr, InterfaceOld.Value.join_left_right, InterfaceOld.Value.left_join, InterfaceOld.Value.observeAll, InterfaceOld.Value.right_join, InterfaceOld.tensor, InterfaceOld.unit.Value.subsingleton, Internal, Kind, Layer.Univalent, Layer.eq_toFun_of_univalent, Layer.id, Layer.id_rel, Layer.id_sequential, Layer.sequential_assoc, Layer.sequential_id, Layer.symmetry, Layer.trace_naturality_left, Layer.trace_naturality_right, Layer.trace_sliding, Layer.trace_superposing, Layer.trace_vanishing, Layer.trace_yanking, Logic.FirstOrderLogic.all, Logic.FirstOrderLogic.basis3ext, Logic.FirstOrderLogic.ex, Logic.FirstOrderLogic.exists_fresh_ne, Logic.FirstOrderLogic.hasExistential, Logic.FirstOrderLogic.hasUniversal, Logic.FirstOrderLogic.realize_SUB, Logic.FirstOrderLogic.realize_all, Logic.FirstOrderLogic.realize_ex, Logic.FirstOrderLogic.realize_update_of_nonDep, Logic.FirstOrderLogic.realize_update_of_not_mem_freeVarFinset, Logic.Popper.Basis1, Logic.Popper.Basis1.HasClassicalConnectives, Logic.Popper.Basis1.HasClassicalNegation, Logic.Popper.Basis1.HasConjunction, Logic.Popper.Basis1.HasDisjunction, Logic.Popper.Basis1.HasExistential, Logic.Popper.Basis1.HasImplication, Logic.Popper.Basis1.HasIntuitionisticNegation, Logic.Popper.Basis1.HasUniversal, 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_cons_of_isConjunction, Logic.Popper.Basis1.demonstrate_cons_of_isDisjunction, 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_unique, Logic.Popper.Basis1.substitutivity, Logic.Popper.Basis3, Logic.Popper.Basis3.follows_toBasis1, Logic.Popper.HasSubstitution, Logic.ProofTheory.Application, 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.mono, Logic.ProofTheory.CutFree.toDerivation, Logic.ProofTheory.DerivableCutFree.graft, Logic.ProofTheory.Derivation, Logic.ProofTheory.Derivation.toCutFree, Logic.ProofTheory.DerivationsOf, Logic.ProofTheory.DerivationsOf.forall_toCutFree, Logic.ProofTheory.DerivationsOf.of_forall, Logic.ProofTheory.Instances, Logic.ProofTheory.ProofSystem, Logic.ProofTheory.Schema, Logic.ProofTheory.Schema.IsAxiom, Logic.ProofTheory.Schema.IsSimpleRule, Logic.ProofTheory.Schema.IsSimpleRule.of_isAxiom, Logic.PropositionalLogic.Formula, Logic.PropositionalLogic.Formula.Derivable.deduction_aux, Logic.PropositionalLogic.Formula.SemanticEntails, Logic.PropositionalLogic.Formula.SemanticEntails.refl, Logic.PropositionalLogic.Formula.SemanticEntails.trans, Logic.PropositionalLogic.Formula.Tautology, Logic.PropositionalLogic.Formula.and_entails_left, Logic.PropositionalLogic.Formula.and_entails_right, Logic.PropositionalLogic.Formula.bigAnd_val, Logic.PropositionalLogic.Formula.bigOr_val, Logic.PropositionalLogic.Formula.completeness, Logic.PropositionalLogic.Formula.demonstrate_semantic_iff_syntactic, Logic.PropositionalLogic.Formula.dnf_val, Logic.PropositionalLogic.Formula.eliminate, Logic.PropositionalLogic.Formula.entails_and_iff, Logic.PropositionalLogic.Formula.entails_of_and_cases_syntactic, Logic.PropositionalLogic.Formula.entails_of_entails_neg_contra, Logic.PropositionalLogic.Formula.entails_of_or_cases_syntactic, Logic.PropositionalLogic.Formula.exists_andOrNot_of_boolFun, Logic.PropositionalLogic.Formula.kalmar, Logic.PropositionalLogic.Formula.literal, Logic.PropositionalLogic.Formula.literal_val, Logic.PropositionalLogic.Formula.minterm_val, Logic.PropositionalLogic.Formula.or_entails_left, Logic.PropositionalLogic.Formula.or_entails_right, Logic.PropositionalLogic.Formula.provable_contrapose, Logic.PropositionalLogic.Formula.provable_deMorgan_or, Logic.PropositionalLogic.Formula.provable_dni, Logic.PropositionalLogic.Formula.provable_explosion, Logic.PropositionalLogic.Formula.provable_lem, Logic.PropositionalLogic.Formula.semantic_iff_provable, Logic.PropositionalLogic.Formula.soundness, Logic.PropositionalLogic.Formula.starred, Logic.PropositionalLogic.Formula.syntactic_iff_provable, Logic.PropositionalLogic.Formula.val, Logic.PropositionalLogic.Formula.val_falsum', Logic.PropositionalLogic.Formula.val_verum', Logic.PropositionalLogic.HilbertSchema.isAxiom_of_ne_mp, Logic.PropositionalLogic.HilbertSchema.mp_isSimple, Logic.PropositionalLogic.NandFormula, Logic.PropositionalLogic.NandFormula.exists_nand_of_boolFun, Logic.PropositionalLogic.NandFormula.ofFormula, Logic.PropositionalLogic.NandFormula.ofFormula_val, Logic.PropositionalLogic.NandFormula.toFormula, Logic.PropositionalLogic.NandFormula.toFormula_val, Logic.PropositionalLogic.NandFormula.val, Logic.PropositionalLogic.derivable_mp, Logic.PropositionalLogic.derivation_of_axiom, Logic.PropositionalLogic.semanticConnectives, Logic.PropositionalLogic.syntacticConnectives, Mereology, NetworkArchitecture, NetworkLayer.Protocol, NetworkLayer.forwards, NetworkLayer.resolves, NetworkLayer.transport, NormalBehavior, Object, Ontology, Ontology.empty_wellFormed, Packet, Quality, Quality.ofString?, RawRelation, Receiver.step, Receiver.step_correct, Relation, Segment, Sender.step, SeqColimit.Rel, SeqColimit.Rel.refl, SeqColimit.Rel.symm, SeqColimit.Rel.trans, SeqColimit.exists_not_mem_range, SeqColimit.freshSeq_injective, SeqColimit.freshSeq_lt_ne, SeqColimit.mk_injective, SeqColimit.mk_stepTo, SeqColimit.stepTo_self, SeqColimit.stepTo_succ, SeqColimit.stepTo_trans, Specification.closed, Specification.terminalCone, Structure.Arithmetic.Arith, Structure.Arithmetic.Def, Structure.Arithmetic.FixedPoint, Structure.Arithmetic.Impredicative, Structure.Arithmetic.NonPeano, Structure.Arithmetic.Peano, Structure.Arithmetic.Predicative, Structure.Arithmetic.Primitive, Structure.Arithmetic.S_iff_add_one, Structure.Arithmetic.S_iff_succ, Structure.Arithmetic.S_unique, Structure.Arithmetic.Tower, Structure.Arithmetic.Tower.Same, Structure.Arithmetic.Tower.exists_of_le_ι, Structure.Arithmetic.Tower.instArithColimit, Structure.Arithmetic.Tower.instInfiniteColimit, Structure.Arithmetic.Tower.instLinearOrderColimit, Structure.Arithmetic.Tower.instNontrivialColimit, Structure.Arithmetic.Tower.instOrderBotColimit, Structure.Arithmetic.Tower.lt_card_level, Structure.Arithmetic.Tower.same_refl, Structure.Arithmetic.Tower.same_symm, Structure.Arithmetic.Tower.same_trans, Structure.Arithmetic.Tower.sigmaLe_antisymm, Structure.Arithmetic.Tower.sigmaLe_congr, Structure.Arithmetic.Tower.stepTo, Structure.Arithmetic.Tower.stepTo_bot, Structure.Arithmetic.Tower.stepTo_initial, Structure.Arithmetic.Tower.stepTo_le_iff, Structure.Arithmetic.Tower.stepTo_self, Structure.Arithmetic.Tower.stepTo_succ, Structure.Arithmetic.Tower.stepTo_trans, Structure.Arithmetic.Tower.step_le_iff, Structure.Arithmetic.Tower.ι_injective, Structure.Arithmetic.Tower.ι_le_iff, Structure.Arithmetic.Tower.ι_stepTo, Structure.Arithmetic.Univalent, Structure.Arithmetic.Z_iff_zero, Structure.Arithmetic.Z_iff_zero_fin, Structure.Arithmetic.count_strictMono, Structure.Arithmetic.count_succ, Structure.Arithmetic.count_surjective, Structure.Arithmetic.eq_succ_of_S, Structure.Arithmetic.eq_the, Structure.Arithmetic.exists_S_of_not_Z, Structure.Arithmetic.exp_base, Structure.Arithmetic.finTower, Structure.Arithmetic.fixedPoint_iter, Structure.Arithmetic.instArithFin, Structure.Arithmetic.instDefForallForallPropFixedPointOfPredicative, Structure.Arithmetic.instDefForallForallPropFixedPointPrimitiveOfSerialOfUnivalent, Structure.Arithmetic.instDefS, Structure.Arithmetic.instNeZeroNat_structure, Structure.Arithmetic.instPeanoNat, Structure.Arithmetic.instSerialRecPrimitive, Structure.Arithmetic.instTotallyPrimitiveOfSerial, Structure.Arithmetic.instUnivalentRecPrimitive, Structure.Arithmetic.instUnivalentlyPrimitiveOfUnivalent, Structure.Arithmetic.iter_base, Structure.Arithmetic.iter_eq, Structure.Arithmetic.iter_step, Structure.Arithmetic.lt_wf, Structure.Arithmetic.orbit_subset, Structure.Arithmetic.plus_base, Structure.Arithmetic.rec, Structure.Arithmetic.rec_base, Structure.Arithmetic.rec_primitive, Structure.Arithmetic.rec_spec, Structure.Arithmetic.rec_step, Structure.Arithmetic.terminates_of_halts, Structure.Arithmetic.times_base, Structure.Arithmetic.ultrafinitism, ToSeq, Topology, Topology.Event, Topology.IsNerveCover, Topology.Signal, Topology.Step.coverageFunctor, Topology.isNerveCover_inter, Topology.joinFunctor, Topology.join_preserves_connected, Topology.leave_preserves_connected, Topology.nerveCoverage, Topology.restrictPresieve, Topology.runArrows, Topology.runArrows', Topology.step_conserves, Topology.whole, Topology.whole_adj_of_internal, Topology.whole_adj_of_link, Tower, Tower.card_lt_stepNeg, Tower.card_lt_stepPos, Tower.heapBot, Tower.heapTop, Tower.structBot, Tower.structTop, TrafficLightColor, TrafficLightColor_cardinality, TransportLayer.application, Unit.discrete, arithFromNat_toNat, arithLang, arithLevel_negNatAbs, arithPlus_iff, arithPlus_mk_eq, arithPlus_succ, arithPlus_zero, arithStepNeg_injective, arithStepNeg_not_surjective, arithStepNeg_val, arithStepPos_val, arithStepTo_val, arithStruct, arithStruct_congr, arithSuccFun_injective, arithSucc_functional, arithSucc_iff, arithSucc_iff_eq_succFun, arithSucc_mk_eq, arithSucc_no_fixed_point, arithSucc_total, arithToNat, arithToNat_fromNat, arithToNat_mk, arithTower, arithTranslatePos_stepTo_eq, arithZero_not_succ, arithZero_unique, castSucc_not_surjective, doorBehavior, doorHeap.closed_reachable, doorHeap.opened_reachable, doorInterface, doorLanguage, getConceptsOf, instStructureDoorLanguageElemDoorStateReachableBoolDoorHeap, irrational_logb_two_five, irrational_logb_two_three, irrational_phoneNumberInformation, irrational_trafficLightInformation, no_pow_two_eq_pow_five, no_pow_two_eq_pow_three, notRule_no_fixedPoint, phoneNumberInformation_eq, phoneNumber_bits_needed, phoneNumber_cardinality, toSeq_list, toSeq_single, trafficLightInformation_eq, trafficLight_approx_two_bits, unexpandSeqAppend, unexpandToSeq

Non-dependent recursor for the equality type (symmetric variant)

abbrev Eq.ndrec_symm.{u1, u2} {α : Sort u2} {a : α} {motive : α → Sort u1} (m : motive a) {b : α}
  (h : b = a) : motive b

Equality is symmetric: if a = b then b = a.

Because this is in the Eq namespace, if you have a variable h : a = b, h.symm can be used as shorthand for Eq.symm h as a proof of b = a.

For more information: Equality

theorem Eq.symm.{u} {α : Sort u} {a b : α} (h : a = b) : b = a

Used by: ApplicationLayer.interface, BitFunction.cardinality, BitFunction.cardinality_input_growth, BitFunction.exists_settle, BitSequence.trueCount_strict, Cell.erase_not_surjective, Channel.lossless_stationary, Channel.lossy_loses_overall, Component.Arrow.setoid, Component.Hom.eqToHom_comp, Component.Hom.hexagon_reverse, Component.Hom.recast_eqToHom, Component.Simplex.toInformationSystem, Component.braidedCategory, Component.empty_parallel, Component.hexagon_forward_arrow, Component.hexagon_reverse_arrow, Component.monoidalCategory, Component.parallel, Component.parallel_assoc, Component.recast, Component.sequential, Component.symmetry, Discrete.pi, Discrete.size_eq, Fin.append_eval, Finset.sum_preimage_map_disjUnion, Frame.crc32Ethernet_detects_single_bit_flip, Frame.crcFrom_detects_single_bit_flip, Frame.crcStep_length, Frame.crcStep_poly, Frame.crc_poly_dvd, Frame.eq_of_associated_gf2, Frame.generator_not_dvd_pow, Frame.ofFn_update, Frame.reflectIndex, Frame.reflectIndex_involutive, Frame.toPoly, Frame.toPoly_append, Frame.toPoly_degree_lt, Frame.toPoly_ne_zero_of_any, Frame.toPoly_set_flip, Frame.toPoly_xor, InformationSystem.Chain, InformationSystem.Chain.length, InformationSystem.Chain.ofIsChain, InformationSystem.Environment.universe, InformationSystem.Step.bottom, InformationSystem.Step.delta_alt, InformationSystem.Step.gains, InformationSystem.Step.loses, InformationSystem.eval, InformationSystem.eval_delta, InformationSystem.eval_trichotomy, InformationSystem.exists_repeat_state, InformationSystem.gatedFlow, InformationSystem.irreversible, InformationSystem.parallel_delta, InformationSystem.roundtrip_neutral, InformationSystem.spontaneous_no_self_return, InformationSystem.toSimplex, InformationSystem.zero_run_le, InterfaceOld.Value.eq_of_heq, InterfaceOld.Value.join_disjoint, InterfaceOld.Value.join_left_right, InterfaceOld.Value.observeAll, Layer.eq_toFun_of_univalent, Layer.id_sequential, Layer.trace_naturality_right, Layer.trace_sliding, Logic.FirstOrderLogic.realize_all, Logic.FirstOrderLogic.realize_ex, Logic.FirstOrderLogic.realize_update_of_not_mem_freeVarFinset, Logic.Popper.Basis1.demonstrate_congr_conclusion, Logic.Popper.Basis1.demonstrate_congr_premise, Logic.Popper.Basis1.follows_trans, Logic.Popper.Basis1.substitutivity, Logic.Popper.Basis3.follows_toBasis1, Logic.ProofTheory.CutFree, Logic.ProofTheory.CutFree.DerivationsOf, Logic.ProofTheory.CutFree.DerivationsOf.graft, Logic.ProofTheory.CutFree.DerivationsOf.mono, Logic.ProofTheory.CutFree.DerivationsOf.toDerivationsOf, Logic.ProofTheory.CutFree.mono, Logic.ProofTheory.CutFree.toDerivation, Logic.ProofTheory.DerivableCutFree.graft, Logic.ProofTheory.Derivation, Logic.ProofTheory.Derivation.toCutFree, Logic.ProofTheory.DerivationsOf, Logic.ProofTheory.DerivationsOf.forall_toCutFree, Logic.PropositionalLogic.Formula.Derivable.deduction_aux, Logic.PropositionalLogic.Formula.demonstrate_semantic_iff_syntactic, Logic.PropositionalLogic.Formula.literal_val, Logic.PropositionalLogic.Formula.val, Logic.PropositionalLogic.HilbertSchema.isAxiom_of_ne_mp, Logic.PropositionalLogic.HilbertSchema.mp_isSimple, Logic.PropositionalLogic.NandFormula.ofFormula, Logic.PropositionalLogic.NandFormula.ofFormula_val, Logic.PropositionalLogic.NandFormula.toFormula, Logic.PropositionalLogic.NandFormula.val, Logic.PropositionalLogic.semanticConnectives, Logic.PropositionalLogic.syntacticConnectives, SeqColimit.Rel.symm, SeqColimit.freshSeq_injective, Specification.closed, Structure.Arithmetic.S_iff_add_one, Structure.Arithmetic.S_iff_succ, Structure.Arithmetic.Tower.exists_of_le_ι, Structure.Arithmetic.Tower.instArithColimit, Structure.Arithmetic.Tower.instInfiniteColimit, Structure.Arithmetic.Tower.lt_card_level, Structure.Arithmetic.Tower.same_symm, Structure.Arithmetic.Tower.same_trans, Structure.Arithmetic.Tower.sigmaLe_congr, Structure.Arithmetic.Tower.sigmaLe_up, Structure.Arithmetic.Tower.stepTo_initial, Structure.Arithmetic.Z_iff_zero, Structure.Arithmetic.Z_iff_zero_fin, Structure.Arithmetic.count_surjective, Structure.Arithmetic.finTower, Structure.Arithmetic.fixedPoint_iter, Structure.Arithmetic.instDefForallForallPropFixedPointOfPredicative, Structure.Arithmetic.instDefForallForallPropFixedPointPrimitiveOfSerialOfUnivalent, Structure.Arithmetic.instNeZeroNat_structure, Structure.Arithmetic.instPeanoNat, Structure.Arithmetic.instUnivalentRecPrimitive, Structure.Arithmetic.rec_base, Structure.Arithmetic.rec_primitive, Structure.Arithmetic.rec_step, Topology.Step.coverageFunctor, Topology.isNerveCover_inter, Topology.joinFunctor, Topology.join_preserves_connected, Topology.nerveCoverage, Topology.runArrows', Topology.step_conserves, Topology.whole, Tower.card_lt_stepNeg, Tower.card_lt_stepPos, arithPlus_iff, arithPlus_succ, arithPlus_zero, arithStepNeg, arithStepNeg_not_surjective, arithSucc_iff, arithSucc_iff_eq_succFun, arithSucc_no_fixed_point, arithToNat, arithTower, arithZero_not_succ, arithZero_unique, irrational_logb_two_five, irrational_logb_two_three, irrational_phoneNumberInformation, no_pow_two_eq_pow_five, no_pow_two_eq_pow_three, notRule_no_fixedPoint, phoneNumberInformation_eq, trafficLightInformation_eq

Equality is transitive: if a = b and b = c then a = c.

Because this is in the Eq namespace, if you have variables or expressions h₁ : a = b and h₂ : b = c, you can use h₁.trans h₂ : a = c as shorthand for Eq.trans h₁ h₂.

For more information: Equality

theorem Eq.trans.{u} {α : Sort u} {a b c : α} (h₁ : a = b) (h₂ : b = c) : a = c

Used by: ApplicationLayer.interface, BitFunction.exists_settle, BitFunction.fixedPoint_isFixed, BitFunction.iterate_stays, BitSequence.Dominates.bot, BitSequence.cardinality, BitSequence.trueCount_le, BitSequence.trueCount_strict, Cell.eraseSecondBit, Channel.lossy_loses_overall, Component.Arrow.setoid, Component.Hom.recast_eqToHom, Component.Hom.recast_recast, Component.empty, Component.empty_parallel, Component.hexagon_forward_arrow, Component.hexagon_reverse_arrow, Component.id, Component.monoidalCategory, Component.parallel, Component.parallel_assoc, Component.parallel_comm, Component.parallel_empty, Component.recast, Component.recast_recast, Fin.append_eval, Finset.sum_preimage_map_disjUnion, Frame.crc32Ethernet_detects_single_bit_flip, Frame.crcFrom_detects_single_bit_flip, Frame.crcStep_length, Frame.crcStep_poly, Frame.crc_detects_single_bit_flip, Frame.crc_poly_dvd, Frame.ofFn_update, Frame.pos_length_of_any, Frame.reflectIndex, Frame.reflectIndex_involutive, Frame.toPoly_append, Frame.toPoly_degree_lt, Frame.toPoly_ne_zero_of_any, Frame.toPoly_replicate_false, Frame.toPoly_set_flip, Frame.toPoly_xor, Heap.create_delete, InformationSystem.Chain.ofIsChain, InformationSystem.eval_append, InformationSystem.eval_delta, InformationSystem.exists_repeat_state, InformationSystem.gatedFlow, InformationSystem.gatedFlow_success_AB, InformationSystem.gatedFlow_success_BA, InformationSystem.not_spontaneous_and_perpetuous, InformationSystem.sequential_delta, InformationSystem.spontaneous_no_self_return, InterfaceOld.Value.join, InterfaceOld.Value.join_disjoint, InterfaceOld.Value.join_fired_inl, InterfaceOld.Value.join_fired_inr, InterfaceOld.tensor, InterfaceOld.unit.Value.subsingleton, Layer.id_rel, Layer.id_sequential, Layer.parallel_rel, Layer.sequential_id, Layer.sequential_rel, Layer.trace_naturality_left, Layer.trace_naturality_right, Layer.trace_sliding, Layer.trace_superposing, Layer.trace_vanishing, Layer.trace_yanking, Logic.FirstOrderLogic.basis3ext, Logic.FirstOrderLogic.realize_SUB, Logic.FirstOrderLogic.realize_all, Logic.FirstOrderLogic.realize_ex, Logic.Popper.Basis1.contract, Logic.Popper.Basis1.demonstrate_of_contradictory, Logic.Popper.Basis1.demonstrate_singleton, Logic.Popper.Basis1.exchange, Logic.Popper.Basis1.follows_refl, Logic.Popper.Basis1.follows_trans, Logic.Popper.Basis3.follows_toBasis1, Logic.ProofTheory.CutFree.DerivationsOf.of_forall, Logic.ProofTheory.Derivation.toCutFree, Logic.ProofTheory.DerivationsOf.of_forall, Logic.ProofTheory.Schema.IsSimpleRule.of_isAxiom, Logic.PropositionalLogic.Formula.bigAnd_val, Logic.PropositionalLogic.Formula.bigOr_val, Logic.PropositionalLogic.Formula.eliminate, Logic.PropositionalLogic.Formula.entails_of_and_cases_syntactic, Logic.PropositionalLogic.Formula.entails_of_entails_neg_contra, Logic.PropositionalLogic.Formula.entails_of_or_cases_syntactic, Logic.PropositionalLogic.Formula.kalmar, Logic.PropositionalLogic.Formula.literal_val, Logic.PropositionalLogic.Formula.minterm_val, Logic.PropositionalLogic.Formula.or_entails_left, Logic.PropositionalLogic.Formula.or_entails_right, Logic.PropositionalLogic.Formula.provable_contrapose, Logic.PropositionalLogic.Formula.provable_deMorgan_or, Logic.PropositionalLogic.Formula.provable_dni, Logic.PropositionalLogic.Formula.provable_explosion, Logic.PropositionalLogic.Formula.provable_lem, Logic.PropositionalLogic.Formula.semantic_iff_provable, Logic.PropositionalLogic.Formula.soundness, Logic.PropositionalLogic.Formula.val_falsum', Logic.PropositionalLogic.Formula.val_verum', Logic.PropositionalLogic.HilbertSchema.mp_isSimple, Logic.PropositionalLogic.NandFormula.exists_nand_of_boolFun, Logic.PropositionalLogic.NandFormula.ofFormula_val, Logic.PropositionalLogic.NandFormula.toFormula_val, Logic.PropositionalLogic.semanticConnectives, Logic.PropositionalLogic.syntacticConnectives, Receiver.step, Sender.step, SeqColimit.Rel.trans, Specification.terminalCone, Structure.Arithmetic.S_iff_add_one, Structure.Arithmetic.S_iff_succ, Structure.Arithmetic.Tower.instInfiniteColimit, Structure.Arithmetic.Tower.lt_card_level, Structure.Arithmetic.Tower.stepTo_bot, Structure.Arithmetic.Tower.stepTo_initial, Structure.Arithmetic.Tower.stepTo_le_iff, Structure.Arithmetic.Tower.ι_stepTo, Structure.Arithmetic.Z_iff_zero, Structure.Arithmetic.exists_S_of_not_Z, Structure.Arithmetic.finTower, Structure.Arithmetic.instArithFin, Structure.Arithmetic.instDefForallForallPropFixedPointPrimitiveOfSerialOfUnivalent, Structure.Arithmetic.instDefS, Structure.Arithmetic.instNeZeroNat_structure, Structure.Arithmetic.instPeanoNat, Structure.Arithmetic.instUnivalentRecPrimitive, Structure.Arithmetic.rec_base, Structure.Arithmetic.rec_step, Topology.isNerveCover_inter, Topology.join_preserves_connected, Topology.step_conserves, Topology.whole_adj_of_internal, arithLevel_negNatAbs, arithPlus_iff, arithPlus_succ, arithPlus_zero, arithSucc_iff, arithSucc_no_fixed_point, arithTower, arithZero_not_succ, irrational_logb_two_five, irrational_logb_two_three, no_pow_two_eq_pow_five, no_pow_two_eq_pow_three, phoneNumberInformation_eq, phoneNumber_cardinality

Except ε α is a type which represents either an error of type ε or a successful result with a value of type α.

Except ε : Type u → Type v is a Monad that represents computations that may throw exceptions: the pure operation is Except.ok and the bind operation returns the first encountered Except.error.

inductive Except.{u, v} (ε : Type u) (α : Type v) : Type (max u v)

False is the empty proposition. Thus, it has no introduction rules. It represents a contradiction. False elimination rule, False.rec, expresses the fact that anything follows from a contradiction. This rule is sometimes called ex falso (short for ex falso sequitur quodlibet), or the principle of explosion. For more information: Propositional Logic

inductive False : Prop

Used by: BitSequence.Dominates.bot, BitSequence.trueCount_strict, Cell.erase_not_injective, Class.not_reactive_and_active, Component.hexagon_forward_arrow, Component.hexagon_reverse_arrow, Component.parallel_assoc, DataLinkLayer.network, DataLinkLayer.physical, Fin.append_eval, Finset.sum_preimage_map_disjUnion, Frame.crc32Ethernet_detects_single_bit_flip, Frame.crcStep_length, Frame.crcStep_poly, Frame.generator_not_dvd_pow, Frame.ofFn_update, Frame.pos_length_of_any, Frame.reflectIndex, Frame.reflectIndex_involutive, Frame.toPoly_ne_zero_of_any, Frame.toPoly_set_flip, Frame.toPoly_xor, InformationSystem.Chain.ofIsChain, InformationSystem.gatedFlow_success_AB, InformationSystem.gatedFlow_success_BA, InformationSystem.irreversible, InformationSystem.not_spontaneous_and_perpetuous, InformationSystem.spontaneous_no_self_return, InterfaceOld.Value.join, InterfaceOld.Value.join_disjoint, InterfaceOld.Value.join_fired_inl, InterfaceOld.Value.join_fired_inr, InterfaceOld.tensor, InterfaceOld.unit.Value.subsingleton, Logic.Popper.Basis1.demonstrate_of_contradictory, Logic.Popper.Basis1.demonstrate_singleton, Logic.Popper.Basis1.follows_refl, Logic.Popper.Basis1.follows_trans, Logic.Popper.Basis3.follows_toBasis1, Logic.ProofTheory.Derivation.toCutFree, Logic.ProofTheory.Schema.IsSimpleRule.of_isAxiom, Logic.PropositionalLogic.Formula.bigAnd_val, Logic.PropositionalLogic.Formula.bigOr_val, Logic.PropositionalLogic.Formula.eliminate, Logic.PropositionalLogic.Formula.entails_of_and_cases_syntactic, Logic.PropositionalLogic.Formula.entails_of_or_cases_syntactic, Logic.PropositionalLogic.Formula.kalmar, Logic.PropositionalLogic.Formula.literal_val, Logic.PropositionalLogic.Formula.provable_contrapose, Logic.PropositionalLogic.Formula.provable_deMorgan_or, Logic.PropositionalLogic.Formula.provable_dni, Logic.PropositionalLogic.Formula.provable_explosion, Logic.PropositionalLogic.Formula.provable_lem, Logic.PropositionalLogic.HilbertSchema.mp_isSimple, Logic.PropositionalLogic.semanticConnectives, Logic.PropositionalLogic.syntacticConnectives, NetworkLayer.forwards, NetworkLayer.transport, SeqColimit.freshSeq_lt_ne, Structure.Arithmetic.S_iff_add_one, Structure.Arithmetic.S_iff_succ, Structure.Arithmetic.exists_S_of_not_Z, Structure.Arithmetic.finTower, Structure.Arithmetic.instArithFin, Structure.Arithmetic.instDefForallForallPropFixedPointPrimitiveOfSerialOfUnivalent, Structure.Arithmetic.instPeanoNat, Structure.Arithmetic.lt_wf, Structure.Arithmetic.rec_base, Structure.Arithmetic.rec_step, arithPlus_succ, arithPlus_zero, arithStepNeg_not_surjective, arithStruct, arithStruct_congr, arithTower, castSucc_not_surjective, doorClass, instIsEmptyPortsUnit_computerChips, irrational_logb_two_five, irrational_logb_two_three, no_pow_two_eq_pow_five, no_pow_two_eq_pow_three, notRule_no_fixedPoint

False.elim : False → C says that from False, any desired proposition C holds. Also known as ex falso quodlibet (EFQ) or the principle of explosion.

The target type is actually C : Sort u which means it works for both propositions and types. When executed, this acts like an “unreachable” instruction: it is undefined behavior to run, but it will probably print “unreachable code”. (You would need to construct a proof of false to run it anyway, which you can only do using sorry or unsound axioms.)

def False.elim.{u} {C : Sort u} (h : False) : C

Natural numbers less than some upper bound.

In particular, a Fin n is a natural number i with the constraint that i < n. It is the canonical type with n elements.

structure Fin (n : ℕ) : Type

Used by: AddressResolution, ApplicationLayer.interface, BitFunction, BitFunction.IsFixedPoint, BitFunction.cardinality, BitFunction.cardinality_input_growth, BitFunction.cardinality_output_growth, BitFunction.comp, BitFunction.exists_settle, BitFunction.fixedPoint_isFixed, BitFunction.iterate, BitFunction.iterate_dominates_succ, BitFunction.iterate_stays, BitSequence, BitSequence.Dominates, BitSequence.Dominates.bot, BitSequence.cardinality, BitSequence.trueCount, BitSequence.trueCount_le, BitSequence.trueCount_strict, Channel, Channel.lossless_stationary, Channel.lossy_loses_overall, Component, Component.Arrow, Component.Arrow.Equiv, Component.Arrow.setoid, Component.Hom.tensor_id_id, Component.Simplex.toInformationSystem, Component.empty, Component.empty_parallel, Component.equivalent_of_stationary, Component.hexagon_forward_arrow, Component.hexagon_reverse_arrow, Component.id, Component.id_sequential, Component.interchange, Component.monoidalCategory, Component.parallel, Component.parallel_assoc, Component.parallel_comm, Component.parallel_congr, Component.parallel_empty, Component.recast, Component.recast_congr, Component.sequential, Component.sequential_assoc, Component.sequential_congr, Component.sequential_id, Component.symmetry, Component.symmetry_symmetry, DataLinkLayer.network, DataLinkLayer.physical, Discrete.pi, Fin.append_eval, Frame, Frame.crc32Ethernet, Frame.crc32EthernetPoly, Frame.crc32Ethernet_detects_single_bit_flip, Frame.crcFrom_detects_single_bit_flip, Frame.crc_detects_single_bit_flip, Frame.make, Frame.make_valid, Frame.ofFn_update, Frame.reflectEquiv, Frame.reflectEquiv_symm, Frame.reflectIndex, Frame.reflectIndex_involutive, Frame.toPoly_set_flip, Frame.valid, InformationSystem.exists_repeat_state, InformationSystem.parallel_delta, InformationSystem.sequential_delta, InformationSystem.toSimplex, InterfaceOld.Value.observe, InterfaceOld.Value.observeAll, InterfaceOld.homogeneous, Logic.FirstOrderLogic.realize_SUB, Logic.FirstOrderLogic.realize_update_of_not_mem_freeVarFinset, Logic.PropositionalLogic.BoolFun, Logic.PropositionalLogic.Formula.bigAnd, Logic.PropositionalLogic.Formula.bigAnd_val, Logic.PropositionalLogic.Formula.bigOr, Logic.PropositionalLogic.Formula.bigOr_val, Logic.PropositionalLogic.Formula.completeness, Logic.PropositionalLogic.Formula.demonstrate_bigAnd_cons, Logic.PropositionalLogic.Formula.demonstrate_bigOr_cons, Logic.PropositionalLogic.Formula.demonstrate_semantic_iff_syntactic, Logic.PropositionalLogic.Formula.dnf, Logic.PropositionalLogic.Formula.dnf_val, Logic.PropositionalLogic.Formula.eliminate, Logic.PropositionalLogic.Formula.exists_andOrNot_of_boolFun, Logic.PropositionalLogic.Formula.falsum', Logic.PropositionalLogic.Formula.kalmar, Logic.PropositionalLogic.Formula.literal, Logic.PropositionalLogic.Formula.literal_val, Logic.PropositionalLogic.Formula.minterm, Logic.PropositionalLogic.Formula.minterm_val, Logic.PropositionalLogic.Formula.semantic_iff_provable, Logic.PropositionalLogic.Formula.starred, Logic.PropositionalLogic.Formula.syntactic_iff_provable, Logic.PropositionalLogic.Formula.val_falsum', Logic.PropositionalLogic.Formula.val_verum', Logic.PropositionalLogic.Formula.verum', Logic.PropositionalLogic.Formula.witness, Logic.PropositionalLogic.NandFormula.exists_nand_of_boolFun, NetworkLayer.interface, NetworkLayer.resolves, PhoneNumber, Receiver.step, Receiver.step_correct, Sender.step, Structure.Arithmetic.S_iff_add_one, Structure.Arithmetic.Z_iff_zero_fin, Structure.Arithmetic.finTower, Structure.Arithmetic.instArithFin, Structure.Arithmetic.instNonPeanoFin, Topology.runGrothendieck, Tower, Tower.structBot, Tower.structTop, TransportLayer.interface, arithLevel, arithPlus_iff, arithStepNeg_injective, arithStepNeg_not_surjective, arithStepTo_val, arithStruct, arithStruct_congr, arithSucc_iff, arithToNat_mk, arithTower, castSucc_not_surjective, instNonemptyForallFin_computerNetworks, instNonemptyFrame, instNormForallFin_computerNetworks, instNormFrame, instNormNonnegForallFin, instStructureDoorLanguageElemDoorStateReachableBoolDoorHeap, notRule, notRule_no_fixedPoint, phoneNumberInformation, phoneNumberInformation_eq, phoneNumber_bits_needed, phoneNumber_cardinality, trafficLight_approx_two_bits

Function composition, usually written with the infix operator ∘. A new function is created from two existing functions, where one function’s output is used as input to the other.

Examples: * Function.comp List.reverse (List.drop 2) [3, 2, 4, 1] = [1, 4] * (List.reverse ∘ List.drop 2) [3, 2, 4, 1] = [1, 4]

Conventions for notations in identifiers:

  • The recommended spelling of ∘ in identifiers is comp.
def Function.comp.{u, v, w} {α : Sort u} {β : Sort v} {δ : Sort w} (f : β → δ) (g : α → β) : α → δ

a ≥ b is an abbreviation for b ≤ a.

Conventions for notations in identifiers:

  • The recommended spelling of ≥ in identifiers is ge.
def GE.ge.{u} {α : Type u} [LE α] (a b : α) : Prop

Used by: Fin.append_eval

Heterogeneous equality. a ≍ b asserts that a and b have the same type, and casting a across the equality yields b, and vice versa.

You should avoid using this type if you can. Heterogeneous equality does not have all the same properties as Eq, because the assumption that the types of a and b are equal is often too weak to prove theorems of interest. One public important non-theorem is the analogue of congr: If f ≍ g and x ≍ y and f x and g y are well typed it does not follow that f x ≍ g y. (This does follow if you have f = g instead.) However if a and b have the same type then a = b and a ≍ b are equivalent.

Conventions for notations in identifiers:

  • The recommended spelling of ≍ in identifiers is heq.
inductive HEq.{u} {α : Sort u} : α → {β : Sort u} → β → Prop

Used by: AddressResolution, Behavior, Channel, Class, Component.Arrow, Creation, Destruction, FiniteStateMachine, ForwardingTable, Frame, Frame.toPoly_xor, Heap, HeapCover, InformationSystem, InformationSystem.Chain, InformationSystem.Chain.length, InformationSystem.Environment, InformationSystem.Run, InformationSystem.Step, InformationSystem.equivalent_output, InformationSystem.equivalent_step, Interface, InterfaceOld, InterfaceOld.Value, InterfaceOld.Value.eq_of_heq, InterfaceOld.Value.ext_of_fired_eq, InterfaceOld.unit.Value.subsingleton, Internal, Logic.FirstOrderLogic.realize_all, Logic.FirstOrderLogic.realize_ex, Logic.Popper.Basis1, Logic.Popper.Basis1.HasClassicalConnectives, Logic.Popper.Basis1.HasClassicalNegation, Logic.Popper.Basis1.HasConjunction, Logic.Popper.Basis1.HasDisjunction, Logic.Popper.Basis1.HasExistential, Logic.Popper.Basis1.HasImplication, Logic.Popper.Basis1.HasIntuitionisticNegation, Logic.Popper.Basis1.HasUniversal, Logic.Popper.Basis1.substitutivity, Logic.Popper.Basis3, Logic.Popper.HasSubstitution, Logic.ProofTheory.Application, Logic.ProofTheory.CutFree, Logic.ProofTheory.CutFree.DerivationsOf, Logic.ProofTheory.CutFree.DerivationsOf.graft, Logic.ProofTheory.CutFree.DerivationsOf.mono, Logic.ProofTheory.CutFree.DerivationsOf.toDerivationsOf, Logic.ProofTheory.CutFree.mono, Logic.ProofTheory.CutFree.toDerivation, Logic.ProofTheory.DerivableCutFree.graft, Logic.ProofTheory.Derivation, Logic.ProofTheory.Derivation.toCutFree, Logic.ProofTheory.DerivationsOf, Logic.ProofTheory.DerivationsOf.forall_toCutFree, Logic.ProofTheory.ProofSystem, Logic.ProofTheory.Schema, Logic.PropositionalLogic.Formula, Logic.PropositionalLogic.HilbertSchema.isAxiom_of_ne_mp, Logic.PropositionalLogic.NandFormula, Mereology, NetworkArchitecture, NormalBehavior, Object, Ontology.empty_wellFormed, Packet, Segment, Structure.Arithmetic.Arith, Structure.Arithmetic.NonPeano, Structure.Arithmetic.Peano, Structure.Arithmetic.Tower, ToSeq, Topology, Topology.Event, Topology.runArrows', Topology.whole_adj_of_internal, Tower, arithPlus_iff, arithSucc_iff

A macro scope identifier is just a Nat that gets bumped every time we enter a new macro scope. Within a macro scope, all occurrences of identifier x parse to the same thing, but x parsed from different macro scopes will produce different identifiers.

abbrev Lean.MacroScope : Type

Construct a synthetic SourceInfo from the ref in the monad state.

def Lean.MonadRef.mkInfoFromRefPos {m : Type → Type} [Monad m] [MonadRef m] : m SourceInfo

Hierarchical names consist of a sequence of components, each of which is either a string or numeric, that are written separated by dots (.).

Hierarchical names are used to name declarations and for creating unique identifiers for free variables and metavariables.

You can create hierarchical names using a backtick:

`Lean.Meta.whnf

It is short for .str (.str (.str .anonymous "Lean") "Meta") "whnf".

You can use double backticks to request Lean to statically check whether the name corresponds to a Lean declaration in scope.

``Lean.Meta.whnf

If the name is not in scope, Lean will report an error.

There are two ways to convert a String to a Name:

  1. Name.mkSimple creates a name with a single string component.

  2. String.toName first splits the string into its dot-separated components, and then creates a hierarchical name.

inductive Lean.Name : Type

Make name s₁.s₂.s₃.s₄

def Lean.Name.mkStr4 (s₁ s₂ s₃ s₄ : String) : Name

A ParserDescr is a grammar for parsers. This is used by the syntax command to produce parsers without having to import Lean.

inductive Lean.ParserDescr : Type

The unexpander monad, essentially Syntax → Option α. The Syntax is the ref, and it has the possibility of failure without an error message.

abbrev Lean.PrettyPrinter.UnexpandM (α : Type) : Type

Function that tries to reverse macro expansions as a post-processing step of delaboration. While less general than an arbitrary delaborator, it can be declared without importing Lean. Used by the [app_unexpander] attribute.

abbrev Lean.PrettyPrinter.Unexpander : Type

Source information that relates syntax to the context that it came from.

The primary purpose of SourceInfo is to relate the output of the parser and the macro expander to the original source file. When produced by the parser, Syntax.node does not carry source info; the parser associates it only with atoms and identifiers. If a Syntax.node is introduced by a quotation, then it has synthetic source info that both associates it with an original reference position and indicates that the original atoms in it may not originate from the Lean file under elaboration.

Source info is also used to relate Lean’s output to the internal data that it represents; this is the basis for many interactive features. When used this way, it can occur on Syntax.node as well.

inductive Lean.SourceInfo : Type

Lean syntax trees.

Syntax trees are used pervasively throughout Lean: they are produced by the parser, transformed by the macro expander, and elaborated. They are also produced by the delaborator and presented to users.

inductive Lean.Syntax : Type

An array of syntax elements that alternate with the given separator. Each syntax element has a kind drawn from ks.

Separator arrays result from repetition operators such as ,*. Coercions to and from Array (TSyntax ks) insert or remove separators as required. The untyped equivalent is Lean.Syntax.SepArray.

structure Lean.Syntax.TSepArray (ks : SyntaxNodeKinds) (sep : String) : Type

Gets the i’th argument of the syntax node. This can also be written stx[i]. Returns missing if i is out of range.

def Lean.Syntax.getArg (stx : Syntax) (i : ℕ) : Syntax

Gets the list of arguments of the syntax node, or #[] if it’s not a node.

def Lean.Syntax.getArgs (stx : Syntax) : Array Syntax

Checks whether syntax has the given kind or pseudo-kind.

“Pseudo-kinds” are kinds that are assigned by convention to non-Syntax.node values: identKind for Syntax.ident, `missing for Syntax.missing, and the atom’s string literal for atoms.

def Lean.Syntax.isOfKind (stx : Syntax) (k : SyntaxNodeKind) : Bool

Is this syntax a null node?

def Lean.Syntax.matchesNull (stx : Syntax) (n : ℕ) : Bool

Create syntax node with 1 child

def Lean.Syntax.node1 (info : SourceInfo) (kind : SyntaxNodeKind) (a₁ : Syntax) : Syntax

Used by: unexpandToSeq

Create syntax node with 3 children

def Lean.Syntax.node3 (info : SourceInfo) (kind : SyntaxNodeKind) (a₁ a₂ a₃ : Syntax) : Syntax

Specifies the interpretation of a Syntax.node value. An abbreviation for Name.

Node kinds may be any name, and do not need to refer to declarations in the environment. Conventionally, however, a node’s kind corresponds to the Parser or ParserDesc declaration that produces it. There are also a number of built-in node kinds that are used by the parsing infrastructure, such as nullKind and choiceKind; these do not correspond to parser declarations.

abbrev Lean.SyntaxNodeKind : Type

Typed syntax, which tracks the potential kinds of the Syntax it contains.

While syntax quotations produce or expect TSyntax values of the correct kinds, this is not otherwise enforced; it can easily be circumvented by direct use of the constructor.

structure Lean.TSyntax (ks : SyntaxNodeKinds) : Type

An array of syntaxes of kind ks.

abbrev Lean.TSyntaxArray (ks : SyntaxNodeKinds) : Type

Linked lists: ordered lists, in which each element has a reference to the next element.

Most operations on linked lists take time proportional to the length of the list, because each element must be traversed to find the next element.

List α is isomorphic to Array α, but they are useful for different things: * List α is easier for reasoning, and Array α is modeled as a wrapper around List α. * List α works well as a persistent data structure, when many copies of the tail are shared. When the value is not shared, Array α will have better performance because it can do destructive updates.

inductive List.{u} (α : Type u) : Type u

Used by: Channel.lossy_loses_overall, Channel.overall_loss, Component.Arrow.setoid, Component.Hom.tensor_id_id, Component.empty_parallel, Component.equivalent_of_stationary, Component.id_sequential, Component.interchange, Component.monoidalCategory, Component.parallel_assoc, Component.parallel_comm, Component.parallel_congr, Component.parallel_empty, Component.recast_congr, Component.sequential_assoc, Component.sequential_congr, Component.sequential_id, Component.symmetry_symmetry, DataLinkLayer.interface, DataLinkLayer.links, DataLinkLayer.network, DataLinkLayer.physical, Frame, Frame.crc, Frame.crc32Ethernet, Frame.crc32EthernetPoly, Frame.crc32Ethernet_detects_single_bit_flip, Frame.crcFrom, Frame.crcFrom_detects_single_bit_flip, Frame.crcStep, Frame.crcStep_length, Frame.crcStep_poly, Frame.crc_detects_single_bit_flip, Frame.crc_poly_dvd, Frame.generator_not_dvd_pow, Frame.make, Frame.make_valid, Frame.ofFn_update, Frame.pos_length_of_any, Frame.toPoly, Frame.toPoly_append, Frame.toPoly_degree_lt, Frame.toPoly_ne_zero_of_any, Frame.toPoly_set_flip, Frame.toPoly_xor, Frame.valid, InformationSystem.Chain.ofIsChain, InformationSystem.Run, InformationSystem.Run.trajectory, InformationSystem.equivalent, InformationSystem.equivalent_output, InformationSystem.equivalent_step, InformationSystem.eval, InformationSystem.eval_append, InformationSystem.eval_delta, InformationSystem.eval_trichotomy, InformationSystem.exists_repeat_equivalent, InformationSystem.exists_repeat_state, InformationSystem.not_spontaneous_and_perpetuous, InformationSystem.perpetuous, InformationSystem.perpetuous_coherent, InformationSystem.roundtrip_neutral, InformationSystem.spontaneous_no_self_return, InformationSystem.zero_run_le, List.totalSize, Logic.Popper.Basis1, Logic.Popper.Basis1.Complementary, Logic.Popper.Basis1.Contradictory, Logic.Popper.Basis1.Demonstrate, Logic.Popper.Basis1.IsClassicalNegation, Logic.Popper.Basis1.IsConjunction, Logic.Popper.Basis1.IsDisjunction, Logic.Popper.Basis1.IsImplication, Logic.Popper.Basis1.IsIntuitionisticNegation, 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_contradictory, 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.forall₂_mutual_refl, 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.mono, Logic.Popper.Basis1.substitutivity, Logic.Popper.Basis1.totalBasis1, Logic.Popper.Basis1.weaken, Logic.Popper.Basis3.follows_toBasis1, Logic.Popper.Basis3.toBasis1, Logic.ProofTheory.Application, 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.mono, Logic.ProofTheory.CutFree.toDerivation, Logic.ProofTheory.Derivable, Logic.ProofTheory.DerivableCutFree, Logic.ProofTheory.DerivableCutFree.graft, Logic.ProofTheory.Derivation, Logic.ProofTheory.Derivation.toCutFree, Logic.ProofTheory.DerivationsOf, Logic.ProofTheory.DerivationsOf.forall_toCutFree, Logic.ProofTheory.DerivationsOf.of_forall, Logic.ProofTheory.Instances, Logic.ProofTheory.Schema, Logic.ProofTheory.Schema.IsAxiom, Logic.ProofTheory.Schema.IsSimpleRule, Logic.ProofTheory.Schema.IsSimpleRule.of_isAxiom, Logic.ProofTheory.Schema.instance, Logic.ProofTheory.derivable_iff_derivableCutFree, Logic.ProofTheory.toBasis1, Logic.PropositionalLogic.Formula.Derivable, Logic.PropositionalLogic.Formula.Derivable.ax, Logic.PropositionalLogic.Formula.Derivable.case_split, Logic.PropositionalLogic.Formula.Derivable.deduction, Logic.PropositionalLogic.Formula.Derivable.deduction_aux, Logic.PropositionalLogic.Formula.Derivable.toProofSystem, Logic.PropositionalLogic.Formula.Derivable.weaken, Logic.PropositionalLogic.Formula.bigAnd, Logic.PropositionalLogic.Formula.bigAnd_val, Logic.PropositionalLogic.Formula.bigOr, Logic.PropositionalLogic.Formula.bigOr_val, Logic.PropositionalLogic.Formula.demonstrate_bigAnd_cons, Logic.PropositionalLogic.Formula.demonstrate_bigOr_cons, Logic.PropositionalLogic.Formula.demonstrate_semantic_iff_syntactic, Logic.PropositionalLogic.Formula.dnf_val, Logic.PropositionalLogic.Formula.eliminate, Logic.PropositionalLogic.Formula.entails_of_and_cases_syntactic, Logic.PropositionalLogic.Formula.entails_of_or_cases_syntactic, Logic.PropositionalLogic.Formula.kalmar, Logic.PropositionalLogic.Formula.lift_provable, Logic.PropositionalLogic.Formula.minterm_val, Logic.PropositionalLogic.Formula.provable_contrapose, Logic.PropositionalLogic.Formula.provable_deMorgan_or, Logic.PropositionalLogic.Formula.provable_dni, Logic.PropositionalLogic.Formula.provable_explosion, Logic.PropositionalLogic.Formula.provable_lem, Logic.PropositionalLogic.Formula.soundness, Logic.PropositionalLogic.HilbertSchema, Logic.PropositionalLogic.HilbertSchema.isAxiom_of_ne_mp, Logic.PropositionalLogic.HilbertSchema.mp_isSimple, Logic.PropositionalLogic.derivable_mp, Logic.PropositionalLogic.derivation_of_axiom, Logic.PropositionalLogic.semanticConnectives, Logic.PropositionalLogic.syntacticConnectives, NetworkArchitecture, NetworkArchitecture.application, NetworkArchitecture.dataLink, NetworkArchitecture.network, NetworkArchitecture.physical, NetworkArchitecture.stack, NetworkArchitecture.transport, NetworkLayer.resolves, Ontology, Ontology.decidableWellFormed, Ontology.empty_wellFormed, Ontology.readFile, Ontology.wellFormed, Receiver.step, Receiver.step_correct, Sender.step, ToSeq, arithPlus_iff, arithSucc_iff, getConceptsOf, instNonemptyFrame, instNormFrame, instToSeqList, qualityOf, resolveRelation, toSeq_list, toSeq_single

Appends two lists. Normally used via the ++ operator.

Appending lists takes time proportional to the length of the first list: O(|xs|).

Examples: * [1, 2, 3] ++ [4, 5] = [1, 2, 3, 4, 5]. * [] ++ [4, 5] = [4, 5]. * [1, 2, 3] ++ [] = [1, 2, 3].

def List.append.{u_1} {α : Type u_1} (xs ys : List α) : List α

Folds a function over a list from the left, accumulating a value starting with init. The accumulated value is combined with the each element of the list in order, using f.

Examples: * [a, b, c].foldl f z = f (f (f z a) b) c * [1, 2, 3].foldl (· ++ toString ·) "" = "123" * [1, 2, 3].foldl (s!"({·} {·})") "" = "((( 1) 2) 3)"

def List.foldl.{u, v} {α : Type u} {β : Type v} (f : α → β → α) (init : α) : List β → α

Replaces the value at (zero-based) index n in l with a. If the index is out of bounds, then the list is returned unmodified.

Examples: * ["water", "coffee", "soda", "juice"].set 1 "tea" = ["water", "tea", "soda", "juice"] * ["water", "coffee", "soda", "juice"].set 4 "tea" = ["water", "coffee", "soda", "juice"]

def List.set.{u_1} {α : Type u_1} (l : List α) (n : ℕ) (a : α) : List α

Converts a List α into an Array α.

O(|xs|). At runtime, this operation is implemented by List.toArrayImpl and takes time linear in the length of the list. List.toArray should be used instead of Array.mk.

Examples: * [1, 2, 3].toArray = #[1, 2, 3] * ["monday", "wednesday", friday"].toArray = #["monday", "wednesday", friday"].

abbrev List.toArray.{u_1} {α : Type u_1} (xs : List α) : Array α

The typeclass behind the notation a ∈ s : Prop where a : α, s : γ. Because α is an outParam, the “container type” γ determines the type of the elements of the container.

structure Membership.{u, v} (α : outParam (Type u)) (γ : Type v) : Type (max u v)

The natural numbers, starting at zero.

This type is special-cased by both the kernel and the compiler, and overridden with an efficient implementation. Both use a fast arbitrary-precision arithmetic library (usually GMP); at runtime, Nat values that are sufficiently small are unboxed.

inductive Nat : Type

Used by: AddressResolution, ApplicationLayer.Op, ApplicationLayer.Value, ApplicationLayer.interface, Bit.discrete, BitFunction, BitFunction.IsFixedPoint, BitFunction.Monotone, BitFunction.cardinality, BitFunction.cardinality_input_growth, BitFunction.cardinality_output_growth, BitFunction.comp, BitFunction.comp_assoc, BitFunction.exists_isFixedPoint, BitFunction.exists_settle, BitFunction.fixedPoint, BitFunction.fixedPoint_isFixed, BitFunction.iterate, BitFunction.iterate_dominates_succ, BitFunction.iterate_settles, BitFunction.iterate_stays, BitSequence, BitSequence.Dominates, BitSequence.Dominates.bot, BitSequence.cardinality, BitSequence.trueCount, BitSequence.trueCount_le, BitSequence.trueCount_strict, Bool.discrete, Channel, Channel.lossless_stationary, Channel.lossy_loses_overall, Class, Component, Component.Arrow, Component.Arrow.Equiv, Component.Arrow.setoid, Component.Demultiplex, Component.Hom, Component.Hom.comp, Component.Hom.comp_assoc, Component.Hom.comp_eqToHom, Component.Hom.comp_id, Component.Hom.eqToHom_comp, Component.Hom.eqToHom_eq_recast_id, Component.Hom.hexagon_forward, Component.Hom.hexagon_reverse, Component.Hom.id, Component.Hom.id_comp, Component.Hom.recast, Component.Hom.recast_eqToHom, Component.Hom.recast_recast, Component.Hom.symmetry, Component.Hom.symmetry_symmetry, Component.Hom.tensor, Component.Hom.tensorUnit, Component.Hom.tensor_assoc, Component.Hom.tensor_comm, Component.Hom.tensor_comp_tensor, Component.Hom.tensor_empty, Component.Hom.tensor_id_id, Component.Hom.tensor_recast_left, Component.Hom.tensor_recast_right, Component.Multiplex, Component.PROP, Component.Simplex, Component.Simplex.toInformationSystem, Component.braidedCategory, Component.braiding, Component.braiding_naturality_left, Component.braiding_naturality_right, Component.category, Component.empty, Component.empty_parallel, Component.equivalent_of_stationary, Component.hexagon_forward_arrow, Component.hexagon_reverse_arrow, Component.id, Component.id_sequential, Component.interchange, Component.monoidalCategory, Component.monoidalCategoryStruct, Component.parallel, Component.parallel_assoc, Component.parallel_comm, Component.parallel_congr, Component.parallel_empty, Component.recast, Component.recast_congr, Component.recast_parallel_left, Component.recast_parallel_right, Component.recast_recast, Component.sequential, Component.sequential_assoc, Component.sequential_congr, Component.sequential_id, Component.symmetry, Component.symmetry_symmetry, Concept, DataLinkLayer.interface, DataLinkLayer.links, DataLinkLayer.network, DataLinkLayer.physical, Difficulty, Discrete, Discrete.pi, Discrete.prod, Discrete.size, Discrete.size_eq, DoorState, Fin.append_eval, FiniteStateMachine, ForwardingTable, Frame, Frame.crc32Ethernet, Frame.crc32EthernetPoly, Frame.crc32Ethernet_detects_single_bit_flip, Frame.crcFrom_detects_single_bit_flip, Frame.crcStep_length, Frame.crcStep_poly, Frame.crc_detects_single_bit_flip, Frame.crc_poly_dvd, Frame.eq_of_associated_gf2, Frame.generator_not_dvd_pow, Frame.make, Frame.make_valid, Frame.ofFn_update, Frame.pos_length_of_any, Frame.reflectEquiv, Frame.reflectEquiv_symm, Frame.reflectIndex, Frame.reflectIndex_involutive, Frame.toPoly, Frame.toPoly_append, Frame.toPoly_degree_lt, Frame.toPoly_ne_zero_of_any, Frame.toPoly_one_add_one, Frame.toPoly_replicate_false, Frame.toPoly_set_flip, Frame.toPoly_xor, Frame.valid, HeapCover, Icmp, InformationSystem, InformationSystem.Chain, InformationSystem.Chain.length, InformationSystem.Environment, InformationSystem.Environment.universe, InformationSystem.Run, InformationSystem.Step, InformationSystem.Step.bottom, InformationSystem.Step.delta_alt, InformationSystem.Step.gains, InformationSystem.Step.loses, InformationSystem.eval_delta, InformationSystem.exists_repeat_equivalent, InformationSystem.exists_repeat_state, InformationSystem.parallel, InformationSystem.parallel_delta, InformationSystem.roundtrip_neutral, InformationSystem.sequential, InformationSystem.sequential_delta, InformationSystem.spontaneous_no_self_return, InformationSystem.toSimplex, InformationSystem.zero_run_le, Interface, InterfaceOld, InterfaceOld.Value, InterfaceOld.Value.observe, InterfaceOld.Value.observeAll, InterfaceOld.homogeneous, InterfaceOld.single, Kind, Logic.FirstOrderLogic.SUB, Logic.FirstOrderLogic.basis3ext, Logic.FirstOrderLogic.exists_fresh_ne, Logic.FirstOrderLogic.realize_SUB, Logic.FirstOrderLogic.realize_update_of_not_mem_freeVarFinset, Logic.Popper.Basis1.instHasExistentialNatUnitTotalBasis1InferInstanceHasSubstitutionMutual, Logic.Popper.Basis1.instHasSubstitutionNatUnitMutualTotalBasis1, Logic.Popper.Basis1.instHasUniversalNatUnitTotalBasis1InferInstanceHasSubstitutionMutual, Logic.Popper.Basis1.totalBasis1, Logic.ProofTheory.Application, Logic.ProofTheory.CutFree, Logic.ProofTheory.CutFree.DerivationsOf, Logic.ProofTheory.Derivation, Logic.ProofTheory.Derivation.toCutFree, Logic.ProofTheory.DerivationsOf, Logic.ProofTheory.Schema, Logic.PropositionalLogic.BoolFun, Logic.PropositionalLogic.Formula, Logic.PropositionalLogic.Formula.bigAnd, Logic.PropositionalLogic.Formula.bigAnd_val, Logic.PropositionalLogic.Formula.bigOr, Logic.PropositionalLogic.Formula.bigOr_val, Logic.PropositionalLogic.Formula.completeness, Logic.PropositionalLogic.Formula.demonstrate_bigAnd_cons, Logic.PropositionalLogic.Formula.demonstrate_bigOr_cons, Logic.PropositionalLogic.Formula.demonstrate_semantic_iff_syntactic, Logic.PropositionalLogic.Formula.dnf, Logic.PropositionalLogic.Formula.dnf_val, Logic.PropositionalLogic.Formula.eliminate, Logic.PropositionalLogic.Formula.exists_andOrNot_of_boolFun, Logic.PropositionalLogic.Formula.falsum', Logic.PropositionalLogic.Formula.kalmar, Logic.PropositionalLogic.Formula.literal, Logic.PropositionalLogic.Formula.literal_val, Logic.PropositionalLogic.Formula.minterm, Logic.PropositionalLogic.Formula.minterm_val, Logic.PropositionalLogic.Formula.semantic_iff_provable, Logic.PropositionalLogic.Formula.starred, Logic.PropositionalLogic.Formula.syntactic_iff_provable, Logic.PropositionalLogic.Formula.val_falsum', Logic.PropositionalLogic.Formula.val_verum', Logic.PropositionalLogic.Formula.verum', Logic.PropositionalLogic.Formula.witness, Logic.PropositionalLogic.NandFormula, Logic.PropositionalLogic.NandFormula.exists_nand_of_boolFun, Logic.PropositionalLogic.Notation.«term⊢_», Logic.PropositionalLogic.Notation.«term⊨_», Mereology, NetworkArchitecture, NetworkArchitecture.application, NetworkArchitecture.dataLink, NetworkArchitecture.network, NetworkArchitecture.physical, NetworkArchitecture.stack, NetworkArchitecture.transport, NetworkLayer.Protocol, NetworkLayer.forwards, NetworkLayer.interface, NetworkLayer.resolves, NetworkLayer.transport, Object, Ontology, Packet, PhoneNumber, PhysicalLayer.interface, Quality, RawRelation, Receiver.step, Receiver.step_correct, Relation, Segment, Sender.step, SeqColimit, SeqColimit.Rel, SeqColimit.Rel.refl, SeqColimit.Rel.symm, SeqColimit.Rel.trans, SeqColimit.exists_not_mem_range, SeqColimit.fresh, SeqColimit.freshSeq, SeqColimit.freshSeq_injective, SeqColimit.freshSeq_lt_ne, SeqColimit.fresh_spec, SeqColimit.infinite, SeqColimit.mk, SeqColimit.mk_injective, SeqColimit.mk_stepTo, SeqColimit.setoid, SeqColimit.stepTo, SeqColimit.stepTo_self, SeqColimit.stepTo_succ, SeqColimit.stepTo_trans, Structure.Arithmetic.S_iff_add_one, Structure.Arithmetic.S_iff_succ, Structure.Arithmetic.Tower, Structure.Arithmetic.Tower.Colimit, Structure.Arithmetic.Tower.Same, Structure.Arithmetic.Tower.SigmaLe, Structure.Arithmetic.Tower.exists_of_le_ι, Structure.Arithmetic.Tower.instArithColimit, Structure.Arithmetic.Tower.instInfiniteColimit, Structure.Arithmetic.Tower.instLinearOrderColimit, Structure.Arithmetic.Tower.instNontrivialColimit, Structure.Arithmetic.Tower.instOrderBotColimit, Structure.Arithmetic.Tower.levelArith, Structure.Arithmetic.Tower.levelFinite, Structure.Arithmetic.Tower.lt_card_level, Structure.Arithmetic.Tower.same_refl, Structure.Arithmetic.Tower.same_symm, Structure.Arithmetic.Tower.same_trans, Structure.Arithmetic.Tower.setoid, Structure.Arithmetic.Tower.sigmaLe_antisymm, Structure.Arithmetic.Tower.sigmaLe_congr, Structure.Arithmetic.Tower.sigmaLe_refl, Structure.Arithmetic.Tower.sigmaLe_total, Structure.Arithmetic.Tower.sigmaLe_trans, Structure.Arithmetic.Tower.sigmaLe_up, Structure.Arithmetic.Tower.stepTo, Structure.Arithmetic.Tower.stepTo_bot, Structure.Arithmetic.Tower.stepTo_initial, Structure.Arithmetic.Tower.stepTo_le_iff, Structure.Arithmetic.Tower.stepTo_self, Structure.Arithmetic.Tower.stepTo_succ, Structure.Arithmetic.Tower.stepTo_trans, Structure.Arithmetic.Tower.step_le_iff, Structure.Arithmetic.Tower.ι, Structure.Arithmetic.Tower.ι_injective, Structure.Arithmetic.Tower.ι_le_iff, Structure.Arithmetic.Tower.ι_stepTo, Structure.Arithmetic.Z_iff_zero, Structure.Arithmetic.Z_iff_zero_fin, Structure.Arithmetic.count, Structure.Arithmetic.count_strictMono, Structure.Arithmetic.count_succ, Structure.Arithmetic.count_surjective, Structure.Arithmetic.finTower, Structure.Arithmetic.instArithFin, Structure.Arithmetic.instArithNat, Structure.Arithmetic.instNeZeroNat_structure, Structure.Arithmetic.instNonPeanoFin, Structure.Arithmetic.instPeanoNat, Structure.Arithmetic.instPeanoStandard, Structure.Arithmetic.peanoOrderIso, Topology, Topology.Event, Topology.Signal, Topology.leave_preserves_connected, Topology.runGrothendieck, Topology.step_conserves, Tower, Tower.LangBot, Tower.LangTop, Tower.LevelBot, Tower.LevelTop, Tower.card_lt_stepNeg, Tower.card_lt_stepPos, Tower.card_zero_le_neg, Tower.card_zero_le_pos, Tower.heapBot, Tower.heapTop, Tower.instInfiniteLevelBot, Tower.instInfiniteLevelTop, Tower.lang0ToBot, Tower.lang0ToTop, Tower.structBot, Tower.structTop, TrafficLightColor, TrafficLightColor_cardinality, TransportLayer.application, TransportLayer.interface, Unit.discrete, allConceptAnnotations, allDifficultyAnnotations, allExampleTags, allForwardReferencingTags, allIgnoreTags, allLemmaTags, allQualityAnnotations, arithFromNat, arithFromNat_toNat, arithLang, arithLevel, arithLevelTopEquivNat, arithLevel_negNatAbs, arithPlus, arithPlus_iff, arithPlus_mk_eq, arithPlus_succ, arithPlus_zero, arithStepNeg, arithStepNeg_injective, arithStepNeg_not_surjective, arithStepNeg_val, arithStepPos, arithStepPos_val, arithStepTo_val, arithStruct, arithStruct_congr, arithSucc, arithSuccFun, arithSuccFun_injective, arithSucc_functional, arithSucc_iff, arithSucc_iff_eq_succFun, arithSucc_mk_eq, arithSucc_no_fixed_point, arithSucc_total, arithToNat, arithToNat_fromNat, arithToNat_injective, arithToNat_mk, arithTower, arithTranslatePos_stepTo_eq, arithZero, arithZero_not_succ, arithZero_unique, castSucc_not_surjective, concept, difficultyTag, doorLanguage, exampleTag, forwardReferencingTag, ignoreTag, instFactPrimeOfNatNat_computerNetworks, instNonemptyForallFin_computerNetworks, instNonemptyFrame, instNonemptyPacket, instNormCell, instNormForallFin_computerNetworks, instNormFrame, instNormNonnegCell, instNormNonnegForallFin, instStructureDoorLanguageElemDoorStateReachableBoolDoorHeap, irrational_logb_two_five, irrational_logb_two_three, irrational_phoneNumberInformation, irrational_trafficLightInformation, lemmaTag, moduleOf, no_pow_two_eq_pow_five, no_pow_two_eq_pow_three, notRule, notRule_no_fixedPoint, phoneNumberInformation, phoneNumberInformation_eq, phoneNumber_bits_needed, phoneNumber_cardinality, qualityOf, qualityTag, trafficLightInformation, trafficLightInformation_eq, trafficLight_approx_two_bits, unexpandSeqAppend, unexpandToSeq, «term⟪_⟫»

Addition of natural numbers, typically used via the + operator.

This function is overridden in both the kernel and the compiler to efficiently evaluate using the arbitrary-precision arithmetic library. The definition provided here is the logical model.

def Nat.add : ℕ → ℕ → ℕ

Used by: Frame.toPoly_xor

The Boolean less-than-or-equal-to comparison on natural numbers.

This function is overridden in both the kernel and the compiler to efficiently evaluate using the arbitrary-precision arithmetic library. The definition provided here is the logical model.

Examples: * Nat.ble 2 5 = true * Nat.ble 5 2 = false * Nat.ble 5 5 = true

def Nat.ble : ℕ → ℕ → Bool

A decision procedure for equality of natural numbers, usually accessed via the DecidableEq Nat instance.

This function is overridden in both the kernel and the compiler to efficiently evaluate using the arbitrary-precision arithmetic library. The definition provided here is the logical model.

Examples: * Nat.decEq 5 5 = isTrue rfl * (if 3 = 4 then "yes" else "no") = "no" * show 12 = 12 by decide

def Nat.decEq (n m : ℕ) : Decidable (n = m)

Non-strict, or weak, inequality of natural numbers, usually accessed via the ≤ operator.

inductive Nat.le (n : ℕ) : ℕ → Prop
theorem Nat.le_succ_of_le {n m : ℕ} (h : n ≤ m) : n ≤ m.succ
theorem Nat.lt_or_ge (n m : ℕ) : n < m ∨ n ≥ m

Used by: Fin.append_eval

theorem Nat.lt_succ_self (n : ℕ) : n < n.succ
theorem Nat.ne_of_beq_eq_false {n m : ℕ} : n.beq m = false → ¬n = m

The power operation on natural numbers, usually accessed via the ^ operator.

This function is overridden in both the kernel and the compiler to efficiently evaluate using the arbitrary-precision arithmetic library. The definition provided here is the logical model.

def Nat.pow (m : ℕ) : ℕ → ℕ
theorem Nat.succ_pos (n : ℕ) : 0 < n.succ

Nonempty α is a typeclass that says that α is not an empty type, that is, there exists an element in the type. It differs from Inhabited α in that Nonempty α is a Prop, which means that it does not actually carry an element of α, only a proof that there exists such an element. Given Nonempty α, you can construct an element of α nonconstructively using Classical.choice.

inductive Nonempty.{u} (α : Sort u) : Prop

Used by: ApplicationLayer.interface, Channel, Channel.capacity, Channel.loss, Channel.lossless, Channel.lossless_stationary, Channel.lossy_loses_overall, Channel.maxWireSize, Channel.overall_loss, Channel.system, Component, Component.Arrow, Component.Arrow.Equiv, Component.Arrow.setoid, Component.Demultiplex, Component.Hom, Component.Hom.comp, Component.Hom.comp_assoc, Component.Hom.comp_eqToHom, Component.Hom.comp_id, Component.Hom.eqToHom_comp, Component.Hom.eqToHom_eq_recast_id, Component.Hom.hexagon_forward, Component.Hom.hexagon_reverse, Component.Hom.id, Component.Hom.id_comp, Component.Hom.recast, Component.Hom.recast_eqToHom, Component.Hom.recast_recast, Component.Hom.symmetry, Component.Hom.symmetry_symmetry, Component.Hom.tensor, Component.Hom.tensorUnit, Component.Hom.tensor_assoc, Component.Hom.tensor_comm, Component.Hom.tensor_comp_tensor, Component.Hom.tensor_empty, Component.Hom.tensor_id_id, Component.Hom.tensor_recast_left, Component.Hom.tensor_recast_right, Component.Multiplex, Component.PROP, Component.Simplex, Component.Simplex.toInformationSystem, Component.braidedCategory, Component.braiding, Component.braiding_naturality_left, Component.braiding_naturality_right, Component.category, Component.empty, Component.empty_parallel, Component.equivalent_of_stationary, Component.hexagon_forward_arrow, Component.hexagon_reverse_arrow, Component.id, Component.id_sequential, Component.interchange, Component.monoidalCategory, Component.monoidalCategoryStruct, Component.parallel, Component.parallel_assoc, Component.parallel_comm, Component.parallel_congr, Component.parallel_empty, Component.recast, Component.recast_congr, Component.recast_parallel_left, Component.recast_parallel_right, Component.recast_recast, Component.sequential, Component.sequential_assoc, Component.sequential_congr, Component.sequential_id, Component.symmetry, Component.symmetry_symmetry, DataLinkLayer.network, FiniteStateMachine, FiniteStateMachine.Reversible, Heap.empty, InformationSystem, InformationSystem.Chain, InformationSystem.Chain.length, InformationSystem.Chain.ofIsChain, InformationSystem.Environment, InformationSystem.Environment.ownState, InformationSystem.Environment.universe, InformationSystem.Environment.universe_isolated, InformationSystem.Run, InformationSystem.Run.cycle, InformationSystem.Run.final, InformationSystem.Run.initial, InformationSystem.Run.toChain, InformationSystem.Run.trajectory, InformationSystem.Run.trajectory_head, InformationSystem.Spontaneous, InformationSystem.Step, InformationSystem.Step.bottom, InformationSystem.Step.delta, InformationSystem.Step.delta_alt, InformationSystem.Step.delta_trichotomy, InformationSystem.Step.gains, InformationSystem.Step.loses, InformationSystem.delta, InformationSystem.equivalent, InformationSystem.equivalent_output, InformationSystem.equivalent_step, InformationSystem.eval, InformationSystem.eval_append, InformationSystem.eval_delta, InformationSystem.eval_trichotomy, InformationSystem.exists_repeat_equivalent, InformationSystem.exists_repeat_state, InformationSystem.gatedFlow, InformationSystem.gatedFlow_success_AB, InformationSystem.gatedFlow_success_BA, InformationSystem.irreversible, InformationSystem.isolated, InformationSystem.natural, InformationSystem.not_spontaneous_and_perpetuous, InformationSystem.parallel, InformationSystem.parallel_delta, InformationSystem.perpetuous, InformationSystem.perpetuous_coherent, InformationSystem.reversible, InformationSystem.roundtrip_neutral, InformationSystem.sequential, InformationSystem.sequential_delta, InformationSystem.spontaneous, InformationSystem.spontaneous_no_self_return, InformationSystem.spontaneous_not_perpetuous, InformationSystem.stepAt, InformationSystem.toSimplex, InformationSystem.zero_run_le, InterfaceOld, InterfaceOld.Value.observe, InterfaceOld.homogeneous, InterfaceOld.single, InterfaceOld.tensor, InterfaceOld.unit, Logic.ProofTheory.CutFree.DerivationsOf.graft, Logic.ProofTheory.CutFree.DerivationsOf.of_forall, Logic.ProofTheory.Derivable, Logic.ProofTheory.DerivableCutFree, Logic.ProofTheory.DerivableCutFree.graft, Logic.ProofTheory.DerivationsOf.of_forall, NetworkArchitecture, NetworkArchitecture.application, NetworkArchitecture.dataLink, NetworkArchitecture.network, NetworkArchitecture.physical, NetworkArchitecture.stack, NetworkArchitecture.transport, NetworkLayer.forwards, NetworkLayer.interface, NetworkLayer.resolves, NetworkLayer.transport, Structure.Arithmetic.Tower.instPeanoColimit, Structure.Arithmetic.instNonPeanoFin, Structure.Arithmetic.ultrafinitism, Topology.whole_connected, TransportLayer.application, TransportLayer.interface, instBraidedCategoryPROP, instCategoryPROP, instMonoidalCategoryPROP, instNonemptyCell, instNonemptyDoorState, instNonemptyElemDoorStateReachableBoolDoorHeapStateDoorClass, instNonemptyEvent, instNonemptyForallFin_computerNetworks, instNonemptyFrame, instNonemptyIcmp, instNonemptyPacket, instNonemptyProtocol, instNonemptySegment, instNonemptySignal, instNonemptyTower, instNonemptyValue

The elimination principle for Nonempty α. If Nonempty α, and we can prove p given any element x : α, then p holds. Note that it is essential that p is a Prop here; the version with p being a Sort u is equivalent to Classical.choice.

theorem Nonempty.elim.{u} {α : Sort u} {p : Prop} (h₁ : Nonempty α) (h₂ : ∀ (a : α), p) : p

Not p, or ¬p, is the negation of p. It is defined to be p → False, so if your goal is ¬p you can use intro h to turn the goal into h : p ⊢ False, and if you have hn : ¬p and h : p then hn h : False and (hn h).elim will prove anything. For more information: Propositional Logic

Conventions for notations in identifiers:

  • The recommended spelling of ¬ in identifiers is not.
def Not (a : Prop) : Prop

Used by: BitFunction.exists_settle, BitSequence.Dominates.bot, BitSequence.trueCount_strict, Cell.erase_not_injective, Cell.erase_not_surjective, Class.Reactive, Component.hexagon_forward_arrow, Component.hexagon_reverse_arrow, Component.parallel_assoc, Difficulty.ofString?, Fin.append_eval, Frame.crc32Ethernet_detects_single_bit_flip, Frame.crcFrom_detects_single_bit_flip, Frame.crcStep_length, Frame.crcStep_poly, Frame.crc_detects_single_bit_flip, Frame.generator_not_dvd_pow, Frame.ofFn_update, Frame.reflectIndex, Frame.reflectIndex_involutive, Frame.toPoly_ne_zero_of_any, Frame.toPoly_set_flip, Heap.combine, Heap.combine_at_left, Heap.combine_at_right, Heap.create, Heap.create_delete, Heap.create_domain, Heap.delete, Heap.materialize, Heap.materialize_dematerialize, InformationSystem.exists_repeat_state, InformationSystem.gatedFlow, InformationSystem.gatedFlow_success_AB, InformationSystem.gatedFlow_success_BA, InformationSystem.not_spontaneous_and_perpetuous, InformationSystem.spontaneous_no_self_return, InformationSystem.spontaneous_not_perpetuous, InterfaceOld.Value.join_disjoint, InterfaceOld.Value.observe, InterfaceOld.Value.observeAll, InterfaceOld.unit.Value.subsingleton, Logic.FirstOrderLogic.basis3ext, Logic.FirstOrderLogic.exists_fresh_ne, Logic.FirstOrderLogic.realize_all, Logic.FirstOrderLogic.realize_ex, Logic.FirstOrderLogic.realize_update_of_not_mem_freeVarFinset, Logic.Popper.Basis1.contract, Logic.Popper.Basis1.demonstrate_of_contradictory, Logic.Popper.Basis1.exchange, Logic.ProofTheory.Derivation, Logic.ProofTheory.Derivation.toCutFree, Logic.ProofTheory.Schema.IsComplexRule, Logic.ProofTheory.Schema.IsSimpleRule.of_isAxiom, Logic.PropositionalLogic.Formula, Logic.PropositionalLogic.Formula.eliminate, Logic.PropositionalLogic.Formula.entails_of_entails_neg_contra, Logic.PropositionalLogic.Formula.kalmar, Logic.PropositionalLogic.Formula.semantic_iff_provable, Logic.PropositionalLogic.HilbertSchema.mp_isSimple, Mereology.Irreflexive, Ontology.readFile, Quality.ofString?, SeqColimit.exists_not_mem_range, SeqColimit.fresh, SeqColimit.freshSeq, SeqColimit.freshSeq_injective, SeqColimit.freshSeq_lt_ne, SeqColimit.fresh_spec, SeqColimit.infinite, SimpleGraph.induceComplSingletonEquiv, Structure.Arithmetic.Impredicative, Structure.Arithmetic.Peano, Structure.Arithmetic.Primitive, Structure.Arithmetic.S_iff_add_one, Structure.Arithmetic.S_iff_succ, Structure.Arithmetic.S_lt, Structure.Arithmetic.S_pred, Structure.Arithmetic.S_unique, Structure.Arithmetic.Tower, Structure.Arithmetic.Tower.instInfiniteColimit, Structure.Arithmetic.Tower.instLinearOrderColimit, Structure.Arithmetic.Tower.instPeanoColimit, Structure.Arithmetic.Tower.lt_card_level, Structure.Arithmetic.Tower.step_le_iff, Structure.Arithmetic.Z_iff_zero, Structure.Arithmetic.count_surjective, Structure.Arithmetic.exists_S_of_not_Z, Structure.Arithmetic.exp_step, Structure.Arithmetic.finTower, Structure.Arithmetic.fixedPoint_iter, Structure.Arithmetic.instArithFin, Structure.Arithmetic.instDefForallForallPropFixedPointPrimitiveOfSerialOfUnivalent, Structure.Arithmetic.instDefS, Structure.Arithmetic.instPeanoStandard, Structure.Arithmetic.instTotallyPrimitiveOfSerial, Structure.Arithmetic.instUnivalentlyPrimitiveOfUnivalent, Structure.Arithmetic.iter, Structure.Arithmetic.iter_base, Structure.Arithmetic.iter_eq, Structure.Arithmetic.iter_step, Structure.Arithmetic.lt_wf, Structure.Arithmetic.plus_step, Structure.Arithmetic.pred, Structure.Arithmetic.rec_base, Structure.Arithmetic.rec_step, Structure.Arithmetic.terminates_of_halts, Structure.Arithmetic.times_step, Structure.Arithmetic.ultrafinitism, Topology.Event, Topology.Step.coverageFunctor, Topology.joinFunctor, Topology.leaveCoverage, Topology.step_conserves, Tower, arithLang, arithPlus_succ, arithPlus_zero, arithStepNeg_not_surjective, arithSucc_no_fixed_point, arithTower, arithZero_not_succ, arithZero_unique, castSucc_not_surjective, doorLanguage, irrational_logb_two_five, irrational_logb_two_three, no_pow_two_eq_pow_five, no_pow_two_eq_pow_three, notRule_no_fixedPoint, trafficLight_approx_two_bits

Optional values, which are either some around a value from the underlying type or none.

Option can represent nullable types or computations that might fail. In the codomain of a function type, it can also represent partiality.

inductive Option.{u} (α : Type u) : Type u

Gets an optional value, returning a given default on none.

This function is @[macro_inline], so dflt will not be evaluated unless opt turns out to be none.

Examples: * (some "hello").getD "goodbye" = "hello" * none.getD "goodbye" = "goodbye"

def Option.getD.{u_1} {α : Type u_1} (opt : Option α) (dflt : α) : α

Or a b, or a ∨ b, is the disjunction of propositions. There are two constructors for Or, called Or.inl : a → a ∨ b and Or.inr : b → a ∨ b, and you can use match or cases to destruct an Or assumption into the two cases.

Conventions for notations in identifiers:

  • The recommended spelling of ∨ in identifiers is or.
inductive Or (a b : Prop) : Prop

Used by: BitSequence.trueCount_strict, Class.reachable, Fin.append_eval, Finset.sum_preimage_map_disjUnion, Frame.ofFn_update, Frame.reflectIndex, Frame.reflectIndex_involutive, Frame.toPoly_ne_zero_of_any, Heap.combine, Heap.create, Heap.create_delete, InformationSystem.Step.delta_trichotomy, InformationSystem.eval_trichotomy, InformationSystem.exists_repeat_state, InformationSystem.not_spontaneous_and_perpetuous, InformationSystem.spontaneous_no_self_return, InterfaceOld.Value.join, InterfaceOld.Value.join_fired_inl, InterfaceOld.Value.join_fired_inr, Logic.FirstOrderLogic.basis3ext, Logic.FirstOrderLogic.realize_SUB, 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_cons_of_isConjunction, Logic.Popper.Basis1.demonstrate_cons_of_isDisjunction, Logic.Popper.Basis1.demonstrate_mono, 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_unique, Logic.Popper.Basis1.substitutivity, Logic.Popper.Basis1.weaken, Logic.Popper.Basis3.follows_toBasis1, Logic.ProofTheory.CutFree.DerivationsOf.graft, Logic.ProofTheory.CutFree.DerivationsOf.mono, Logic.ProofTheory.CutFree.DerivationsOf.of_forall, Logic.ProofTheory.Derivation.toCutFree, Logic.ProofTheory.DerivationsOf.of_forall, Logic.PropositionalLogic.Formula.Derivable.deduction_aux, Logic.PropositionalLogic.Formula.bigAnd_val, Logic.PropositionalLogic.Formula.bigOr_val, Logic.PropositionalLogic.Formula.entails_of_and_cases_syntactic, Logic.PropositionalLogic.Formula.entails_of_or_cases_syntactic, Logic.PropositionalLogic.Formula.kalmar, Logic.PropositionalLogic.Formula.provable_contrapose, Logic.PropositionalLogic.Formula.provable_deMorgan_or, Logic.PropositionalLogic.Formula.provable_dni, Logic.PropositionalLogic.Formula.provable_explosion, Logic.PropositionalLogic.Formula.provable_lem, Logic.PropositionalLogic.HilbertSchema.mp_isSimple, Logic.PropositionalLogic.semanticConnectives, Logic.PropositionalLogic.syntacticConnectives, SeqColimit.freshSeq_injective, Structure.Arithmetic.Primitive, Structure.Arithmetic.S, Structure.Arithmetic.S_iff_add_one, Structure.Arithmetic.S_iff_succ, Structure.Arithmetic.S_unique, Structure.Arithmetic.Tower.instLinearOrderColimit, Structure.Arithmetic.Tower.sigmaLe_total, Structure.Arithmetic.instDefForallForallPropFixedPointPrimitiveOfSerialOfUnivalent, Structure.Arithmetic.instDefS, Structure.Arithmetic.lt_wf, Structure.Arithmetic.orbit_subset, Structure.Arithmetic.rec_base, Structure.Arithmetic.rec_step, Structure.Arithmetic.terminates_of_halts, Topology.join_preserves_connected, Topology.whole, Topology.whole_adj_of_internal, Topology.whole_adj_of_link, doorBehavior, no_pow_two_eq_pow_five, no_pow_two_eq_pow_three

theorem Or.resolve_left {a b : Prop} (h : a ∨ b) (na : ¬a) : b

The universe-polymorphic empty type, with no constructors.

PEmpty can be used in any universe, but this flexibility can lead to worse error messages and more challenges with universe level unification. Prefer the type Empty or the proposition False when possible.

inductive PEmpty.{u} : Sort u

A product type in which the types may be propositions, usually written α ×' β.

This type is primarily used internally and as an implementation detail of proof automation. It is rarely useful in hand-written code.

Conventions for notations in identifiers:

  • The recommended spelling of ×' in identifiers is PProd.
structure PProd.{u, v} (α : Sort u) (β : Sort v) : Sort (max (max 1 u) v)

Lifts a type or proposition to a higher universe level.

PULift α wraps a value of type α. It is a generalization of PLift that allows lifting values whose type may live in Sort s. It also subsumes PLift.

structure PULift.{r, s} (α : Sort s) : Sort (max s r 1)

The product type, usually written α × β. Product types are also called pair or tuple types. Elements of this type are pairs in which the first element is an α and the second element is a β.

Products nest to the right, so (x, y, z) : α × β × γ is equivalent to (x, (y, z)) : α × (β × γ).

Conventions for notations in identifiers:

  • The recommended spelling of × in identifiers is Prod.
structure Prod.{u, v} (α : Type u) (β : Type v) : Type (max u v)

Used by: ApplicationLayer.Value, ApplicationLayer.interface, Cell, Cell.eraseSecondBit, Component.Hom.comp, Component.Hom.comp_assoc, Component.Hom.comp_id, Component.Hom.hexagon_forward, Component.Hom.hexagon_reverse, Component.Hom.id_comp, Component.Hom.symmetry_symmetry, Component.Hom.tensor, Component.Hom.tensor_assoc, Component.Hom.tensor_comm, Component.Hom.tensor_comp_tensor, Component.Hom.tensor_empty, Component.Hom.tensor_id_id, Component.Hom.tensor_recast_left, Component.Hom.tensor_recast_right, Component.Simplex.toInformationSystem, Component.empty, Component.empty_parallel, Component.equivalent_of_stationary, Component.hexagon_forward_arrow, Component.hexagon_reverse_arrow, Component.id, Component.id_sequential, Component.interchange, Component.monoidalCategory, Component.parallel, Component.parallel_assoc, Component.parallel_comm, Component.parallel_congr, Component.parallel_empty, Component.recast, Component.recast_parallel_left, Component.recast_parallel_right, Component.sequential, Component.sequential_assoc, Component.sequential_congr, Component.sequential_id, Component.symmetry, Component.symmetry_symmetry, Discrete.prod, FiniteStateMachine, FiniteStateMachine.Reversible, InformationSystem, InformationSystem.Environment.ownState, InformationSystem.Environment.universe, InformationSystem.Environment.universe_isolated, InformationSystem.Step, InformationSystem.Step.bottom, InformationSystem.Step.delta_alt, InformationSystem.eval, InformationSystem.eval_append, InformationSystem.gatedFlow, InformationSystem.gatedFlow_success_AB, InformationSystem.gatedFlow_success_BA, InformationSystem.irreversible, InformationSystem.parallel, InformationSystem.parallel_delta, InformationSystem.reversible, InformationSystem.sequential, InformationSystem.sequential_delta, InformationSystem.stepAt, InformationSystem.toSimplex, Logic.ProofTheory.Application, 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.mono, Logic.ProofTheory.CutFree.toDerivation, Logic.ProofTheory.DerivableCutFree.graft, Logic.ProofTheory.Derivation, Logic.ProofTheory.Derivation.toCutFree, Logic.ProofTheory.DerivationsOf, Logic.ProofTheory.DerivationsOf.forall_toCutFree, Logic.ProofTheory.DerivationsOf.of_forall, Logic.ProofTheory.Schema, Logic.ProofTheory.Schema.IsAxiom, Logic.ProofTheory.Schema.IsSimpleRule, Logic.ProofTheory.Schema.IsSimpleRule.of_isAxiom, Logic.ProofTheory.Schema.instance, Logic.ProofTheory.toBasis1, Logic.PropositionalLogic.HilbertSchema, Logic.PropositionalLogic.HilbertSchema.isAxiom_of_ne_mp, Logic.PropositionalLogic.HilbertSchema.mp_isSimple, Logic.PropositionalLogic.derivable_mp, Logic.PropositionalLogic.derivation_of_axiom, Ontology.readFile, Receiver.step, Receiver.step_correct, Sender.step, Topology, Topology.Step.coverageFunctor, Topology.step, Topology.step_conserves, allConceptAnnotations, allDifficultyAnnotations, allQualityAnnotations, getConceptsOf, instDecidableEqCell, instFintypeCell, instNormNonnegProd, instNormProd_computerNetworks, qualityOf

A string is a sequence of Unicode scalar values.

At runtime, strings are represented by dynamic arrays of bytes using the UTF-8 encoding. Both the size in bytes (String.utf8ByteSize) and in characters (String.length) are cached and take constant time. Many operations on strings perform in-place modifications when the reference to the string is unique.

structure String : Type

A byte position in a String, according to its UTF-8 encoding.

Character positions (counting the Unicode code points rather than bytes) are represented by plain Nats. Indexing a String by a String.Pos.Raw takes constant time, while character positions need to be translated internally to byte positions, which takes linear time.

A byte position p is valid for a string s if 0 ≤ p ≤ s.rawEndPos and p lies on a UTF-8 character boundary, see String.Pos.IsValid.

There is another type, String.Pos, which bundles the validity predicate. Using String.Pos instead of String.Pos.Raw is recommended because it will lead to less error handling and fewer edge cases.

structure String.Pos.Raw : Type

A UTF-8 byte position that points at the end of a string, just after the last character.

  • "abc".rawEndPos = ⟨3⟩
  • "L∃∀N".rawEndPos = ⟨8⟩
def String.rawEndPos (s : String) : String.Pos.Raw

All the elements of a type that satisfy a predicate.

Subtype p, usually written { x : α // p x } or { x // p x }, contains all elements x : α for which p x is true. Its constructor is a pair of the value and the proof that it satisfies the predicate. In run-time code, { x : α // p x } is represented identically to α.

There is a coercion from { x : α // p x } to α, so elements of a subtype may be used where the underlying type is expected.

Examples: * { n : Nat // n % 2 = 0 } is the type of even numbers. * { xs : Array String // xs.size = 5 } is the type of arrays with five Strings. * Given xs : List α, List { x : α // x ∈ xs } is the type of lists in which all elements are contained in xs.

Conventions for notations in identifiers:

  • The recommended spelling of { x // p x } in identifiers is subtype.
structure Subtype.{u} {α : Sort u} (p : α → Prop) : Sort (max 1 u)

True is a proposition and has only an introduction rule, True.intro : True. In other words, True is simply true, and has a canonical proof, True.intro For more information: Propositional Logic

inductive True : Prop

Used by: ApplicationLayer.interface, BitFunction.fixedPoint_isFixed, BitFunction.iterate_stays, BitSequence.Dominates.bot, BitSequence.cardinality, BitSequence.trueCount_le, BitSequence.trueCount_strict, Cell.eraseSecondBit, Component.empty, Component.empty_parallel, Component.id, Component.monoidalCategory, Component.parallel, Component.parallel_comm, Component.parallel_empty, DataLinkLayer.network, DataLinkLayer.physical, Finset.sum_preimage_map_disjUnion, Frame.crc32Ethernet_detects_single_bit_flip, Frame.crcStep_poly, Frame.crc_detects_single_bit_flip, Frame.ofFn_update, Frame.pos_length_of_any, Frame.toPoly_append, Frame.toPoly_degree_lt, Frame.toPoly_ne_zero_of_any, Frame.toPoly_replicate_false, Frame.toPoly_set_flip, Frame.toPoly_xor, InformationSystem.eval_append, InformationSystem.eval_delta, InformationSystem.exists_repeat_state, InformationSystem.gatedFlow, InformationSystem.gatedFlow_success_AB, InformationSystem.gatedFlow_success_BA, InformationSystem.not_spontaneous_and_perpetuous, InformationSystem.sequential_delta, InformationSystem.spontaneous_no_self_return, InterfaceOld.Value.join, InterfaceOld.Value.join_disjoint, InterfaceOld.Value.join_fired_inl, InterfaceOld.Value.join_fired_inr, InterfaceOld.homogeneous, InterfaceOld.tensor, InterfaceOld.unit, InterfaceOld.unit.Value.subsingleton, Layer.id_rel, Layer.id_sequential, Layer.parallel_rel, Layer.sequential_id, Layer.sequential_rel, Layer.trace_naturality_left, Layer.trace_naturality_right, Layer.trace_sliding, Layer.trace_superposing, Layer.trace_vanishing, Layer.trace_yanking, Logic.FirstOrderLogic.basis3ext, Logic.FirstOrderLogic.realize_SUB, Logic.FirstOrderLogic.realize_all, Logic.FirstOrderLogic.realize_ex, Logic.Popper.Basis1.demonstrate_of_contradictory, Logic.Popper.Basis1.demonstrate_singleton, Logic.Popper.Basis1.follows_refl, Logic.Popper.Basis1.instHasSubstitutionNatUnitMutualTotalBasis1, Logic.Popper.Basis1.totalBasis1, Logic.Popper.Basis3.follows_toBasis1, Logic.ProofTheory.CutFree.DerivationsOf.of_forall, Logic.ProofTheory.Derivation.toCutFree, Logic.ProofTheory.DerivationsOf.of_forall, Logic.ProofTheory.Schema.IsSimpleRule.of_isAxiom, Logic.PropositionalLogic.Formula.bigAnd_val, Logic.PropositionalLogic.Formula.bigOr_val, Logic.PropositionalLogic.Formula.eliminate, Logic.PropositionalLogic.Formula.entails_of_and_cases_syntactic, Logic.PropositionalLogic.Formula.entails_of_or_cases_syntactic, Logic.PropositionalLogic.Formula.kalmar, Logic.PropositionalLogic.Formula.literal_val, Logic.PropositionalLogic.Formula.or_entails_left, Logic.PropositionalLogic.Formula.or_entails_right, Logic.PropositionalLogic.Formula.provable_contrapose, Logic.PropositionalLogic.Formula.provable_deMorgan_or, Logic.PropositionalLogic.Formula.provable_dni, Logic.PropositionalLogic.Formula.provable_explosion, Logic.PropositionalLogic.Formula.provable_lem, Logic.PropositionalLogic.Formula.semantic_iff_provable, Logic.PropositionalLogic.Formula.val_falsum', Logic.PropositionalLogic.Formula.val_verum', Logic.PropositionalLogic.HilbertSchema.mp_isSimple, Logic.PropositionalLogic.NandFormula.ofFormula_val, Logic.PropositionalLogic.NandFormula.toFormula_val, Logic.PropositionalLogic.semanticConnectives, Logic.PropositionalLogic.syntacticConnectives, NetworkLayer.forwards, NetworkLayer.transport, Receiver.step, Sender.step, Specification.terminalCone, Structure.Arithmetic.S_iff_add_one, Structure.Arithmetic.Tower.stepTo_bot, Structure.Arithmetic.Tower.stepTo_initial, Structure.Arithmetic.Tower.stepTo_le_iff, Structure.Arithmetic.Tower.ι_stepTo, Structure.Arithmetic.instArithFin, Structure.Arithmetic.instDefForallForallPropFixedPointOfPredicative, Structure.Arithmetic.instDefForallForallPropFixedPointPrimitiveOfSerialOfUnivalent, Structure.Arithmetic.rec_base, Structure.Arithmetic.rec_step, Topology.join_preserves_connected, Topology.whole_adj_of_internal, arithLevel_negNatAbs, arithTower, phoneNumber_cardinality

The canonical type with one element. This element is written ().

Unit has a number of uses: * It can be used to model control flow that returns from a function call without providing other information. * Monadic actions that return Unit have side effects without computing values. * In polymorphic types, it can be used to indicate that no data is to be stored in a particular field.

abbrev Unit : Type

Used by: ApplicationLayer.Value, Cell.eraseSecondBit, Cell.erase_not_injective, Cell.erase_not_surjective, Component.Hom.comp_id, Component.Hom.hexagon_forward, Component.Hom.hexagon_reverse, Component.Hom.id, Component.Hom.id_comp, Component.Hom.symmetry, Component.Hom.symmetry_symmetry, Component.Hom.tensorUnit, Component.Hom.tensor_comm, Component.Hom.tensor_empty, Component.Hom.tensor_id_id, Component.empty, Component.empty_parallel, Component.hexagon_forward_arrow, Component.hexagon_reverse_arrow, Component.id, Component.id_sequential, Component.monoidalCategory, Component.parallel_comm, Component.parallel_empty, Component.sequential_id, Component.symmetry, Component.symmetry_symmetry, DataLinkLayer.network, DataLinkLayer.physical, Difficulty.ofString?, Frame.toPoly, InformationSystem.Environment.universe, InformationSystem.Environment.universe_isolated, Logic.FirstOrderLogic.all, Logic.FirstOrderLogic.ex, Logic.FirstOrderLogic.realize_all, Logic.FirstOrderLogic.realize_ex, Logic.Popper.Basis1.instHasExistentialNatUnitTotalBasis1InferInstanceHasSubstitutionMutual, Logic.Popper.Basis1.instHasSubstitutionNatUnitMutualTotalBasis1, Logic.Popper.Basis1.instHasUniversalNatUnitTotalBasis1InferInstanceHasSubstitutionMutual, NetworkLayer.forwards, NetworkLayer.resolves, NetworkLayer.transport, Ontology.readFile, Quality.ofString?, Receiver.step, Receiver.step_correct, Topology.joinHistory, Topology.step, Unit.discrete, arithLang, doorInterface, doorLanguage, instDecodeTomlConcept, instDecodeTomlRawRelation, instNormEvent, instNormNonnegUnit, instNormSignal, instNormUnit_computerNetworks, qualityOf, unexpandSeqAppend, unexpandToSeq

The only element of the unit type.

It can be written as an empty tuple: ().

abbrev Unit.unit : Unit

Used by: ApplicationLayer.Value, Cell.eraseSecondBit, Cell.erase_not_injective, Cell.erase_not_surjective, Component.Hom.comp_id, Component.Hom.hexagon_forward, Component.Hom.hexagon_reverse, Component.Hom.id, Component.Hom.id_comp, Component.Hom.symmetry, Component.Hom.symmetry_symmetry, Component.Hom.tensorUnit, Component.Hom.tensor_comm, Component.Hom.tensor_empty, Component.Hom.tensor_id_id, Component.empty, Component.empty_parallel, Component.hexagon_forward_arrow, Component.hexagon_reverse_arrow, Component.id, Component.id_sequential, Component.monoidalCategory, Component.parallel_comm, Component.parallel_empty, Component.sequential_id, Component.symmetry, Component.symmetry_symmetry, DataLinkLayer.network, DataLinkLayer.physical, Difficulty.ofString?, Frame.toPoly, InformationSystem.Environment.universe, Logic.FirstOrderLogic.all, Logic.FirstOrderLogic.ex, Logic.FirstOrderLogic.realize_all, Logic.FirstOrderLogic.realize_ex, Logic.Popper.Basis1.instHasExistentialNatUnitTotalBasis1InferInstanceHasSubstitutionMutual, Logic.Popper.Basis1.instHasSubstitutionNatUnitMutualTotalBasis1, Logic.Popper.Basis1.instHasUniversalNatUnitTotalBasis1InferInstanceHasSubstitutionMutual, NetworkLayer.forwards, NetworkLayer.resolves, NetworkLayer.transport, Quality.ofString?, Receiver.step, Receiver.step_correct, Topology.joinHistory, arithLang, arithPlus, arithPlus_iff, arithPlus_mk_eq, arithStruct_congr, doorLanguage, instNormEvent, instNormSignal, qualityOf, unexpandSeqAppend, unexpandToSeq

Cast across a type equality. If h : α = β is an equality of types, and a : α, then a : β will usually not typecheck directly, but this function will allow you to work around this and embed a in type β as cast h a : β.

It is best to avoid this function if you can, because it is more complicated to reason about terms containing casts, but if the types don’t match up definitionally sometimes there isn’t anything better you can do.

For more information: Equality

def cast.{u} {α β : Sort u} (h : α = β) (a : α) : β

The conditional function.

cond c x y is the same as if c then x else y, but optimized for a Boolean condition rather than a decidable proposition. It can also be written using the notation bif c then x else y.

Just like ite, cond is declared @[macro_inline], which causes applications of cond to be unfolded. As a result, x and y are not evaluated at runtime until one of them is selected, and only the selected branch is evaluated.

def cond.{u} {α : Sort u} (c : Bool) (x y : α) : α

Congruence in both function and argument. If f₁ = f₂ and a₁ = a₂ then f₁ a₁ = f₂ a₂. This only works for nondependent functions; the theorem statement is more complex in the dependent case.

For more information: Equality

theorem congr.{u, v} {α : Sort u} {β : Sort v} {f₁ f₂ : α → β} {a₁ a₂ : α} (h₁ : f₁ = f₂) (h₂ : a₁ = a₂) :
  f₁ a₁ = f₂ a₂

Used by: BitSequence.trueCount_strict, Cell.eraseSecondBit, Channel.lossy_loses_overall, Component.Hom.tensor_id_id, Component.empty, Component.empty_parallel, Component.equivalent_of_stationary, Component.hexagon_forward_arrow, Component.hexagon_reverse_arrow, Component.id, Component.id_sequential, Component.monoidalCategory, Component.parallel, Component.parallel_assoc, Component.parallel_comm, Component.parallel_empty, Component.recast, Component.sequential_assoc, Component.sequential_congr, Component.sequential_id, Component.symmetry, Component.symmetry_symmetry, Finset.sum_preimage_map_disjUnion, Frame.crc32Ethernet_detects_single_bit_flip, Frame.crcStep_length, Frame.ofFn_update, Frame.toPoly_append, Frame.toPoly_replicate_false, Frame.toPoly_set_flip, Frame.toPoly_xor, Heap.create_delete, InformationSystem.eval_delta, InformationSystem.gatedFlow, InformationSystem.gatedFlow_success_AB, InformationSystem.gatedFlow_success_BA, InterfaceOld.Value.join, InterfaceOld.Value.join_fired_inl, InterfaceOld.Value.join_fired_inr, InterfaceOld.tensor, Layer.id_rel, Layer.id_sequential, Layer.parallel_rel, Layer.sequential_assoc, Layer.sequential_id, Layer.sequential_rel, Layer.trace_naturality_left, Layer.trace_naturality_right, Layer.trace_sliding, Layer.trace_superposing, Layer.trace_vanishing, Layer.trace_yanking, Logic.FirstOrderLogic.realize_SUB, Logic.FirstOrderLogic.realize_all, Logic.FirstOrderLogic.realize_ex, Logic.Popper.Basis1.contract, Logic.Popper.Basis1.demonstrate_singleton, Logic.Popper.Basis1.exchange, Logic.Popper.Basis1.follows_refl, Logic.Popper.Basis3.follows_toBasis1, Logic.PropositionalLogic.Formula.bigAnd_val, Logic.PropositionalLogic.Formula.bigOr_val, Logic.PropositionalLogic.Formula.entails_of_and_cases_syntactic, Logic.PropositionalLogic.Formula.entails_of_or_cases_syntactic, Logic.PropositionalLogic.Formula.kalmar, Logic.PropositionalLogic.Formula.literal_val, Logic.PropositionalLogic.Formula.provable_contrapose, Logic.PropositionalLogic.Formula.provable_deMorgan_or, Logic.PropositionalLogic.Formula.provable_dni, Logic.PropositionalLogic.Formula.provable_explosion, Logic.PropositionalLogic.Formula.provable_lem, Logic.PropositionalLogic.Formula.semantic_iff_provable, Logic.PropositionalLogic.NandFormula.ofFormula_val, Logic.PropositionalLogic.NandFormula.toFormula_val, Logic.PropositionalLogic.semanticConnectives, Logic.PropositionalLogic.syntacticConnectives, Receiver.step, Sender.step, Specification.terminalCone, Structure.Arithmetic.S_iff_add_one, Structure.Arithmetic.Tower.lt_card_level, Structure.Arithmetic.Tower.stepTo_le_iff, Structure.Arithmetic.Tower.ι_le_iff, Structure.Arithmetic.instDefForallForallPropFixedPointPrimitiveOfSerialOfUnivalent, Structure.Arithmetic.rec_base, Structure.Arithmetic.rec_step, Topology.join_preserves_connected, Topology.whole_adj_of_internal, irrational_logb_two_five, irrational_logb_two_three, phoneNumber_cardinality

Congruence in the function argument: if a₁ = a₂ then f a₁ = f a₂ for any (nondependent) function f. This is more powerful than it might look at first, because you can also use a lambda expression for f to prove that <something containing a₁> = <something containing a₂>. This function is used internally by tactics like congr and simp to apply equalities inside subterms.

For more information: Equality

theorem congrArg.{u, v} {α : Sort u} {β : Sort v} {a₁ a₂ : α} (f : α → β) (h : a₁ = a₂) : f a₁ = f a₂

Used by: ApplicationLayer.interface, BitFunction.cardinality, BitFunction.cardinality_input_growth, BitFunction.cardinality_output_growth, BitFunction.fixedPoint_isFixed, BitFunction.iterate_dominates_succ, BitFunction.iterate_settles, BitFunction.iterate_stays, BitSequence.Dominates.bot, BitSequence.cardinality, BitSequence.trueCount_le, BitSequence.trueCount_strict, Cell.eraseSecondBit, Cell.erase_not_surjective, Channel.lossless_stationary, Channel.lossy_loses_overall, Component.Hom.comp_eqToHom, Component.Hom.eqToHom_comp, Component.Hom.recast_recast, Component.Hom.tensor_id_id, Component.Hom.tensor_recast_left, Component.Hom.tensor_recast_right, Component.Simplex.toInformationSystem, Component.braidedCategory, Component.braiding_naturality_left, Component.braiding_naturality_right, Component.empty, Component.empty_parallel, Component.equivalent_of_stationary, Component.hexagon_forward_arrow, Component.hexagon_reverse_arrow, Component.id, Component.id_sequential, Component.interchange, Component.monoidalCategory, Component.parallel, Component.parallel_assoc, Component.parallel_comm, Component.parallel_congr, Component.parallel_empty, Component.recast, Component.recast_congr, Component.recast_parallel_left, Component.recast_parallel_right, Component.sequential, Component.sequential_assoc, Component.sequential_congr, Component.sequential_id, Component.symmetry, Component.symmetry_symmetry, Discrete.pi, Discrete.prod, Fin.append_eval, Finset.sum_preimage_map_disjUnion, Frame.crc32Ethernet_detects_single_bit_flip, Frame.crcFrom_detects_single_bit_flip, Frame.crcStep_length, Frame.crcStep_poly, Frame.crc_detects_single_bit_flip, Frame.crc_poly_dvd, Frame.eq_of_associated_gf2, Frame.generator_not_dvd_pow, Frame.ofFn_update, Frame.toPoly, Frame.toPoly_append, Frame.toPoly_degree_lt, Frame.toPoly_ne_zero_of_any, Frame.toPoly_replicate_false, Frame.toPoly_set_flip, Frame.toPoly_xor, Heap.combine_at_left, Heap.combine_at_right, Heap.create_delete, InformationSystem.Chain.ofIsChain, InformationSystem.Environment.universe, InformationSystem.Step.bottom, InformationSystem.Step.delta_alt, InformationSystem.Step.gains, InformationSystem.Step.loses, InformationSystem.eval, InformationSystem.eval_append, InformationSystem.eval_delta, InformationSystem.exists_repeat_equivalent, InformationSystem.exists_repeat_state, InformationSystem.gatedFlow, InformationSystem.gatedFlow_success_AB, InformationSystem.gatedFlow_success_BA, InformationSystem.irreversible, InformationSystem.not_spontaneous_and_perpetuous, InformationSystem.parallel_delta, InformationSystem.roundtrip_neutral, InformationSystem.sequential_delta, InformationSystem.spontaneous_no_self_return, InformationSystem.toSimplex, InformationSystem.zero_run_le, InterfaceOld.Value.ext_of_fired_eq, InterfaceOld.Value.join, InterfaceOld.Value.join_disjoint, InterfaceOld.Value.join_fired_inl, InterfaceOld.Value.join_fired_inr, InterfaceOld.tensor, InterfaceOld.unit.Value.subsingleton, Layer.eq_toFun_of_univalent, Layer.id_rel, Layer.id_sequential, Layer.parallel_rel, Layer.sequential_assoc, Layer.sequential_id, Layer.sequential_rel, Layer.trace_naturality_left, Layer.trace_naturality_right, Layer.trace_sliding, Layer.trace_superposing, Layer.trace_vanishing, Layer.trace_yanking, Logic.FirstOrderLogic.basis3ext, Logic.FirstOrderLogic.exists_fresh_ne, Logic.FirstOrderLogic.hasExistential, Logic.FirstOrderLogic.hasUniversal, Logic.FirstOrderLogic.realize_SUB, Logic.FirstOrderLogic.realize_all, Logic.FirstOrderLogic.realize_ex, Logic.FirstOrderLogic.realize_nonDep_update, Logic.FirstOrderLogic.realize_update_of_nonDep, Logic.FirstOrderLogic.realize_update_of_not_mem_freeVarFinset, Logic.Popper.Basis1.contract, Logic.Popper.Basis1.contradictory_of_isClassicalNegation, Logic.Popper.Basis1.demonstrate_congr_premise, Logic.Popper.Basis1.demonstrate_cons_of_isConjunction, Logic.Popper.Basis1.demonstrate_cons_of_isDisjunction, Logic.Popper.Basis1.demonstrate_of_contradictory, 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.Basis3.follows_toBasis1, Logic.ProofTheory.CutFree.DerivationsOf.of_forall, Logic.ProofTheory.Derivation.toCutFree, Logic.ProofTheory.DerivationsOf.of_forall, Logic.ProofTheory.Schema.IsSimpleRule.of_isAxiom, Logic.PropositionalLogic.Formula.bigAnd_val, Logic.PropositionalLogic.Formula.bigOr_val, Logic.PropositionalLogic.Formula.completeness, Logic.PropositionalLogic.Formula.demonstrate_semantic_iff_syntactic, Logic.PropositionalLogic.Formula.dnf_val, Logic.PropositionalLogic.Formula.eliminate, Logic.PropositionalLogic.Formula.entails_of_and_cases_syntactic, Logic.PropositionalLogic.Formula.entails_of_entails_neg_contra, Logic.PropositionalLogic.Formula.entails_of_or_cases_syntactic, Logic.PropositionalLogic.Formula.kalmar, Logic.PropositionalLogic.Formula.literal_val, Logic.PropositionalLogic.Formula.minterm_val, Logic.PropositionalLogic.Formula.or_entails_left, Logic.PropositionalLogic.Formula.or_entails_right, Logic.PropositionalLogic.Formula.provable_contrapose, Logic.PropositionalLogic.Formula.provable_deMorgan_or, Logic.PropositionalLogic.Formula.provable_dni, Logic.PropositionalLogic.Formula.provable_explosion, Logic.PropositionalLogic.Formula.provable_lem, Logic.PropositionalLogic.Formula.semantic_iff_provable, Logic.PropositionalLogic.Formula.soundness, Logic.PropositionalLogic.Formula.syntactic_iff_provable, Logic.PropositionalLogic.Formula.val, Logic.PropositionalLogic.Formula.val_falsum', Logic.PropositionalLogic.Formula.val_verum', Logic.PropositionalLogic.HilbertSchema.mp_isSimple, Logic.PropositionalLogic.NandFormula.ofFormula, Logic.PropositionalLogic.NandFormula.ofFormula_val, Logic.PropositionalLogic.NandFormula.toFormula, Logic.PropositionalLogic.NandFormula.toFormula_val, Logic.PropositionalLogic.NandFormula.val, Logic.PropositionalLogic.semanticConnectives, Logic.PropositionalLogic.syntacticConnectives, Receiver.step, Sender.step, SeqColimit.Rel.trans, SeqColimit.freshSeq_lt_ne, SeqColimit.mk_stepTo, SimpleGraph.induceComplSingletonEquiv, Specification.closed, Specification.terminalCone, Structure.Arithmetic.S_iff_add_one, Structure.Arithmetic.Tower.exists_of_le_ι, Structure.Arithmetic.Tower.instInfiniteColimit, Structure.Arithmetic.Tower.instOrderBotColimit, Structure.Arithmetic.Tower.lt_card_level, Structure.Arithmetic.Tower.same_trans, Structure.Arithmetic.Tower.sigmaLe_congr, Structure.Arithmetic.Tower.sigmaLe_up, Structure.Arithmetic.Tower.stepTo_bot, Structure.Arithmetic.Tower.stepTo_initial, Structure.Arithmetic.Tower.stepTo_le_iff, Structure.Arithmetic.Tower.ι_le_iff, Structure.Arithmetic.Tower.ι_stepTo, Structure.Arithmetic.count_strictMono, Structure.Arithmetic.count_surjective, Structure.Arithmetic.exists_S_of_not_Z, Structure.Arithmetic.finTower, Structure.Arithmetic.fixedPoint_iter, Structure.Arithmetic.instArithFin, Structure.Arithmetic.instDefForallForallPropFixedPointOfPredicative, Structure.Arithmetic.instDefForallForallPropFixedPointPrimitiveOfSerialOfUnivalent, Structure.Arithmetic.instDefS, Structure.Arithmetic.instSerialRecPrimitive, Structure.Arithmetic.instUnivalentRecPrimitive, Structure.Arithmetic.instUnivalentlyPrimitiveOfUnivalent, Structure.Arithmetic.iter_base, Structure.Arithmetic.iter_step, Structure.Arithmetic.lt_wf, Structure.Arithmetic.orbit_subset, Structure.Arithmetic.rec_base, Structure.Arithmetic.rec_step, Topology.Step.coverageFunctor, Topology.isNerveCover_inter, Topology.join_preserves_connected, Topology.step_conserves, Topology.whole_adj_of_internal, Topology.whole_adj_of_link, Tower.card_lt_stepNeg, Tower.card_lt_stepPos, arithFromNat_toNat, arithLevel_negNatAbs, arithPlus_iff, arithPlus_mk_eq, arithPlus_succ, arithPlus_zero, arithStepTo_val, arithStruct_congr, arithSuccFun_injective, arithSucc_functional, arithSucc_iff, arithSucc_iff_eq_succFun, arithSucc_mk_eq, arithSucc_no_fixed_point, arithToNat, arithTower, arithTranslatePos_stepTo_eq, arithZero_not_succ, arithZero_unique, irrational_logb_two_five, irrational_logb_two_three, irrational_phoneNumberInformation, irrational_trafficLightInformation, no_pow_two_eq_pow_five, no_pow_two_eq_pow_three, phoneNumberInformation_eq, phoneNumber_bits_needed, phoneNumber_cardinality, trafficLightInformation_eq, trafficLight_approx_two_bits

Congruence in the function part of an application: If f = g then f a = g a.

theorem congrFun.{u, v} {α : Sort u} {β : α → Sort v} {f g : (x : α) → β x} (h : f = g) (a : α) : f a = g a

Similar to congrFun but β does not depend on α.

theorem congrFun'.{u, v} {α : Sort u} {β : Sort v} {f g : α → β} (h : f = g) (a : α) : f a = g a

Used by: ApplicationLayer.interface, BitFunction.iterate_stays, BitSequence.cardinality, BitSequence.trueCount_le, BitSequence.trueCount_strict, Component.Hom.tensor_id_id, Component.empty_parallel, Component.equivalent_of_stationary, Component.hexagon_forward_arrow, Component.hexagon_reverse_arrow, Component.id_sequential, Component.monoidalCategory, Component.parallel, Component.parallel_assoc, Component.parallel_comm, Component.parallel_empty, Component.sequential_assoc, Component.sequential_congr, Component.sequential_id, Component.symmetry_symmetry, Finset.sum_preimage_map_disjUnion, Frame.crc32Ethernet_detects_single_bit_flip, Frame.crcStep_length, Frame.crcStep_poly, Frame.crc_detects_single_bit_flip, Frame.crc_poly_dvd, Frame.ofFn_update, Frame.toPoly_append, Frame.toPoly_degree_lt, Frame.toPoly_ne_zero_of_any, Frame.toPoly_replicate_false, Frame.toPoly_set_flip, Frame.toPoly_xor, Heap.create_delete, InformationSystem.eval_append, InformationSystem.gatedFlow_success_AB, InformationSystem.gatedFlow_success_BA, InterfaceOld.Value.join, InterfaceOld.Value.join_fired_inl, InterfaceOld.Value.join_fired_inr, InterfaceOld.tensor, InterfaceOld.unit.Value.subsingleton, Layer.id_rel, Layer.parallel_rel, Layer.sequential_assoc, Layer.sequential_rel, Layer.trace_naturality_left, Layer.trace_naturality_right, Layer.trace_sliding, Layer.trace_superposing, Layer.trace_vanishing, Layer.trace_yanking, Logic.FirstOrderLogic.basis3ext, Logic.FirstOrderLogic.realize_all, Logic.FirstOrderLogic.realize_ex, Logic.Popper.Basis1.contract, Logic.Popper.Basis1.demonstrate_singleton, Logic.Popper.Basis1.exchange, Logic.ProofTheory.CutFree.DerivationsOf.of_forall, Logic.ProofTheory.DerivationsOf.of_forall, Logic.PropositionalLogic.Formula.bigAnd_val, Logic.PropositionalLogic.Formula.bigOr_val, Logic.PropositionalLogic.Formula.eliminate, Logic.PropositionalLogic.Formula.entails_of_entails_neg_contra, Logic.PropositionalLogic.Formula.kalmar, Logic.PropositionalLogic.Formula.literal_val, Logic.PropositionalLogic.Formula.minterm_val, Logic.PropositionalLogic.Formula.or_entails_left, Logic.PropositionalLogic.Formula.or_entails_right, Logic.PropositionalLogic.Formula.semantic_iff_provable, Logic.PropositionalLogic.Formula.soundness, Logic.PropositionalLogic.Formula.val_falsum', Logic.PropositionalLogic.Formula.val_verum', Logic.PropositionalLogic.NandFormula.ofFormula_val, Logic.PropositionalLogic.semanticConnectives, Receiver.step, Sender.step, Specification.terminalCone, Structure.Arithmetic.S_iff_add_one, Structure.Arithmetic.Tower.stepTo_bot, Structure.Arithmetic.Tower.stepTo_le_iff, Structure.Arithmetic.Tower.ι_stepTo, Structure.Arithmetic.instDefForallForallPropFixedPointPrimitiveOfSerialOfUnivalent, Structure.Arithmetic.rec_base, Structure.Arithmetic.rec_step, Topology.step_conserves, arithLevel_negNatAbs, arithTower, irrational_logb_two_five, irrational_logb_two_three, no_pow_two_eq_pow_five, no_pow_two_eq_pow_three, phoneNumber_cardinality

“Dependent” if-then-else, normally written via the notation if h : c then t(h) else e(h), is sugar for dite c (fun h => t(h)) (fun h => e(h)), and it is the same as if c then t else e except that t is allowed to depend on a proof h : c, and e can depend on h : ¬c. (Both branches use the same name for the hypothesis, even though it has different types in the two cases.)

We use this to be able to communicate the if-then-else condition to the branches. For example, Array.get arr i h expects a proof h : i < arr.size in order to avoid a bounds check, so you can write if h : i < arr.size then arr.get i h else ... to avoid the bounds check inside the if branch. (Of course in this case we have only lifted the check into an explicit if, but we could also use this proof multiple times or derive i < arr.size from some other proposition that we are checking in the if.)

def dite.{u} {α : Sort u} (c : Prop) [h : Decidable c] (t : c → α) (e : ¬c → α) : α

If two heterogeneously equal terms have the same type, then they are propositionally equal.

theorem eq_of_heq.{u} {α : Sort u} {a a' : α} (h : a ≍ a') : a = a'

Used by: AddressResolution, Behavior, Channel, Class, Component.Arrow, Creation, Destruction, FiniteStateMachine, ForwardingTable, Frame, Heap, HeapCover, InformationSystem, InformationSystem.Chain, InformationSystem.Chain.length, InformationSystem.Environment, InformationSystem.Run, InformationSystem.Step, InformationSystem.equivalent_output, InformationSystem.equivalent_step, Interface, InterfaceOld.Value, InterfaceOld.Value.eq_of_heq, Internal, Logic.FirstOrderLogic.realize_all, Logic.FirstOrderLogic.realize_ex, Logic.Popper.Basis1, Logic.Popper.Basis1.HasClassicalConnectives, Logic.Popper.Basis1.HasClassicalNegation, Logic.Popper.Basis1.HasConjunction, Logic.Popper.Basis1.HasDisjunction, Logic.Popper.Basis1.HasExistential, Logic.Popper.Basis1.HasImplication, Logic.Popper.Basis1.HasIntuitionisticNegation, Logic.Popper.Basis1.HasUniversal, Logic.Popper.Basis3, Logic.Popper.HasSubstitution, Logic.ProofTheory.Application, Logic.ProofTheory.CutFree, Logic.ProofTheory.CutFree.DerivationsOf, Logic.ProofTheory.CutFree.DerivationsOf.graft, Logic.ProofTheory.CutFree.DerivationsOf.mono, Logic.ProofTheory.CutFree.DerivationsOf.toDerivationsOf, Logic.ProofTheory.CutFree.mono, Logic.ProofTheory.CutFree.toDerivation, Logic.ProofTheory.DerivableCutFree.graft, Logic.ProofTheory.Derivation, Logic.ProofTheory.Derivation.toCutFree, Logic.ProofTheory.DerivationsOf, Logic.ProofTheory.DerivationsOf.forall_toCutFree, Logic.ProofTheory.ProofSystem, Logic.ProofTheory.Schema, Logic.PropositionalLogic.Formula, Logic.PropositionalLogic.NandFormula, Mereology, NetworkArchitecture, NormalBehavior, Object, Packet, Segment, Structure.Arithmetic.Arith, Structure.Arithmetic.NonPeano, Structure.Arithmetic.Peano, ToSeq, Topology.Event, Topology.runArrows', arithPlus_iff, arithSucc_iff

Propositionally equal terms are also heterogeneously equal.

theorem heq_of_eq.{u_1} {α✝ : Sort u_1} {a a' : α✝} (h : a = a') : a ≍ a'

The identity function. id takes an implicit argument α : Sort u (a type in any universe), and an argument a : α, and returns a.

Although this may look like a useless function, one application of the identity function is to explicitly put a type on an expression. If e has type T, and T' is definitionally equal to T, then @id T' e typechecks, and Lean knows that this expression has type T' rather than T. This can make a difference for typeclass inference, since T and T' may have different typeclass instances on them. show T' from e is sugar for an @id T' e expression.

def id.{u} {α : Sort u} (a : α) : α

Used by: Bit.discrete, BitFunction.cardinality, BitFunction.cardinality_input_growth, BitFunction.cardinality_output_growth, BitFunction.exists_settle, BitFunction.fixedPoint_isFixed, BitFunction.iterate_dominates_succ, BitFunction.iterate_settles, BitFunction.iterate_stays, BitSequence.cardinality, BitSequence.trueCount_strict, Bool.discrete, Cell.erase_not_injective, Cell.erase_not_surjective, Channel.lossless_stationary, Channel.lossy_loses_overall, Component.Hom.comp_eqToHom, Component.Hom.eqToHom_comp, Component.Hom.recast_recast, Component.Hom.tensor_id_id, Component.Hom.tensor_recast_left, Component.Hom.tensor_recast_right, Component.Simplex.toInformationSystem, Component.braidedCategory, Component.braiding_naturality_left, Component.braiding_naturality_right, Component.empty_parallel, Component.equivalent_of_stationary, Component.hexagon_forward_arrow, Component.hexagon_reverse_arrow, Component.id_sequential, Component.interchange, Component.monoidalCategory, Component.parallel, Component.parallel_assoc, Component.parallel_comm, Component.parallel_congr, Component.parallel_empty, Component.recast, Component.recast_congr, Component.sequential, Component.sequential_assoc, Component.sequential_congr, Component.sequential_id, Component.symmetry, Component.symmetry_symmetry, Discrete.pi, Discrete.prod, Fin.append_eval, Frame.crc32EthernetPoly_any, Frame.crc32Ethernet_detects_single_bit_flip, Frame.crcFrom_detects_single_bit_flip, Frame.crcStep_length, Frame.crcStep_poly, Frame.crc_detects_single_bit_flip, Frame.crc_poly_dvd, Frame.eq_of_associated_gf2, Frame.generator_not_dvd_pow, Frame.ofFn_update, Frame.pos_length_of_any, Frame.reflectIndex, Frame.reflectIndex_involutive, Frame.toPoly, Frame.toPoly_append, Frame.toPoly_degree_lt, Frame.toPoly_ne_zero_of_any, Frame.toPoly_set_flip, Frame.toPoly_xor, Heap.combine_at_left, Heap.combine_at_right, Heap.create_delete, HeapCover.whole_at, InformationSystem.Environment.universe, InformationSystem.Step.bottom, InformationSystem.Step.delta_alt, InformationSystem.Step.gains, InformationSystem.Step.loses, InformationSystem.eval, InformationSystem.eval_delta, InformationSystem.exists_repeat_equivalent, InformationSystem.exists_repeat_state, InformationSystem.gatedFlow, InformationSystem.gatedFlow_success_AB, InformationSystem.gatedFlow_success_BA, InformationSystem.irreversible, InformationSystem.parallel_delta, InformationSystem.roundtrip_neutral, InformationSystem.sequential_delta, InformationSystem.spontaneous_no_self_return, InformationSystem.toSimplex, InformationSystem.zero_run_le, InterfaceOld.Value.ext_of_fired_eq, InterfaceOld.Value.join, InterfaceOld.Value.join_disjoint, InterfaceOld.Value.join_fired_inl, InterfaceOld.Value.join_fired_inr, InterfaceOld.Value.join_left_right, InterfaceOld.tensor, InterfaceOld.unit.Value.subsingleton, Layer.id_rel, Layer.id_sequential, Layer.parallel_rel, Layer.sequential_assoc, Layer.sequential_id, Layer.sequential_rel, Layer.trace_naturality_left, Layer.trace_naturality_right, Layer.trace_sliding, Layer.trace_superposing, Layer.trace_vanishing, Layer.trace_yanking, Logic.FirstOrderLogic.basis3ext, Logic.FirstOrderLogic.exists_fresh_ne, Logic.FirstOrderLogic.hasExistential, Logic.FirstOrderLogic.hasUniversal, Logic.FirstOrderLogic.realize_SUB, Logic.FirstOrderLogic.realize_all, Logic.FirstOrderLogic.realize_ex, Logic.FirstOrderLogic.realize_update_of_nonDep, Logic.FirstOrderLogic.realize_update_of_not_mem_freeVarFinset, Logic.Popper.Basis1.contract, Logic.Popper.Basis1.contradictory_of_isClassicalNegation, Logic.Popper.Basis1.demonstrate_congr_premise, Logic.Popper.Basis1.demonstrate_cons_of_isConjunction, Logic.Popper.Basis1.demonstrate_cons_of_isDisjunction, Logic.Popper.Basis1.demonstrate_mp, Logic.Popper.Basis1.demonstrate_of_mem, Logic.Popper.Basis1.demonstrate_singleton, Logic.Popper.Basis1.exchange, Logic.ProofTheory.CutFree.DerivationsOf.mono, Logic.ProofTheory.Derivation.toCutFree, Logic.PropositionalLogic.Formula.and_entails_left, Logic.PropositionalLogic.Formula.and_entails_right, Logic.PropositionalLogic.Formula.bigAnd_val, Logic.PropositionalLogic.Formula.bigOr_val, Logic.PropositionalLogic.Formula.demonstrate_semantic_iff_syntactic, Logic.PropositionalLogic.Formula.dnf_val, Logic.PropositionalLogic.Formula.entails_and_iff, Logic.PropositionalLogic.Formula.entails_of_entails_neg_contra, Logic.PropositionalLogic.Formula.kalmar, Logic.PropositionalLogic.Formula.literal_val, Logic.PropositionalLogic.Formula.minterm_val, Logic.PropositionalLogic.Formula.semantic_iff_provable, Logic.PropositionalLogic.Formula.soundness, Logic.PropositionalLogic.Formula.syntactic_iff_provable, Logic.PropositionalLogic.Formula.val, Logic.PropositionalLogic.NandFormula.ofFormula, Logic.PropositionalLogic.NandFormula.toFormula, Logic.PropositionalLogic.NandFormula.val, Logic.PropositionalLogic.semanticConnectives, Logic.PropositionalLogic.syntacticConnectives, SeqColimit.Rel.trans, SeqColimit.mk_stepTo, Specification.closed, Specification.terminalCone, Structure.Arithmetic.S_iff_add_one, Structure.Arithmetic.S_iff_succ, Structure.Arithmetic.Tower.exists_of_le_ι, Structure.Arithmetic.Tower.instInfiniteColimit, Structure.Arithmetic.Tower.instOrderBotColimit, Structure.Arithmetic.Tower.lt_card_level, Structure.Arithmetic.Tower.same_trans, Structure.Arithmetic.Tower.sigmaLe_congr, Structure.Arithmetic.Tower.stepTo_bot, Structure.Arithmetic.Tower.stepTo_le_iff, Structure.Arithmetic.Tower.ι_le_iff, Structure.Arithmetic.Z_iff_zero, Structure.Arithmetic.count_strictMono, Structure.Arithmetic.count_surjective, Structure.Arithmetic.exists_S_of_not_Z, Structure.Arithmetic.finTower, Structure.Arithmetic.fixedPoint_iter, Structure.Arithmetic.instDefForallForallPropFixedPointOfPredicative, Structure.Arithmetic.instDefForallForallPropFixedPointPrimitiveOfSerialOfUnivalent, Structure.Arithmetic.instDefS, Structure.Arithmetic.instNeZeroNat_structure, Structure.Arithmetic.instPeanoNat, Structure.Arithmetic.instSerialRecPrimitive, Structure.Arithmetic.instUnivalentRecPrimitive, Structure.Arithmetic.iter_base, Structure.Arithmetic.iter_step, Structure.Arithmetic.lt_wf, Structure.Arithmetic.rec_base, Structure.Arithmetic.rec_step, Structure.Arithmetic.terminates_iff_bounded, Structure.Arithmetic.terminates_of_le, Structure.Arithmetic.ultrafinitism, Topology.Step.coverageFunctor, Topology.isNerveCover_inter, Topology.joinFunctor, Topology.join_preserves_connected, Topology.step_conserves, Topology.whole_adj_of_internal, Topology.whole_adj_of_link, Tower.card_lt_stepNeg, Tower.card_lt_stepPos, TrafficLightColor_cardinality, Unit.discrete, arithFromNat_toNat, arithPlus_iff, arithPlus_succ, arithPlus_zero, arithStepNeg_val, arithStepTo_val, arithStruct_congr, arithSucc_functional, arithSucc_iff, arithSucc_iff_eq_succFun, arithSucc_no_fixed_point, arithToNat, arithTower, arithTranslatePos_stepTo_eq, arithZero_not_succ, arithZero_unique, instNormNonnegBit, instNormNonnegCell, irrational_logb_two_five, irrational_logb_two_three, irrational_phoneNumberInformation, irrational_trafficLightInformation, no_pow_two_eq_pow_five, no_pow_two_eq_pow_three, notRule_no_fixedPoint, phoneNumberInformation_eq, phoneNumber_bits_needed, phoneNumber_cardinality, trafficLightInformation_eq, trafficLight_approx_two_bits

inferInstance synthesizes a value of any target type by typeclass inference. This function has the same type signature as the identity function, but the square brackets on the [i : α] argument means that it will attempt to construct this argument by typeclass inference. (This will fail if α is not a class.) Example:

#check (inferInstance : Inhabited Nat) -- Inhabited Nat

def foo : Inhabited (Nat × Nat) :=
  inferInstance

example : foo.default = (default, default) :=
  rfl
abbrev inferInstance.{u} {α : Sort u} [i : α] : α

Used by: ApplicationLayer.interface, Channel.lossless_stationary, Channel.lossy_loses_overall, Component.Hom.comp, Component.Hom.comp_assoc, Component.Hom.comp_id, Component.Hom.hexagon_forward, Component.Hom.hexagon_reverse, Component.Hom.id, Component.Hom.id_comp, Component.Hom.recast, Component.Hom.recast_recast, Component.Hom.symmetry, Component.Hom.symmetry_symmetry, Component.Hom.tensor, Component.Hom.tensorUnit, Component.Hom.tensor_assoc, Component.Hom.tensor_comm, Component.Hom.tensor_comp_tensor, Component.Hom.tensor_empty, Component.Hom.tensor_id_id, Component.Hom.tensor_recast_left, Component.Hom.tensor_recast_right, Component.Simplex.toInformationSystem, Component.monoidalCategory, Component.parallel, Component.sequential, Frame.crcFrom_detects_single_bit_flip, Frame.crcStep_poly, Frame.crc_poly_dvd, Frame.generator_not_dvd_pow, Frame.toPoly_ne_zero_of_any, Frame.toPoly_set_flip, InformationSystem.Environment.universe, InformationSystem.Step.bottom, InformationSystem.Step.delta_alt, InformationSystem.Step.gains, InformationSystem.Step.loses, InformationSystem.eval_delta, InformationSystem.parallel_delta, InformationSystem.roundtrip_neutral, InformationSystem.spontaneous_no_self_return, InformationSystem.toSimplex, InformationSystem.zero_run_le, Logic.Popper.Basis1.instHasExistentialNatUnitTotalBasis1InferInstanceHasSubstitutionMutual, Logic.Popper.Basis1.instHasUniversalNatUnitTotalBasis1InferInstanceHasSubstitutionMutual, Structure.Arithmetic.Tower.instPeanoColimit, Structure.Arithmetic.finTower, Structure.Arithmetic.instNonPeanoFin, Structure.Arithmetic.instPrimitiveRecursiveOfSerialOfUnivalent, Topology.step_conserves, allConceptAnnotations, allDifficultyAnnotations, allExampleTags, allForwardReferencingTags, allIgnoreTags, allLemmaTags, allQualityAnnotations, arithTower, instNonemptyFrame, instNonemptyPacket, irrational_logb_two_five, irrational_logb_two_three

if c then t else e is notation for ite c t e, “if-then-else”, which decides to return t or e depending on whether c is true or false. The explicit argument c : Prop does not have any actual computational content, but there is an additional [Decidable c] argument synthesized by typeclass inference which actually determines how to evaluate c to true or false. Write if h : c then t else e instead for a “dependent if-then-else” dite, which allows t/e to use the fact that c is true/false.

def ite.{u} {α : Sort u} (c : Prop) [h : Decidable c] (t e : α) : α

Translates an action from monad m into monad n.

abbrev liftM.{u_1, u_2, u_3} {m : Type u_1 → Type u_2} {n : Type u_1 → Type u_3} [self : MonadLiftT m n]
  {α : Type u_1} : m α → n α

A helper theorem to deduce False from a = b when f a ≠ f b for some function f : α → Nat (typically .ctorIdx). Used as a simpler alternative to the no-confusion theorems.

theorem noConfusion_of_Nat.{u} {α : Sort u} (f : α → ℕ) {a b : α} (h : a = b) :
  Bool.rec False True ((f a).beq (f b))

Gadget for optional parameter support.

A binder like (x : α := default) in a declaration is syntax sugar for x : optParam α default, and triggers the elaborator to attempt to use default to supply the argument if it is not supplied.

def optParam.{u} (α : Sort u) (default : α) : Sort u

rfl : a = a is the unique constructor of the equality type. This is the same as Eq.refl except that it takes a implicitly instead of explicitly.

This is a more powerful theorem than it may appear at first, because although the statement of the theorem is a = a, Lean will allow anything that is definitionally equal to that type. So, for instance, 2 + 2 = 4 is proven in Lean by rfl, because both sides are the same up to definitional equality.

def rfl.{u} {α : Sort u} {a : α} : a = a

Used by: BitFunction.comp_assoc, Cell.erase_not_injective, Channel.lossless_stationary, Channel.lossy_loses_overall, Component.Arrow.setoid, Component.Hom.comp_eqToHom, Component.Hom.eqToHom_comp, Component.Hom.eqToHom_eq_recast_id, Component.Hom.hexagon_forward, Component.Hom.hexagon_reverse, Component.Simplex.toInformationSystem, Component.braidedCategory, Component.empty_parallel, Component.hexagon_forward_arrow, Component.hexagon_reverse_arrow, Component.id_sequential, Component.interchange, Component.monoidalCategory, Component.parallel, Component.recast_congr, Component.sequential, Component.sequential_assoc, Component.sequential_congr, Component.sequential_id, Component.symmetry, Discrete.pi, Frame.crc32Ethernet_detects_single_bit_flip, Frame.crcFrom_detects_single_bit_flip, Frame.crcStep_poly, Frame.crc_poly_dvd, Frame.generator_not_dvd_pow, Frame.make_valid, Frame.reflectEquiv_symm, Frame.toPoly_append, Frame.toPoly_degree_lt, Frame.toPoly_ne_zero_of_any, Frame.toPoly_set_flip, Frame.toPoly_xor, Heap.combine_domain, Heap.create_domain, Heap.delete_domain, Heap.mem_reachable, HeapCover.whole_domain, InformationSystem.Environment.universe, InformationSystem.Environment.universe_isolated, InformationSystem.Run.trajectory_head, InformationSystem.Step.bottom, InformationSystem.Step.delta_alt, InformationSystem.Step.gains, InformationSystem.Step.loses, InformationSystem.eval_delta, InformationSystem.gatedFlow, InformationSystem.parallel_delta, InformationSystem.roundtrip_neutral, InformationSystem.spontaneous_no_self_return, InformationSystem.stepAt, InformationSystem.toSimplex, InformationSystem.zero_run_le, Logic.Popper.Basis1.contradictory_of_isClassicalNegation, Logic.ProofTheory.CutFree.toDerivation, Logic.PropositionalLogic.Formula.Derivable.deduction, Logic.PropositionalLogic.Formula.completeness, Logic.PropositionalLogic.Formula.dnf_val, Logic.PropositionalLogic.Formula.minterm_val, Logic.PropositionalLogic.HilbertSchema.isAxiom_of_ne_mp, Logic.PropositionalLogic.derivable_mp, Logic.PropositionalLogic.derivation_of_axiom, SeqColimit.Rel.refl, SimpleGraph.induceComplSingletonEquiv, Specification.closed, Structure.Arithmetic.Tower.instArithColimit, Structure.Arithmetic.Tower.instInfiniteColimit, Structure.Arithmetic.Tower.same_refl, Structure.Arithmetic.finTower, Structure.Arithmetic.fixedPoint_iter, Structure.Arithmetic.instSerialRecPrimitive, Structure.Arithmetic.instTotallyPrimitiveOfSerial, Topology.isNerveCover_inter, Topology.runArrows', Topology.step_conserves, Topology.whole_adj_of_internal, Topology.whole_adj_of_link, arithPlus_iff, arithStepPos_val, arithSucc_total, arithToNat_mk, doorHeap.closed_reachable, doorHeap.opened_reachable, irrational_logb_two_five, irrational_logb_two_three, irrational_phoneNumberInformation, phoneNumberInformation_eq, toSeq_list, toSeq_single

PropLemmas

theorem decide_eq_true_iff {p : Prop} [Decidable p] : decide p = true ↔ p
theorem exists_eq_right.{u_1} {α : Sort u_1} {p : α → Prop} {a' : α} : (∃ a, p a ∧ a = a') ↔ p a'
theorem exists_false.{u_1} {α : Sort u_1} : ¬∃ _a, False
theorem exists_prop_congr {p p' : Prop} {q q' : p → Prop} (hq : ∀ (h : p), q h ↔ q' h) (hp : p ↔ p') :
  Exists q ↔ ∃ (h : p'), q' ⋯

Used by: arithTower

SimpLemmas

theorem Bool.and_false (b : Bool) : (b && false) = false
theorem Bool.and_true (b : Bool) : (b && true) = b
theorem Bool.false_and (b : Bool) : (false && b) = false
theorem Bool.or_eq_true (a b : Bool) : ((a || b) = true) = (a = true ∨ b = true)
theorem Bool.or_false (b : Bool) : (b || false) = b
theorem Bool.or_self (b : Bool) : (b || b) = b
theorem Bool.true_and (b : Bool) : (true && b) = b
theorem Eq.mpr_not {p q : Prop} (h₁ : p = q) (h₂ : ¬q) : ¬p
theorem Eq.mpr_prop {p q : Prop} (h₁ : p = q) (h₂ : q) : p
theorem and_self (p : Prop) : (p ∧ p) = p
theorem bne_self_eq_false.{u_1} {α : Type u_1} [BEq α] [LawfulBEq α] (a : α) : (a != a) = false

Used by: Frame.toPoly_xor

theorem dite_cond_eq_false.{u} {α : Sort u} {c : Prop} {x✝ : Decidable c} {t : c → α} {e : ¬c → α}
  (h : c = False) : dite c t e = e ⋯
theorem dite_cond_eq_true.{u} {α : Sort u} {c : Prop} {x✝ : Decidable c} {t : c → α} {e : ¬c → α}
  (h : c = True) : dite c t e = t ⋯
theorem dite_congr.{u_1} {b c : Prop} {α : Sort u_1} {x✝ : Decidable b} [Decidable c] {x : b → α}
  {u : c → α} {y : ¬b → α} {v : ¬c → α} (h₁ : b = c) (h₂ : ∀ (h : c), x ⋯ = u h)
  (h₃ : ∀ (h : ¬c), y ⋯ = v h) : dite b x y = dite c u v
theorem eq_self.{u_1} {α : Sort u_1} (a : α) : (a = a) = True

Used by: BitFunction.fixedPoint_isFixed, BitFunction.iterate_stays, BitSequence.cardinality, BitSequence.trueCount_le, BitSequence.trueCount_strict, Cell.eraseSecondBit, Component.empty, Component.empty_parallel, Component.id, Component.monoidalCategory, Component.parallel, Component.parallel_comm, Component.parallel_empty, Fin.append_eval, Frame.crc32Ethernet_detects_single_bit_flip, Frame.crcStep_poly, Frame.crc_detects_single_bit_flip, Frame.ofFn_update, Frame.toPoly_append, Frame.toPoly_degree_lt, Frame.toPoly_ne_zero_of_any, Frame.toPoly_replicate_false, Frame.toPoly_set_flip, Frame.toPoly_xor, InformationSystem.eval_append, InformationSystem.eval_delta, InformationSystem.exists_repeat_state, InformationSystem.gatedFlow, InformationSystem.gatedFlow_success_AB, InformationSystem.gatedFlow_success_BA, InformationSystem.sequential_delta, Layer.id_sequential, Layer.sequential_id, Layer.trace_naturality_left, Layer.trace_naturality_right, Layer.trace_sliding, Layer.trace_superposing, Layer.trace_vanishing, Layer.trace_yanking, Logic.FirstOrderLogic.basis3ext, Logic.FirstOrderLogic.realize_SUB, Logic.FirstOrderLogic.realize_all, Logic.FirstOrderLogic.realize_ex, Logic.Popper.Basis1.demonstrate_singleton, Logic.Popper.Basis1.follows_refl, Logic.Popper.Basis3.follows_toBasis1, Logic.ProofTheory.CutFree.DerivationsOf.of_forall, Logic.ProofTheory.DerivationsOf.of_forall, Logic.PropositionalLogic.Formula.bigAnd_val, Logic.PropositionalLogic.Formula.eliminate, Logic.PropositionalLogic.Formula.entails_of_and_cases_syntactic, Logic.PropositionalLogic.Formula.entails_of_or_cases_syntactic, Logic.PropositionalLogic.Formula.kalmar, Logic.PropositionalLogic.Formula.literal_val, Logic.PropositionalLogic.Formula.or_entails_left, Logic.PropositionalLogic.Formula.or_entails_right, Logic.PropositionalLogic.Formula.provable_contrapose, Logic.PropositionalLogic.Formula.provable_deMorgan_or, Logic.PropositionalLogic.Formula.provable_dni, Logic.PropositionalLogic.Formula.provable_explosion, Logic.PropositionalLogic.Formula.provable_lem, Logic.PropositionalLogic.Formula.semantic_iff_provable, Logic.PropositionalLogic.Formula.val_falsum', Logic.PropositionalLogic.Formula.val_verum', Logic.PropositionalLogic.NandFormula.ofFormula_val, Logic.PropositionalLogic.NandFormula.toFormula_val, Logic.PropositionalLogic.semanticConnectives, Logic.PropositionalLogic.syntacticConnectives, Receiver.step, Sender.step, Specification.terminalCone, Structure.Arithmetic.S_iff_add_one, Structure.Arithmetic.Tower.stepTo_bot, Structure.Arithmetic.Tower.stepTo_initial, Structure.Arithmetic.Tower.ι_stepTo, Structure.Arithmetic.finTower, Topology.join_preserves_connected, Topology.whole_adj_of_internal, arithLevel_negNatAbs, arithStepNeg_val, phoneNumber_cardinality

theorem false_iff (p : Prop) : (False ↔ p) = ¬p
theorem forall_congr.{u} {α : Sort u} {p q : α → Prop} (h : ∀ (a : α), p a = q a) :
  (∀ (a : α), p a) = ∀ (a : α), q a
theorem heq_eq_eq.{u_1} {α : Sort u_1} (a b : α) : (a ≍ b) = (a = b)
theorem iff_false (p : Prop) : (p ↔ False) = ¬p
theorem iff_true (p : Prop) : (p ↔ True) = p
theorem implies_congr.{u, v} {p₁ p₂ : Sort u} {q₁ q₂ : Sort v} (h₁ : p₁ = p₂) (h₂ : q₁ = q₂) :
  (p₁ → q₁) = (p₂ → q₂)
theorem implies_congr_ctx {p₁ p₂ q₁ q₂ : Prop} (h₁ : p₁ = p₂) (h₂ : p₂ → q₁ = q₂) : (p₁ → q₁) = (p₂ → q₂)
theorem ite_congr.{u_1} {α : Sort u_1} {b c : Prop} {x y u v : α} {s : Decidable b} [Decidable c]
  (h₁ : b = c) (h₂ : c → x = u) (h₃ : ¬c → y = v) : (if b then x else y) = if c then u else v
theorem of_eq_true {p : Prop} (h : p = True) : p

Used by: ApplicationLayer.interface, BitFunction.fixedPoint_isFixed, BitFunction.iterate_stays, BitSequence.Dominates.bot, BitSequence.cardinality, BitSequence.trueCount_le, BitSequence.trueCount_strict, Cell.eraseSecondBit, Component.empty, Component.empty_parallel, Component.id, Component.monoidalCategory, Component.parallel, Component.parallel_comm, Component.parallel_empty, Fin.append_eval, Finset.sum_preimage_map_disjUnion, Frame.crc32Ethernet_detects_single_bit_flip, Frame.crcStep_poly, Frame.crc_detects_single_bit_flip, Frame.ofFn_update, Frame.pos_length_of_any, Frame.toPoly_append, Frame.toPoly_degree_lt, Frame.toPoly_ne_zero_of_any, Frame.toPoly_replicate_false, Frame.toPoly_set_flip, Frame.toPoly_xor, InformationSystem.eval_append, InformationSystem.eval_delta, InformationSystem.exists_repeat_state, InformationSystem.gatedFlow, InformationSystem.gatedFlow_success_AB, InformationSystem.gatedFlow_success_BA, InformationSystem.not_spontaneous_and_perpetuous, InformationSystem.sequential_delta, InformationSystem.spontaneous_no_self_return, InformationSystem.zero_run_le, InterfaceOld.Value.join, InterfaceOld.Value.join_disjoint, InterfaceOld.Value.join_fired_inl, InterfaceOld.Value.join_fired_inr, InterfaceOld.tensor, InterfaceOld.unit.Value.subsingleton, Layer.id_rel, Layer.id_sequential, Layer.parallel_rel, Layer.sequential_id, Layer.sequential_rel, Layer.trace_naturality_left, Layer.trace_naturality_right, Layer.trace_sliding, Layer.trace_superposing, Layer.trace_yanking, Logic.FirstOrderLogic.basis3ext, Logic.FirstOrderLogic.realize_SUB, Logic.FirstOrderLogic.realize_all, Logic.FirstOrderLogic.realize_ex, Logic.Popper.Basis1.demonstrate_of_contradictory, Logic.Popper.Basis1.demonstrate_singleton, Logic.Popper.Basis1.follows_refl, Logic.Popper.Basis3.follows_toBasis1, Logic.ProofTheory.CutFree.DerivationsOf.of_forall, Logic.ProofTheory.Derivation.toCutFree, Logic.ProofTheory.DerivationsOf.of_forall, Logic.ProofTheory.Schema.IsSimpleRule.of_isAxiom, Logic.PropositionalLogic.Formula.bigAnd_val, Logic.PropositionalLogic.Formula.bigOr_val, Logic.PropositionalLogic.Formula.eliminate, Logic.PropositionalLogic.Formula.entails_of_and_cases_syntactic, Logic.PropositionalLogic.Formula.entails_of_or_cases_syntactic, Logic.PropositionalLogic.Formula.kalmar, Logic.PropositionalLogic.Formula.literal_val, Logic.PropositionalLogic.Formula.or_entails_left, Logic.PropositionalLogic.Formula.or_entails_right, Logic.PropositionalLogic.Formula.provable_contrapose, Logic.PropositionalLogic.Formula.provable_deMorgan_or, Logic.PropositionalLogic.Formula.provable_dni, Logic.PropositionalLogic.Formula.provable_explosion, Logic.PropositionalLogic.Formula.provable_lem, Logic.PropositionalLogic.Formula.semantic_iff_provable, Logic.PropositionalLogic.Formula.val_falsum', Logic.PropositionalLogic.Formula.val_verum', Logic.PropositionalLogic.HilbertSchema.mp_isSimple, Logic.PropositionalLogic.NandFormula.ofFormula_val, Logic.PropositionalLogic.NandFormula.toFormula_val, Logic.PropositionalLogic.semanticConnectives, Logic.PropositionalLogic.syntacticConnectives, Ontology.readFile, Receiver.step, Sender.step, Specification.terminalCone, Structure.Arithmetic.S_iff_add_one, Structure.Arithmetic.Tower.stepTo_bot, Structure.Arithmetic.Tower.stepTo_initial, Structure.Arithmetic.Tower.stepTo_le_iff, Structure.Arithmetic.Tower.ι_stepTo, Structure.Arithmetic.finTower, Structure.Arithmetic.instArithFin, Structure.Arithmetic.instDefForallForallPropFixedPointPrimitiveOfSerialOfUnivalent, Structure.Arithmetic.rec_base, Topology.join_preserves_connected, arithLevel_negNatAbs, arithStepNeg_val, arithTower, phoneNumber_cardinality

SizeOf

SizeOf is a typeclass automatically derived for every inductive type, which equips the type with a “size” function to Nat. The default instance defines each constructor to be 1 plus the sum of the sizes of all the constructor fields.

This is used for proofs by well-founded induction, since every field of the constructor has a smaller size than the constructor itself, and in many cases this will suffice to do the proof that a recursive function is only called on smaller values. If the default proof strategy fails, it is recommended to supply a custom size measure using the termination_by argument on the function definition.

structure SizeOf.{u} (α : Sort u) : Sort (max 1 u)

System.FilePath

A path on the file system.

Paths consist of a sequence of directories followed by the name of a file or directory. They are delimited by a platform-dependent separator character (see System.FilePath.pathSeparator).

structure System.FilePath : Type

System.IO

An IO monad that cannot throw exceptions.

def BaseIO (α : Type) : Type

A monad that can have side effects on the external world or throw exceptions of type ε.

BaseIO is a version of this monad that cannot throw exceptions. IO sets the exception type to IO.Error.

def EIO (ε α : Type) : Type

Converts an EIO ε action that might throw an exception of type ε into an exception-free BaseIO action that returns an Except value.

def EIO.toBaseIO {ε α : Type} (act : EIO ε α) : BaseIO (Except ε α)

A monad that supports arbitrary side effects and throwing exceptions of type IO.Error.

abbrev IO : Type → Type

Reads the entire contents of the UTF-8-encoded file at the given path as a String.

An exception is thrown if the contents of the file are not valid UTF-8. This is in addition to exceptions that may always be thrown as a result of failing to read files.

def IO.FS.readFile (fname : System.FilePath) : IO String

System.IOError

Exceptions that may be thrown in the IO monad.

Many of the constructors of IO.Error correspond to POSIX error numbers. In these cases, the documentation string lists POSIX standard error macros that correspond to the error. This list is not necessarily exhaustive, and these constructor includes a field for the underlying error number.

inductive IO.Error : Type

Constructs an IO.Error from a string.

IO.Error is the type of exceptions thrown by the IO monad.

def IO.userError (s : String) : IO.Error

WF

Acc is the accessibility predicate. Given some relation r (e.g. <) and a value x, Acc r x means that x is accessible through r:

x is accessible if there exists no infinite sequence ... < y₂ < y₁ < y₀ < x.

inductive Acc.{u} {α : Sort u} (r : α → α → Prop) : α → Prop
theorem InvImage.wf.{u, v} {α : Sort u} {β : Sort v} {r : β → β → Prop} (f : α → β) (h : WellFounded r) :
  WellFounded (InvImage r f)
theorem Subrelation.wf.{u} {α : Sort u} {r q : α → α → Prop} (h₁ : Subrelation q r) (h₂ : WellFounded r) :
  WellFounded q

A relation r is WellFounded if all elements of α are accessible within r. If a relation is WellFounded, it does not allow for an infinite descent along the relation.

If the arguments of the recursive calls in a function definition decrease according to a well founded relation, then the function terminates. Well-founded relations are sometimes called Artinian or said to satisfy the “descending chain condition”.

inductive WellFounded.{u} {α : Sort u} (r : α → α → Prop) : Prop

A well-founded fixpoint operator specialized for Nat-valued measures. Given a measure h, it expects its higher order function argument F to invoke its argument only on values y that are smaller than x with regard to h.

In contrast to WellFounded.fix, this fixpoint operator reduces on closed terms. (More precisely: when h x evaluates to a ground value)

def WellFounded.Nat.fix.{u, v} {α : Sort u} {motive : α → Sort v} (h : α → ℕ)
  (F : (x : α) → ((y : α) → InvImage (fun x1 x2 => x1 < x2) h y x → motive y) → motive x) (x : α) :
  motive x
theorem WellFounded.apply.{u} {α : Sort u} {r : α → α → Prop} (wf : WellFounded r) (a : α) : Acc r a

A well-founded fixpoint. If satisfying the motive C for all values that are smaller according to a well-founded relation allows it to be satisfied for the current value, then it is satisfied for all values.

This function is used as part of the elaboration of well-founded recursion.

def WellFounded.fix.{u, v} {α : Sort u} {C : α → Sort v} {r : α → α → Prop} (hwf : WellFounded r)
  (F : (x : α) → ((y : α) → r y x → C y) → C x) (x : α) : C x
theorem WellFounded.fix_eq.{u, v} {α : Sort u} {C : α → Sort v} {r : α → α → Prop} (hwf : WellFounded r)
  (F : (x : α) → ((y : α) → r y x → C y) → C x) (x : α) : hwf.fix F x = F x fun y x => hwf.fix F y
theorem WellFounded.induction.{u} {α : Sort u} {r : α → α → Prop} (hwf : WellFounded r) {C : α → Prop}
  (a : α) (h : ∀ (x : α), (∀ (y : α), r y x → C y) → C x) : C a