Skip to content

Commit 5651b11

Browse files
authored
Merge pull request #21 from idris-hackers/feature/tactics/edit
Tactics: ensure totality, minor tweaks
2 parents 88adfc1 + b581c72 commit 5651b11

File tree

2 files changed

+15
-19
lines changed

2 files changed

+15
-19
lines changed

software_foundations.ipkg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ sourceloc = git://[email protected]:idris-hackers/software-foundations.git
1919
bugtracker = https://github.com/idris-hackers/software-foundations/issues
2020

2121
sourcedir = src
22-
opts = "--check --total"
22+
opts = "--check --total -X ElabReflection"
2323
pkgs = pruviloj

src/Tactics.lidr

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,16 @@ will see:
1616
- more details on how to reason by case analysis.
1717

1818
> module Tactics
19-
19+
>
2020
> import Basics
21-
22-
\todo[inline]{If we \idr{import Poly} here, the pair sugar, among other things,
23-
will start messing things up, so we just copypaste the necessary definitions for
24-
now}
25-
26-
\todo[inline]{Describe \idr{Pruviloj} and \idr{%runElab}}
27-
2821
> import Pruviloj
29-
22+
>
3023
> %access public export
31-
24+
>
3225
> %default total
33-
26+
>
3427
> %language ElabReflection
28+
>
3529

3630

3731
== The \idr{exact} Tactic
@@ -977,9 +971,9 @@ Here are some examples:
977971
978972
> sillyfun_false : (n : Nat) -> sillyfun n = False
979973
> sillyfun_false n with (beq_nat n 3)
980-
> sillyfun_false (S (S (S Z))) | True = Refl
974+
> sillyfun_false n | True = Refl
981975
> sillyfun_false n | False with (beq_nat n 5)
982-
> sillyfun_false (S (S (S (S (S Z))))) | False | True = Refl
976+
> sillyfun_false n | False | True = Refl
983977
> sillyfun_false n | False | False = Refl
984978
985979
@@ -1022,10 +1016,12 @@ the proofs we did with \idr{sillyfun} above, it is natural to start the proof
10221016
like this:
10231017
10241018
> sillyfun1_odd : (n : Nat) -> sillyfun1 n = True -> oddb n = True
1025-
> sillyfun1_odd n prf with (beq_nat n 3)
1026-
> sillyfun1_odd (S (S (S Z))) Refl | True = Refl
1027-
> sillyfun1_odd n prf | False with (beq_nat n 5)
1028-
> sillyfun1_odd (S (S (S (S (S Z))))) Refl | False | True = Refl
1019+
> sillyfun1_odd n prf with (beq_nat n 3) proof eq3
1020+
> sillyfun1_odd n Refl | True =
1021+
> rewrite beq_nat_true (sym eq3) {n} {m=3} in Refl
1022+
> sillyfun1_odd n prf | False with (beq_nat n 5) proof eq5
1023+
> sillyfun1_odd n Refl | False | True =
1024+
> rewrite beq_nat_true (sym eq5) {n} {m=5} in Refl
10291025
> sillyfun1_odd n prf | False | False = absurd prf
10301026
10311027
\todo[inline]{Edit the following, since \idr{with} works fine here as well}
@@ -1222,4 +1218,4 @@ Finally, prove a theorem \idr{existsb_existsb'} stating that \idr{existsb'} and
12221218
12231219
> -- FILL IN HERE
12241220
1225-
$\square$
1221+
$\square$

0 commit comments

Comments
 (0)