Some notes
Closed this issue · 2 comments
[Some notes that we could forget if we don't write them down]
UPDATE: done, top vs bottom rendering is added to instructions
- It is not super obvious to the new user that the arrows from goals to goals have ↑ direction, and the arrows from hypotheses to hypotheses have ↓ direction. That you are supposed to read the proof "from the outside in" (rather than top-down, or bottom-up).
We should probably insert a gif/[pic with arrows] in the readme at some point about this (I'm writing this down because I already think it's obvious, and of course it isn't). A gif that shows us typing in some proof with the tree appearing on the right should work as such demonstration, bc will show how hypotheses appear from the top, and goals appear from the bottom.
![image](https://private-user-images.githubusercontent.com/7578559/242994341-7b3d10a8-28d9-4a2c-aa40-7d01baf2e089.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2MjA0MzgsIm5iZiI6MTcxOTYyMDEzOCwicGF0aCI6Ii83NTc4NTU5LzI0Mjk5NDM0MS03YjNkMTBhOC0yOGQ5LTRhMmMtYWE0MC03ZDAxYmFmMmUwODkucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYyOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MjlUMDAxNTM4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZjFlZWIyNTNiZjViNTZhYjM0M2ZhYmY2ODgzYWRlZDRiZWY0NDNkNGUyM2NhY2VhOGMwZjUxNGZkNWE4ZTMwMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.G1SnF662KWwVhyq-uRLr-9-B5_vlMhnhMtMjbk2P6Xg)
- There is a question of how we want to handle
weirdSituation
where the hypothesis changes, but its type or username do not change. We might want to createfakeIds
. Atm we're just changing it in-place:
![image](https://private-user-images.githubusercontent.com/7578559/244174196-1c7adb6a-6e3d-40c5-a30f-5452d94d8b13.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2MjA0MzgsIm5iZiI6MTcxOTYyMDEzOCwicGF0aCI6Ii83NTc4NTU5LzI0NDE3NDE5Ni0xYzdhZGI2YS02ZTNkLTQwYzUtYTMwZi01NDUyZDk0ZDhiMTMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYyOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MjlUMDAxNTM4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NDg5YWM4Yjg4YmQwYjI3ODI1NzQxYjQ0YmUwMDk2MTQ0ZWE2NTgxNDM4OTFkMmExNzNkZDQ0NGUzNDFjOTIwMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.bW6-h53SiFZa0HfMN7MpNKEl1wNAcAQKkgwbgSp5td8)
This happens sorta frequently (e.g. during the rename
tactics; or when some hypothesis gets tomstoned) for hypotheses, and we never saw it happening for the goals yet; but it's possible to create an artificial situation where that would happen with hypotheses, too. This leads to the creator
tactic appearing on top of one of the goals instead of trivial
. So, if we end up creating fake ids, we might want to create them for the goals too while we're at it.
elab "creator " : tactic => do
let goal ← Lean.Elab.Tactic.getMainGoal
let hi ← Lean.Meta.mkFreshExprMVar (Expr.const `Nat []) (userName := `hi)
let hello ← Lean.Meta.mkFreshExprMVar (Expr.const `String []) (userName := `hello)
let wow ← Lean.Meta.mkFreshExprMVar (Expr.const `Int []) (userName := `wow)
Lean.Elab.Tactic.setGoals [hi.mvarId!, hello.mvarId!, goal, wow.mvarId!]
theorem very_easy : true := by
creator
exact 5
exact "hello"
trivial
exact 7
![image](https://private-user-images.githubusercontent.com/7578559/244173988-5ca8f6f8-377d-4265-9b36-2122976a44c1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2MjA0MzgsIm5iZiI6MTcxOTYyMDEzOCwicGF0aCI6Ii83NTc4NTU5LzI0NDE3Mzk4OC01Y2E4ZjZmOC0zNzdkLTQyNjUtOWIzNi0yMTIyOTc2YTQ0YzEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYyOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MjlUMDAxNTM4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YmE5MzZhNWVmODRiOWRhMTAwZjA3NTJiYTg3NTI5MmUxOTVhM2JlZWIxMDJhZDM1ZTY1ZTk5YjYyZjJlZGM3OCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.KHLQ0DMk8m5jdfRItAMN9SSFuL14F9Yz3CPgoLk9kc4)
AND also: how about instead of creating fakeIds
data structure we just turn all ids into a triple fvarid-username-type
.
fakeIds
+ equivalentIds
+ [id
as a node id] === equivalentIds
+ [fvarid-username-type
as a node id].