Skip to content

Commit

Permalink
Make minor updates (#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
sonmarcho authored Aug 14, 2024
1 parent 31a1057 commit b92ed2a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions backends/lean/Base/Arith/Int.lean
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ macro "scalar_tac" pat:term : attr =>
macro "nonlin_scalar_tac" pat:term : attr =>
`(attr|aesop safe forward (rule_sets := [$(Lean.mkIdent `Aeneas.ScalarTacNonLin):ident]) (pattern := $pat))

-- This is useful especially in the termination proofs
attribute [scalar_tac a.toNat] Int.toNat_eq_max

/- Check if a proposition is a linear integer proposition.
We notably use this to check the goals: this is useful to filter goals that
are unlikely to be solvable with arithmetic tactics. -/
Expand Down
3 changes: 2 additions & 1 deletion backends/lean/Base/Termination.lean
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ macro_rules
simp_wf <;>
-- Simplify the context - otherwise simp_all below will blow up
remove_invImage_assumptions <;>
-- Transform the goal a bit
-- Transform the goal a bit to get rid of `Int.toNat` if there is
-- (note that this is actually not necessary anymore).
scalar_decr_tac_apply_lemmas <;>
-- Finish
simp_all <;> scalar_tac)
Expand Down
5 changes: 2 additions & 3 deletions tests/lean/Tutorial.lean
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,7 @@ decreasing_by
-- We first need to "massage" the goal (in practice, all the proofs of [decreasing_by]
-- should start with a call to [simp_wf]).
simp_wf
-- Finish the proof
have : 1 ≤ x.val := by scalar_tac
simp [Int.toNat_sub_of_le, *]
-- This is just a linear arithmetic goal so we conclude with [scalar_tac]
scalar_tac

end Tutorial

0 comments on commit b92ed2a

Please sign in to comment.