Zulip Chat Archive
Stream: new members
Topic: Stacks push and pop
Omar Hidmi (Oct 03 2022 at 12:07):
Hi everyone .. I'm totally new to LEAN and I started studying this language and trying to prove things, started by finishing some levels in Natural Number Game and also learning LEAN from the documentation, but now I have a task to do with Stacks, I have to create a Stack A and Stack B and then I push items to Stack A and pop them to Stack B to prove the last item remaining on top of Stack A ... can you point me to the right direction ?????
Thanks a ton
Patrick Massot (Oct 03 2022 at 12:17):
Welcome! Please read the explanation at #mwe to learn how to ask more efficient questions.
Omar Hidmi (Oct 03 2022 at 13:47):
to be clear .. I am asking about Stacks .. is it the same as Arrays or Lists ? or there is pre-defined structure in LEAN for Stacks ? I wanted someone to guide me to the right direction
Johan Commelin (Oct 03 2022 at 13:48):
@Omar Hidmi You can just use a lists.
Adam Topaz (Oct 03 2022 at 14:37):
Lean4 has docs4#Std.Stack
Adam Topaz (Oct 03 2022 at 14:37):
And you can see that it's defined in terms of arrays
Adam Topaz (Oct 03 2022 at 14:39):
if you click that link and look around you will see all the relevant API (pop, push, etc.)
Adam Topaz (Oct 03 2022 at 14:39):
I guess we should ask @Omar Hidmi whether you want to use Lean3 or Lean4?
Omar Hidmi (Oct 03 2022 at 15:52):
Thanks @Adam Topaz That's exactly what I needed .. thanks
Last updated: Dec 20 2023 at 11:08 UTC