openlang

Lean4 reports that 'begin' is unknown

In the VSCode editor, I entered this Lean4 code:

example (a b c : Prop) : ((a ∨ b) → c) ↔ ((a → c) ∧ (b → c)) :=
begin

and got "unknown identifier 'begin'". Adding end three lines below gives "invalid 'end', insufficient scopes". What have I done wrong? Is my Lean installation incorrect?

The conversation continues 2

Follow the reasoning
  1. Permalink

    The begin/end block notation belongs to lean 3. To start tactic mode with Lean 4, use the keyword by, for example:

    example (a b c : Prop) : ((a ∨ b) → c) ↔ ((a → c) ∧ (b → c)) := by sorry

    There is no corresponding end now because white space determines the scope, although an optional final done produces an error when a goal remains open.

    Even with substantial lean 3 experience, I'd suggest looking through the manual (https://lean-lang.org/lean4/doc/) and/or Theorem Proving in Lean/Functional Programming in Lean (chapters 4 and 5 of the manual), given the considerable improvements and changes.

    The end keyword still closes sections and namespaces, explaining the diagnostic you see when using end here.

Other sides of the same question

  1. Formatting list elements as text with functional programming

    I'm a functional programming beginner, trying to create a function which accepts values in a list (whose length isn't fixed)…

    Replies 2Latest activity gleam
  2. A JavaScript class to take?

    The last year I consulted JavaScript documentation was 1996. I'd like an educational course covering the “essential JavaScrip…

    Replies 2Latest activity elmjavascript
  3. Where can I find fmt and the main package?

    Lots of go examples begin with : The GOPATH I use: Where are main and the fmt module stored?

    Replies 2Latest activity go