Skip to content

Commit

Permalink
Prove word_and_lsl_eq_0
Browse files Browse the repository at this point in the history
  • Loading branch information
xrchz committed Dec 15, 2024
1 parent 5fb53e4 commit db90904
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/n-bit/wordsScript.sml
Original file line number Diff line number Diff line change
Expand Up @@ -5083,6 +5083,15 @@ Proof
rw[l2w_def]
QED

Theorem word_and_lsl_eq_0:
w2n w1 < 2 ** n ==> w1 && w2 << n = 0w
Proof
Cases_on`w1` \\ Cases_on`w2`
\\ rw[word_and_n2w, word_lsl_n2w]
\\ drule BITWISE_AND_SHIFT_EQ_0
\\ simp[]
QED

(* -------------------------------------------------------------------------
Theorems about word_{to,from}_bin_list
------------------------------------------------------------------------- *)
Expand Down
17 changes: 17 additions & 0 deletions src/num/extra_theories/bitScript.sml
Original file line number Diff line number Diff line change
Expand Up @@ -1560,4 +1560,21 @@ Proof
\\ SRW_TAC[][BITWISE_AND_0_lemma]
QED

Theorem BITWISE_AND_SHIFT_EQ_0:
!w x y n.
x < 2 ** n ==>
BITWISE w $/\ x (y * 2 ** n) = 0
Proof
Induct \\ SRW_TAC[][BITWISE_def, SBIT_def]
\\ strip_tac
\\ Cases_on`w < n`
>- ( drule BIT_SHIFT_THM3 \\ simp[]
\\ Q.EXISTS_TAC`y` \\ simp[])
\\ FULL_SIMP_TAC(srw_ss())[NOT_LESS]
\\ drule TWOEXP_MONO2 \\ strip_tac
\\ `x < 2 ** w` by METIS_TAC[LESS_LESS_EQ_TRANS]
\\ drule NOT_BIT_GT_TWOEXP
\\ simp[]
QED

val _ = export_theory()

0 comments on commit db90904

Please sign in to comment.